On Dec 17, 2007 1:24 AM, Graeme Gill <graeme@xxxxxxxxxxxxx> wrote: > Frédéric Crozat wrote: > > > What distribution and what kernel version are you using ? > > I'm using WhiteBox 4 on an old piece of hardware and I updated > it recently. The kernel is 2.6.9-55.EL Wow and I thought I know a lot of distro :) More seriously, you should try a more recent linux kernel, USB stack has evolved a lot since 2.6.9 (even if it is patched in WB). > > I've also tested when usbhid doesn't handle the device and > > USBDEVFS_IOCTL is failing with the same error. > > It sounds like some change in the USB driver is causing > this to fail. > > I notice that the IOCTL definitions are rather loosely > connected to the user mode code - it's not > like there is a .h file to glue things together with > symbolic definitions, so it all depends on certain > magic numbers not changing: > > #define IOCTL_USB_DISCONNECT _IO('U', 22) > > int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface) > { > struct usb_ioctl command; > int ret; > > command.ifno = interface; > command.ioctl_code = IOCTL_USB_DISCONNECT; > command.data = NULL; > > ret = ioctl(dev->fd, IOCTL_USB_IOCTL, &command); > if (ret) > USB_ERROR_STR(-errno, "could not detach kernel driver from interface %d: > %s", > interface, strerror(errno)); > > return 0; > } > > Short of being able to trace exactly why the driver is rejecting > the IOCTL, the usual procedure is to play around with the call > (when it's called, what parameters it has), and see if one can > stumble on a combination that works :-( I'll try to patch our strace with a usbdevfs patch to display parameters used (I've seen such patch floating around). And I'll ask our kernel hackers at Mandriva if they have a clue. -- Frederic Crozat