1

I have a fully updated Archlinux installation and I use udev to set specific permissions on the device node based on USB bus and port numbers so that I can redirect the ports (and not devices based on product/vendor IDs) to a virtual machine.

This used to work before with the same OS, but after reinstalling, on each reboot the bus number changes and I have to manually adapt the udev rule and VM configuration, only to repeat the process again the next reboot.

Sometimes the bus appears as 3, sometimes as 8 and right now it appeared as 7; I'd rather not set those (insecure) permissions on all USB ports to avoid a security disaster, so how can I sort this out and have persistent USB bus numbers ?

1

From kernel sources (drivers/usb/core/usb.c): “busnum changes easily from modprobe order, cardbus or pci hotplugging, and so on”. Because of this we need to determine which “busid” belongs to the controller by PCI topology. You can also enumerate all USB devices by looking in "/sys/bus/usb/devices/usbN/" ("serial" is a PCI-slot number, "busnum" is a logical bus number, "N-M/N-M-K/... is a physical topology where you can find all of you need). If you use libvirt you can use busnum/devnum instead of vid/pid. To use it with udev you can write a script and udev rule with "... ACTION=="add", PROGRAM="/path/to/script [params]", SYMLINK+="%c" ...". Sorry for my bad english.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy