Stop usbhid from claiming usb device on hotplug

Armin Moradi amoradi at fedoraproject.org
Fri May 29 16:58:17 EDT 2015


Hi all,

I'm writing a kernel module, but probe() is never called since usbhid
claims the usb device as soon as the device is plugged in.

Tried/potential solutions:

#1: I have tried to write the usb hid id to
/sys/bus/usb/drivers/usbhid/unbind (e.g. echo "1-1.1:1.4" >
/sys/bus/usb/drivers/usbhid/unbind) and that properly unbinds the
device from usbhid, but I want my module to claim the device when it's
plugged in. Adding the above command to udev didn't do much as I
couldn't find a way to tell my module to claim it as it was plugged
in. It seems to me that usbhid claims the device, then udev rule
unbinds it, but since usbhid already claimed it at plugin, my module's
probe() wasn't called regardless.

#2: I also tried unloading usbhid and loading my module and *then*
usbhid. When the device was plugged in, usbhid still took over and my
module's probe() still wasn't called. Even if that worked, it wouldn't
feel like a proper solution.

#3: I could potentially blacklist the device in drivers sources, but
that doesn't seem a good option because I may want to have usbhid
manage the device at some point

At this point, I have no idea what else I could try! Any help or
direction would be appreciated.

Thanks.



More information about the Kernelnewbies mailing list