我有几个完全相同的usb 声卡并编写了一条 udev 规则,以便它们各自获得一个与所连接的特定端口匹配的永久名称。现在我添加了一个 pci usb 3.0 卡,它正在处理 usb 总线号。有时 pci usb 在内置 usb 之前加载,并且总线号较低,有时在内置 usb 之后加载,并且总线号较高。
我该怎么做才能强制内置和 pci 卡的总线号?
如果这不起作用,我该怎么做才能获取相同(没有序列号)USB 设备的持久设备名称,其中唯一的区别是它们所连接的端口?
~ $ uname -srvmpio
Linux 4.19.0-0.bpo.1-amd64 #1 SMP Debian 4.19.12-1~bpo9+1 (2018-12-30) x86_64 unknown unknown GNU/Linux
编辑(添加了 lsusb -t 的不同输出)总线 9 和 10 似乎可以随机地与 5 和 6 交换。添加的 pci usb3.0 卡在第一个输出中显示为 5 和 6,在第二个输出中显示为 9 和 10。有时设置是:
/: Bus 10.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 2, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 2, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 2, If 3, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 09.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 3, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 3, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 3, If 1, Class=Audio, Driver=snd-usb-audio, 12M
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 4: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
其他时候,无需更改硬件,重启后就可以:
/: Bus 10.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 09.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
|__ Port 4: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
|__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
/: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
/: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 2, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 2, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 3, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 3, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 3, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 3, If 1, Class=Audio, Driver=snd-usb-audio, 12M
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M