[PATCH 02/34] lsusb.py: sort toplevel entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mantas Mikulėnas <grawity@xxxxxxxxx>
---
 lsusb.py.in | 4 ++++
 1 file changed, 4 insertions(+)

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__())
 
-- 
2.21.0




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux