Permalink
Browse files

libusb: check result of scan_for_bt_endpoints

  • Loading branch information...
milamikica committed Dec 6, 2018
1 parent 696b00c commit 6fc6dfec018470faa3eee4f314f88083344e0fa6
Showing with 25 additions and 5 deletions.
  1. +25 −5 platform/libusb/hci_transport_h2_libusb.c
@@ -967,7 +967,11 @@ static int usb_open(void){
}

dev = libusb_get_device(aHandle);
scan_for_bt_endpoints(dev);
r = scan_for_bt_endpoints(dev);
if (r < 0){
usb_close();
return -1;
}

#else
// Scan system for an appropriate devices
@@ -993,9 +997,18 @@ static int usb_open(void){
if (!handle) continue;

r = prepare_device(handle);
if (r < 0) continue;
if (r < 0) {
handle = NULL;
continue;
}

dev = devs[i];
r = scan_for_bt_endpoints(dev);
if (r < 0) {
handle = NULL;
continue;
}

libusb_state = LIB_USB_INTERFACE_CLAIMED;
break;
};
@@ -1019,9 +1032,18 @@ static int usb_open(void){
if (!handle) continue;

r = prepare_device(handle);
if (r < 0) continue;
if (r < 0) {
handle = NULL;
continue;
}

dev = devs[deviceIndex];
r = scan_for_bt_endpoints(dev);
if (r < 0) {
handle = NULL;
continue;
}

libusb_state = LIB_USB_INTERFACE_CLAIMED;
break;
}
@@ -1034,8 +1056,6 @@ static int usb_open(void){
return -1;
}

scan_for_bt_endpoints(dev);

#endif

// allocate transfer handlers

0 comments on commit 6fc6dfe

Please sign in to comment.