Merge branch 'master' of github.com:signal11/hidapi

This commit is contained in:
Alan Ott
2011-02-09 08:43:02 -05:00
2 changed files with 15 additions and 3 deletions
+11 -3
View File
@@ -755,9 +755,17 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
break;
}
good_open = 1;
res = libusb_detach_kernel_driver(dev->device_handle, intf_desc->bInterfaceNumber);
if (res < 0) {
//LOG("Unable to detach. Maybe this is OK\n");
/* Detach the kernel driver, but only if the
device is managed by the kernel */
if (libusb_kernel_driver_active(dev->device_handle, intf_desc->bInterfaceNumber) == 1) {
res = libusb_detach_kernel_driver(dev->device_handle, intf_desc->bInterfaceNumber);
if (res < 0) {
libusb_close(dev->device_handle);
LOG("Unable to detach Kernel Driver\n");
good_open = 0;
break;
}
}
res = libusb_claim_interface(dev->device_handle, intf_desc->bInterfaceNumber);
+4
View File
@@ -420,6 +420,10 @@ MainWindow::onTimeout(FXObject *sender, FXSelector sel, void *ptr)
input_text->appendText(s);
input_text->setBottomLine(INT_MAX);
}
if (res < 0) {
input_text->appendText("hid_read() returned error\n");
input_text->setBottomLine(INT_MAX);
}
getApp()->addTimeout(this, ID_TIMER,
5 * timeout_scalar /*5ms*/);