Open GoogleCodeExporter opened 8 years ago
Sorry, the kernel version should be >=2.6.35.5.
Original comment by sven.koe...@gmail.com
on 31 Oct 2010 at 5:05
Indeed, the suggestion is good. Use of usb_detach_kernel _driver_np solve this
issue with my linux kernel > 2.6.32.
This is my quick patch:
--- libnxt-0.3/lowlevel.c 2007-04-22 05:24:17.000000000 +0200
+++ libnxt-0.3.1/lowlevel.c 2010-11-15 00:46:00.000000000 +0100
@@ -93,9 +93,18 @@
{
char buf[2];
int ret;
+ char bound_driver_name[20];
nxt->hdl = usb_open(nxt->dev);
+//detach possible kernel driver bound to interface
+ if
(usb_get_driver_np(nxt->hdl,1,bound_driver_name,sizeof(bound_driver_name))==0)
+ {
+ if (usb_detach_kernel_driver_np(nxt->hdl, 1)<0)
+ fprintf(stderr,"Failed to detach the driver %s (or cdc-acm) bound to the USB
interface",bound_driver_name);
+ //Let usb_set_configuration() below return an error and handle it
+ }
+
ret = usb_set_configuration(nxt->hdl, 1);
if (ret < 0)
{
Original comment by l.cuvil...@gmail.com
on 14 Nov 2010 at 11:57
I wonder, is there a race here? What if usb_get_driver_np returns a driver, but
it's detached by another process before you call usb_detach_kernel_driver_np.
Does usb_detach_kernel_driver_np return success, if no driver is actually
attached at the moment? Unfortunatly, the libusb docs don't answer any of these
quesions.
Original comment by sven.koe...@gmail.com
on 15 Nov 2010 at 1:12
Original issue reported on code.google.com by
sven.koe...@gmail.com
on 31 Oct 2010 at 4:53