How to prevent drivers from binding USB devices on a certain bus

driverskernelusb

I have a setup with two Logitech Unifying receivers, each receiver has a keyboard bound to it. One of the receiver is to be used by the physical machine to which the devices are connected, the other one has to be passed to a QEMU virtual machine.

I am able to manually unbind one receiver following the instructions in How to use Linux kernel driver bind/unbind interface for USB-HID devices?. This method has some disadvantages:

  • I have to determine the device identifier manually by looking at dmesg.
  • Each time the virtual machine is closed, and on every reboot, the unbinding process has to be repeated.

I then tried to find kernel module options that prevents the USB driver from binding it at all and found the quirks option for usbhid. Unfortunately, this parameter cannot be used since I have two identical receivers with the same vendor and device ID.

The two devices are distinguishable by their separate buses. That is, lsusb looks like:

Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver

Is there a way to prevent hid-logitech-dj (or usbhid) from binding a USB device on a certain bus?

The target machine is running Arch Linux 64-bit with a Linux 3.9 kernel.

Best Answer

Within UDEV it is possible to add a rule to search for the specific bus and set the OPTIONS to "ignore_device". Did you mention your Kernel version or OS?

Related Question