From: <to...@fr...> - 2008-01-31 15:29:43
|
Hi, i'm using your lib and i have some problems :/ my entire code (very simple): #include <iostream> #include <iomanip> #include <usbpp.h> #define VENDOR_FTDI 0x0403 #define PRODUCT_FTDI 0x6001 using namespace std ; int main(void) { struct usb_bus *busses ; struct usb_device *dev ; struct usb_bus *bus ; // Initialisation de l'usb usb_init() ; // Init de la classe usb_find_busses() ; // Scan de tous les bus usb_find_devices() ; // Scan de tous les périphériques busses = usb_get_busses() ; // // Pour tous les bus du système for (bus = busses ; bus ; bus = bus->next) { // Pour tous les périphériques connectés aux bus for (dev = bus->devices ; dev ; dev = dev->next) { // Si le périphérique correspond au identifiants FTDI, effectuer le traitement if ((dev->descriptor.idVendor == VENDOR_FTDI)&&(dev->descriptor.idProduct == PRODUCT_FTDI)) { usb_dev_handle *handle ; int ret; // Open handle = usb_open(dev) ; cout << handle << endl ; ret = usb_claim_interface(handle, dev->config->interface->altsetting->bInterfaceNumber); cout << "Claim " << ret << endl ; char buf[6] = {0x1b, 0x11, 0x01, 0xcc, 0xf9, 0x1d} ; ret = usb_bulk_write(handle, dev->config->interface->altsetting->endpoint->bEndpointAddress, buf, sizeof(buf), 5000); cout << "Bulk " << ret << endl ; usb_close(handle) ; } } } return EXIT_SUCCESS ; } My problem is that i can't claim the device and i've not find out why on the web :/ When launching is have this : [root@93-1ec101fa17f tests]# ./find_mice 0x605780 (comment : handle) Claim -16 (comment : ret for claim) Bulk -16 (etc..) The error code seems to be -16 but i don't know him :/ I'm pretty new on programming on linux and i have some difficulties so maybe i've forgot something really easy but i can't find out what :/ So thx for your time and help ;) have a nice day |