USB controller enumeration on APU3 is random since the update to kernel 6.6

Felix Fietkau nbd at nbd.name
Wed Jul 17 05:38:17 PDT 2024


On 17.07.24 14:29, Florian Eckert wrote:
>> In my opinion, the best course of action is to just deal with it by
>> changing the code to no longer rely on usbX names. Better make it
>> depend on the sysfs path, similar to wifi-device path handling in the
>> wireless config.
> 
> I am already using the sysfs path, but if the usbX name changes then
> also the
> sysfs path changes as well! See the devices I have attached '->'. Or am
> I
> misunderstanding you?
> 
> Boot 1:
> root at G3-10940 /sys/bus/usb/devices # ls -la | grep usb
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 1-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1/1-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 1-1 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1/1-1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 1-1.2 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1/1-1/1-1.2
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 1-1.2:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1/1-1/1-1.2/1-1.2:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 1-1:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1/1-1/1-1:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3/2-1.3:1.0
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3:1.1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3/2-1.3:1.1
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3:1.2 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3/2-1.3:1.2
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3:1.3 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3/2-1.3:1.3
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1.3:1.4 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1.3/2-1.3:1.4
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 2-1:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2/2-1/2-1:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 3-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb3/3-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 4-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:10.0/usb4/4-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb1 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:56 usb2 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb2
> 
> Boot 2:
> root at G3-10940 /sys/bus/usb/devices # ls -la | grep usb
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3/1-1.3:1.0
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3:1.1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3/1-1.3:1.1
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3:1.2 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3/1-1.3:1.2
> -> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3:1.3 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3/1-1.3:1.3
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1.3:1.4 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1.3/1-1.3:1.4
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 1-1:1.0 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 2-0:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2/2-0:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 2-1 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2/2-1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 2-1.2 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2/2-1/2-1.2
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 2-1.2:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2/2-1/2-1.2/2-1.2:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 2-1:1.0 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2/2-1/2-1:1.0
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb1 ->
> ../../../devices/pci0000:00/0000:00:13.0/usb1
> lrwxrwxrwx    1 root     root             0 Jul 17 12:43 usb2 ->
> ../../../devices/pci0000:00/0000:00:12.0/usb2

Oh, right. The main issue here is the fact that the device ids in the 
path contain the bus number as initial component. I guess the syntax 
could be something like: "pci0000:00/0000:00:12.0%<id>"
To resolve it, it would look up the bus number from the controller path 
and then use /sys/bus/usb/devices/<bus>-<id> as the device path.

- Felix



More information about the openwrt-devel mailing list