[argyllcms] Re: HID issue with libusb on Huey

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Mon, 17 Dec 2007 11:24:18 +1100

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

Was Huey handled by usbhid driver (as shown in /proc/bus/usb/devices) ?

The Huey is obviously grabbed by the HID driver, the IOCTL detaches
it, and libusb then successfully handles it. This is exactly
the type of approach libhid uses, since it too is based on libusb.

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 :-(

Graeme Gill.



Other related posts: