Closed undisputed-seraphim closed 1 year ago
@ValZapod @gregkh Apologies for the late reply. I have made a more correct fix on my branch.
My laptop is connected to a dock that has a bunch of stuff on it.
lsusb -t
from the current master looks like this:
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
|__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
|__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 10000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
|__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 25, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 26, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 29, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
|__ Port 2: Dev 27, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 27, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 28, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 4: Dev 32, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 32, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 31, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 31, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 31, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 31, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 1: Dev 30, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 1: Dev 30, If 1, Class=Vendor Specific Class, Driver=, 12M
|__ Port 8: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 8: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 9: Dev 8, If 0, Class=Vendor Specific Class, Driver=, 12M
Notice that all ports beyond the first level descriptors (the ones immediately after Bus numbers) are unsorted.
After this fix (now only one line), the output becomes
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 10000M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 10000M
|__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=r8152, 5000M
|__ Port 3: Dev 3, If 0, Class=Hub, Driver=hub/4p, 10000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
|__ Port 3: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 1: Dev 2, If 2, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 25, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 26, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 27, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 27, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 28, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 30, If 0, Class=Vendor Specific Class, Driver=, 12M
|__ Port 1: Dev 30, If 1, Class=Vendor Specific Class, Driver=, 12M
|__ Port 2: Dev 31, If 0, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 31, If 1, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 31, If 2, Class=Audio, Driver=snd-usb-audio, 12M
|__ Port 2: Dev 31, If 3, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 32, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 32, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 4: Dev 29, If 0, Class=Vendor Specific Class, Driver=pl2303, 12M
|__ Port 8: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 8: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 9: Dev 8, If 0, Class=Vendor Specific Class, Driver=, 12M
Reworded my commit message to include more details about before and after.
So this is just a cosmetic issue, like on Dev 31 interfaces are not sorted?
Indeed it is purely cosmetic. I made this change when I was monitoring the output of lsusb -t
to try to troubleshoot something else, and the unsorted output became my itch that I really needed to scratch.
Thanks for the updated changelog comment!
When sorting child devices, only the first child is recursed into. This fix allows all child devices to be recursed into.
Signed-off-by: Tan Li Boon liboon.tan@mujin.co.jp