Results 1 to 1 of 1
Thread: my driver vs. usbhid driver
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jun 2011
my driver vs. usbhid driver
I'm currently in the process of writing a usb device driver but i have a issue i can't find the answer to so i thought i'd put it to the forum to see if u guys can help.
i have a usb HID device that has two functions 1st is a standard USB mouse 2nd is a LED that i can change the color of, both functions use the same vid/pid, i.e. dmesg shows two devices connected with the same vid/pid.
without my driver loaded when i connect my device both functions get picked up by the usbhid module and the mouse part works fine but obviously the LED doesn't. so i load my module but as the usbhid module has already claimed the device i am unable to claim it with my driver.
if i unload the usbhid driver and manually load my module it checks the device for it's functions and claims the LED but not the mouse (what i wanted) but now without the usbhid module loaded the mouse part (or any other USB HID device) doesn't work. however the kernel realizes this and loads the usbhid module and claims the mouse device, at this point everything works as expected.
my issue is this if i leave both modules unloaded and connect my device the usbhid module loads 1st and clams both devices and my driver doesn't get a chance to do it's job, it's not even loaded by the kernel at this point, if i blacklist the usbhid module my driver loads automatically without any problems claims only the LED device and leaves the mouse device there waiting to be claimed, so what i need to do is somehow give my driver higher priority the the usbhid module, i know of a few tricks with udev, usbhid quarks and unbinding through /sys but what i want to do is hard code it in my driver to take priority over the usbhid module so the enduser can just compile and go with out having to do any extra work.
btw this is my 1st driver so i may be missing a trick here, but i have googled and checked all my books and other then google returning some results with similar issue and no resolution i'm not able to find an answer for hard coding just the work a rounds.