diff options
author | Mantas Mikulėnas <grawity@gmail.com> | 2019-05-06 12:02:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-06 13:11:47 +0200 |
commit | f95c78e744e68e9a0f008cd047b9fe7248b4b51e (patch) | |
tree | dc2bdbfab84a24762a1594a400225e5b2cb72a2d | |
parent | 6e0f8c3e5c681f9cc90730c8e79ab0da521971f2 (diff) | |
download | usbutils-f95c78e744e68e9a0f008cd047b9fe7248b4b51e.tar.gz |
lsusb.py: sort toplevel entries
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | lsusb.py.in | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lsusb.py.in b/lsusb.py.in index ccbfadb..278980d 100644 --- a/lsusb.py.in +++ b/lsusb.py.in @@ -580,6 +580,7 @@ def usage(): def read_usb(): "Read toplevel USB entries and print" + root_hubs = [] for dirent in os.listdir(prefix): #print(dirent,) if not dirent[0:3] == "usb": @@ -587,6 +588,9 @@ def read_usb(): usbdev = UsbDevice(None, 0) usbdev.read(dirent) usbdev.readchildren() + root_hubs.append(usbdev) + root_hubs.sort(key=lambda x: int(x.fname[3:])) + for usbdev in root_hubs: os.write(sys.stdout.fileno(), str.encode(usbdev.__str__())) #print(usbdev.__str__()) |