[PATCH 22/34] lsusb.py: use a constant for the magic class number 9

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

 



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

diff --git a/lsusb.py.in b/lsusb.py.in
index 2c1e5e2..e9e18dc 100644
--- a/lsusb.py.in
+++ b/lsusb.py.in
@@ -17,6 +17,8 @@ import os
 import re
 import sys
 
+HUB_ICLASS = 0x09
+
 # Global options
 showint = False
 showhubint = False
@@ -413,7 +415,7 @@ class UsbDevice:
 		self.children.sort(key=usbsortkey)
 
 	def __str__(self):
-		if self.iclass == 9:
+		if self.iclass == HUB_ICLASS:
 			col = cols[2]
 			if noemptyhub and len(self.children) == 0:
 				return ""
@@ -421,7 +423,7 @@ class UsbDevice:
 				strg = ""
 		else:
 			col = cols[1]
-		if not nohub or self.iclass != 9:
+		if not nohub or self.iclass != HUB_ICLASS:
 			if self.nointerfaces == 1:
 				plural = " "
 			else:
@@ -431,7 +433,7 @@ class UsbDevice:
 				 cols[1], self.vid, self.pid, cols[0],
 				 self.iclass, self.usbver, self.speed, self.maxpower,
 				 self.nointerfaces, plural, col, self.name, cols[0])
-			if self.iclass == 9 and not showhubint:
+			if self.iclass == HUB_ICLASS and not showhubint:
 				strg += " %shub%s\n" % (cols[2], cols[0])
 			else:
 				strg += "\n"
-- 
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