driver development: usbhid is blocking custom device driver
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
driver development: usbhid is blocking custom device driver
Hej!
I'm developing a custom usb device driver (Stereovision HMD). Unfortunately the Linux usbhid driver (resp. the correlating kernel module) kind of catches the device as soon as it is connected to dhe usb host controller. Thus my own driver (identifying via vendorID and productID) is blocked. I searched the internet for a way to prevent usbhid from catching the device and found a couple of solutions, but nothing worked so far, as I just didn't find the files proposed by that solutions (blacklisting vendorid and productid in some files, e.g. usbhid.conf...). I can't figure out a up-to-date solution.
I'm running Ubuntu, 2.6.32-25 Kernel.
I just can't imagine why the standard Linux driver for HID (usbhid) is associated to that device when there is a driver loaded (my driver kernel module), which provides the correct IDs!? Anyway, is there a solution for that problem? A kind of priority list? Can I override/overload usbhid? Or do I have to use blacklists? Best solution would be within my driver code, as I want to port my driver to other systems whithout hacking some kernel properties everytime...
every hint would be appreciated!
best regards
ps: my nasty workaround is a shell script that unloads the usbhid module, waits 20 seconds for me to plug the usb device and reloads the usbhid module. works. kind of
hej, tried it with echo:
echo 4-3.1\:1.0 > /sys/bus/usb/drivers/usbhid/unbind
but output is the same, permission denied, with sudo as well.
4-3.1:1.0 should be the correct id. I obtained it with plugging/unplugging the device and searched for changes in /sys/bus/usb/drivers/usbhid/. Is there a nicer way of getting that id? via lsusb, usb-device or via the device-file?
, where z800_a is my driver, will load the correct driver for the device even when plugging/unplugging the device. so the sequence in which modules are loaded somehow affect their priority concerning probing devices...?!
Last edited by beetleskin; 12-16-2010 at 12:03 PM.
When the USB device is bound to the usbhid driver, it should appear as a symlink in the usbhid sysfs directory. For example, my /sys/bus/usb/drivers/usbhid directory looks like this:
As root I can echo 2-3:1.0 > unbind and I lose my mouse. The 2-3:1.0 symlink disappears as it's no longer bound to the hid driver. Then I can echo 2-3:1.0 > bind and I get it back again.
I have an FTDI USB serial device which I communicate with using libusb, not through the usb-serial FTDI driver. I have to unbind this one device from the usb-serial driver in exactly the same way.
yep, it does appear in the usbhid directory. But allt he same even as root I'm somehow not allowed to unbind it this way. but anyway, this is not the solution I'm looking forward, as I want the device to be bound to the correct driver automatically, at startup and without running a script every time...
Sorry for reviving an old thread, but I think the reason you're not able to unbind the device is that only the echo is being run as root when using sudo.
Switch to an actual root prompt (sudo -s) first and echoing the device id to the bind/unbind interface should work.
Sorry for reviving an old thread, but I think the reason you're not able to unbind the device is that only the echo is being run as root when using sudo.
Switch to an actual root prompt (sudo -s) first and echoing the device id to the bind/unbind interface should work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.