Skip to contentSkip to conversation

usb: failure to obtain HID descriptor via usb_control_msg

DISCUSSION martin f krafft 3 participants 3 messages Jan 13, 2004

lore
Share & tools
lore
#0 lore raw

Hi there,

First off, please apologise the cross-post. I will make sure to send the solution to both lists. Please, if you identify the problem to be with either project, take the other list out of the reply recipients.

I am trying to get the HID descriptor of a HID device with usb_control_msg:

  udev = usb_open(dev);
  usb_set_altinterface(udev, 0);
  usb_claim_interface(udev, 0);
  usb_control_msg(udev, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR,
                  USB_DT_HID, 0, buf, 0x9, USB_TIMEOUT);

However, this fails with the following debug messages (level 3), even though it was invoked by root:

Check that you have permissions to write to 002/004 and, if you
don't, that you set up hotplug
(http://linux-hotplug.sourceforge.net/) correctly.
USB error: could not claim interface 0: Device or resource busy USB error: error sending control message: Device or resource busy

So I dived into hotplug and ended up adding a line to /etc/hotplug/usb.usermap to effectively disable the device by specifying a name unequal to all kernel module names, as advised on the hotplug webpage:

nonexistant 0x0 0x06c2 0x0038 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0

My reasoning is that I assume the device to be busy because the HID kernel driver has assumed control over it (and it's in fact accessible via /dev/usb/hiddev?). However, it may also be a libusb problem that I am overseeing

However the result was not very pleasing:

usb.agent[7712]: Setup hid for USB product 6c2/38/300 usb.agent[7712]: kernel driver hid already loaded usb.agent[7712]: Setup nonexistant for USB product 6c2/38/300

effectively, my addition caused the 'nonexistant' pseudo-driver to be set up in addition to hid.

How can I disable hotplug setting up 'hid' for this very device?

Thanks for any pointers or tips.

Signature · 8 lines
martin;              (greetings from the heart of the sun.)
  \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
 
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
 
"there are more things in heaven and earth, horatio,
 than are dreamt of in your philosophy."
                                                             -- hamlet
#1 lore raw
Quoted 2 lines · martin f krafft

How can I disable hotplug setting up 'hid' for this very device?

Disable CONFIG_USB_HID from your kernel configuration :)

There is a usbfs ioctl that can disconnect a driver from a device, but I don't know if that ever got backported to 2.4 (it's in 2.6). You could also use that.

Good luck,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to martin f krafft

Am Dienstag, 13. Januar 2004 20:09 schrieb Greg KH:

Quoted 9 lines · martin f krafft
Quoted 2 lines

How can I disable hotplug setting up 'hid' for this very device?

Disable CONFIG_USB_HID from your kernel configuration :)

There is a usbfs ioctl that can disconnect a driver from a device, but I don't know if that ever got backported to 2.4 (it's in 2.6). You could also use that.

It is in 2.4.
In theory you are racing with module load of the HID driver, so prepare to retry.

Regards
Oliver

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel