From: Bob T. <to...@se...> - 2014-08-02 01:18:23
|
Hi, it checks the VID and PID int is_correctdev( libusb_device *dev ) { struct libusb_device_descriptor desc; int r = libusb_get_device_descriptor( dev, &desc ); //printf("Checking VID=0x%04x, PID=0x%04x\n", desc.idVendor, desc.idProduct); if( desc.idVendor == VENDOR_ID && (desc.idProduct == PRODUCT_ID) { //printf("device found: class=0x%x\n", desc.bDeviceClass); return 1; } return 0; } On Thu, Jul 31, 2014 at 3:42 AM, Matthias Bolte < mat...@go...> wrote: > 2014-07-29 23:28 GMT+02:00 Bob Tausworthe <to...@se...>: > > Sorry to trouble you but I've exhausted other options. We are developing > a > > composite HID/debug interace device and are using libusb 1.0 under 32 bit > > Cygwin to access the debug interface portion. Everything is working fine > on > > Windows 7 and Linux but when we try to run the application on Windows 8, > it > > fails with the error : > > > > libusb: debug [unsupported_open] unsupported API call for 'open' > > (unrecognized device driver) > > libusb: debug [libusb_open] open 2.16 returns -12 > > ERROR: Unable to open usb device > > > > After reading some posts of people with similar issues, I tried all of > the > > drivers Zadig supports but didn't see any difference in behavior. I have > > tried building under Win7 and Win8 but the results are the same. I am > using > > version 1.0.18 of libusb. The trace below was taken with the WinUSB > driver > > version 6.1.7600.16385. > > > > Any help you can give me to point me in the right direction would be > > welcome. Here is the code I'm using to open our device and the trace > > listing. > > > > Thanks > > > > Bob Tausworthe > > to...@se... > > Sentons, inc. > > > > int > > > > InitUSB(void) > > > > { > > > > // Change these as needed to match idVendor and idProduct in your > > device's device descriptor. > > > > int device_ready = 0; > > > > int result; > > > > libusb_device **list; > > > > libusb_device *found = NULL; > > > > libusb_context *ctx = NULL; > > > > int attached = 0; > > > > result = libusb_init(&ctx); > > > > if (result == 0) { > > > > if (usb_trace_enabled) > > > > libusb_set_debug(ctx,255); // LIBUSB_LOG_LEVEL_DEBUG, > > LIBUSB_LOG_LEVEL_WARNING > > > > ssize_t i = 0; > > > > int err = 0; > > > > ssize_t cnt = libusb_get_device_list(ctx, &list); > > > > if (cnt < 0){ > > > > fprintf(stderr, "ERROR: no usb devices found\n" ); > > > > error(); > > > > } > > > > // find our device. Note we are using the brute force method rather > > > > // than open_device_with_vid_pid() because we need the device pointer > > > > // to look at the config descriptor. > > > > for(i = 0; i < cnt; i++){ > > > > libusb_device *device = list[i]; > > > > if( is_correctdev(device) ){ > > How does the is_correctdev() function decide which device to pick? > > -- > Matthias Bolte > http://photron.blogspot.com > > > ------------------------------------------------------------------------------ > Infragistics Professional > Build stunning WinForms apps today! > Reboot your WinForms applications with our WinForms controls. > Build a bridge from your legacy apps to the future. > > http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk > _______________________________________________ > libusbx-devel mailing list > lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusbx-devel > |