aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2019-05-06 12:02:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-06 14:29:36 +0200
commit0a198e0cb655ea585ec7d576ce329679b6d916e4 (patch)
treef397d1f55ecc857d331a08627823d88bd00b4131
parentec0de65683e7fec444dbc89a9b625ff85e5f0e8f (diff)
downloadusbutils-0a198e0cb655ea585ec7d576ce329679b6d916e4.tar.gz
lsusb.py: use a constant for the magic class number 9
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lsusb.py.in8
1 files changed, 5 insertions, 3 deletions
diff --git a/lsusb.py.in b/lsusb.py.in
index 86eb328..e5201e7 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"