- if ( desc.idVendor == vendor && desc.idProduct == product &&
- ncusb_match_string(handle, desc.iManufacturer, vendor_name) &&
- ncusb_match_string(handle, desc.iProduct, product_name) &&
- ncusb_match_string(handle, desc.iSerialNumber, serial)
- )
- {
- found = handle;
+ if ( desc.idVendor == vendor && desc.idProduct == product ) {
+ if ( libusb_open(device, &handle) )
+ continue;
+
+ if (ncusb_match_string(handle, desc.iManufacturer, vendor_name) &&
+ ncusb_match_string(handle, desc.iProduct, product_name) &&
+ ncusb_match_string(handle, desc.iSerialNumber, serial) )
+ {
+ found = handle;
+ }