[PATCH 01/34] lsusb.py: sort devices and interfaces numerically

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

 



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

diff --git a/lsusb.py.in b/lsusb.py.in
index b85d770..ccbfadb 100644
--- a/lsusb.py.in
+++ b/lsusb.py.in
@@ -477,6 +477,9 @@ class UsbDevice:
 				usbdev.read(dirent)
 				usbdev.readchildren()
 				self.children.append(usbdev)
+		usbsortkey = lambda obj: [int(x) for x in re.split(r"[-:.]", obj.fname)]
+		self.interfaces.sort(key=usbsortkey)
+		self.children.sort(key=usbsortkey)
 
 	def __str__(self):
 		#str = " " * self.level + self.fname
-- 
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