How to ignore a USB device in udev
I have found this great link, which contained the answer to my problem.
By letting udev execute echo 0 > /sys/bus/usb/devices/1-3/authorized
on the usb device, access from the host system to it was blocked.
Related videos on Youtube
mat
Mathematician, Father, political Mono at Work, Scratch with my son
Updated on September 18, 2022Comments
-
mat over 1 year
I want to pass a USB device (to be precise: a smart card reader) to a KVM virtual machine, and therefore have to prohibit that it is claimed by any driver on the host machine.
I tried to write a udev rule for it with the help of this site, but appearently the udev option "ignore_device" has been removed a few years ago with no replacement. Thus, the udev rule installed by the driver of the reader is processed and my host machine claims it.
Is there some sort of replacement for "ignore_device" in current udev versions?
-
Stefan Seidel almost 11 yearsIs it using a specific kernel module? Then it would be possible to blacklist the module in, say,
/etc/modprobe.d/no-load-driver.conf
. -
mat almost 11 years@Stefan Seidel: I know, but no, that is not an option. The driver works in the user space only.
-
Stefan Seidel almost 11 yearsSo there is no kernel module loaded for that device? What exactly do you want to achieve, then? Why wouldn't you just remove the "udev rule installed by the driver of the reader" if you don't want it to happen?
-
mat almost 11 yearsBecause I might want to plugin two readers and use one on the host and one in the guest.
-
Stefan Seidel almost 11 yearsThen you could make the original udev rule so specific that it will only match the one card reader you don't want to use in the virtual machine, e.g. by adding the serial number or the path (i.e. the hub and slot on this hub where you connect it).
-
mat almost 11 yearsYes, that would work. But I'd rather not change the files installed from the system and just add some configuration of my own, which won't be touched by an update. I'm really surprised, that that is such a difficult thing to achieve, especially since there once was a solution in udev a few years ago. What did all the people do, who used "ignore_device" in the past?
-