summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlibdlo <libdlo@displaylink.com>2009-05-14 11:00:28 -0700
committerlibdlo <libdlo@displaylink.com>2009-05-14 11:00:28 -0700
commit1e340f4bad503a07dd30310aa3d10d5ec37f2b83 (patch)
tree5d3e2789082e5d5c22705bc0ea6874947bcf1dac
parentd0a9f4b60ba9eb5d962a87e4c23a384c8eb96f4c (diff)
Add functions to detach kernel drivers (but not yet working properly)
-rw-r--r--src/dlo_usb.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/dlo_usb.c b/src/dlo_usb.c
index 5c12ee3..e28f803 100644
--- a/src/dlo_usb.c
+++ b/src/dlo_usb.c
@@ -289,6 +289,7 @@ dlo_retcode_t dlo_usb_open(dlo_device_t * const dev)
{
dlo_retcode_t err;
usb_dev_handle *uhand;
+ char* driver_name;
int usb_configuration;
int32_t db = usb_find_busses();
int32_t dd = usb_find_devices();
@@ -310,11 +311,26 @@ dlo_retcode_t dlo_usb_open(dlo_device_t * const dev)
/* Establish the connection with the device */
//DPRINTF("usb: open: setting config...\n");
- /* set configuration fails on composite devices,
- * such as 1st gen HP USB 2.0 docks.
- * With libusb 1.0, we could at least only set
- * configuration when necessary, but only partial
- * mitigation. Need full solution.
+ /*
+ * Because some displaylink devices may report
+ * a class code (like HID or MSC) that gets
+ * matched by a kernel driver, must detach
+ * those drivers before libusb can successfully
+ * set configuration or talk to those devices
+ * unfortunately, this call returns error
+ * even if successful
+ /
+ driver_name = dlo_malloc(128);
+ if (!usb_get_driver_np(uhand, 0, driver_name, 128))
+ {
+ DPRINTF("usb: driver (%s) already attached to device\n", driver_name);
+ usb_detach_kernel_driver_np(uhand,0);
+ }
+
+ /* set configuration fails on composite devices.
+ * We could set configuration
+ * only when necessary, but that's just a partial
+ * mitigation. TODO: Need fuller solution.
*/
//usb_configuration = usb_get_configuration(uhand);
//if (usb_configuration != 1)