How to ignore a USB device in udev

9,268

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.

Share:
9,268

Related videos on Youtube

mat
Author by

mat

Mathematician, Father, political Mono at Work, Scratch with my son

Updated on September 18, 2022

Comments

  • mat
    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
      Stefan Seidel almost 11 years
      Is 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
      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
      Stefan Seidel almost 11 years
      So 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
      mat almost 11 years
      Because I might want to plugin two readers and use one on the host and one in the guest.
    • Stefan Seidel
      Stefan Seidel almost 11 years
      Then 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
      mat almost 11 years
      Yes, 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?