Hello all,
I just subscribed to the list and since the archive seems to be offline I
don't know if this has been answered before or if it is innapropriate.
I'm trying to write code on Linux to communicate with a Cypress card. We
already have code running on windows using a customized version of libusb.
Running the same libusb on Linux or calling IOCTL directly doesn't work.
Here's a little rundown:
- I first reused code from loadfx to upload our firmware to the card and
this seems to run fine.
- then when I want to start configuring the card and then doing bulk on it,
it won't work.
[...] device configuration, fxload code, ...
int ret, Config, Interface;
struct usbdevfs_setinterface interface;
struct usbdevfs_connectinfo connect={0xDEAD,0xBE};
struct usbdevfs_getdriver driver;
errno=0;
Config=1;
ret = ioctl(fd, USBDEVFS_SETCONFIGURATION, &Config);
if (ret < 0)
perror("Error setting Usb config");
// seems to work
errno=0;
Interface=0;
ret = ioctl(fd, USBDEVFS_CLAIMINTERFACE, &Interface);
if (ret < 0)
perror("Error claiming interface");
// returns "Device or resource busy"
// This is necessary
interface.interface = Interface;
interface.altsetting = 1;
errno=0;
ret = ioctl(fd, USBDEVFS_SETINTERFACE, &interface);
if (ret < 0)
perror("Error setting Usb alternate");
// returns "Device or resource busy"
errno=0;
ret = ioctl(fd, USBDEVFS_CONNECTINFO, &connect);
if (ret < 0) perror("Error getting connect info");
else printf("Connect info: devnum %d, slow: %x\n",
connect.devnum, connect.slow);
// Returns Connect info: devnum 6, slow: 0
errno=0;
ret = ioctl(fd, USBDEVFS_GETDRIVER, &driver);
if (ret < 0) perror("Error getting driver info");
else printf("Driver info: interface: %d, driver: %s\n",
driver.interface, driver.driver);
// returns "No data available"
Any attempt at bulk transfer also returns "Device or resource busy"
Checked the user permission on the dev file:
$ ll $(./getdevpath -v 0547 -p 2235)
-rw-rw-rw- 1 root root 236 May 29 10:48 /proc/bus/usb/001/006
I've tried plenty of things (a C++ library based on libusb fails in the same
way) and I really don't know what to try next. I have the feeling I've
overlooked something obvious... Please enlighten me !!!
--
Guillaume Dargaud
http://www.gdargaud.net/Antarctica/
"They don't make bugs like Bunny anymore." — Olav Mjelde.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users