[PATCH 05/34] lsusb.py: remove -w (warn if usb.ids not sorted) option

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

 



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

diff --git a/lsusb.py.in b/lsusb.py.in
index 9ca734c..b0964c1 100644
--- a/lsusb.py.in
+++ b/lsusb.py.in
@@ -19,7 +19,6 @@ showint = False
 showhubint = False
 noemptyhub = False
 nohub = False
-warnsort = False
 showeps = False
 
 prefix = "/sys/bus/usb/devices/"
@@ -518,42 +517,6 @@ class UsbDevice:
 			str += child.__str__()
 		return str
 
-def display_diff(lst1, lst2, fmtstr, args):
-	"Compare lists (same length!) and display differences"
-	for idx in range(0, len(lst1)):
-		if lst1[idx] != lst2[idx]:
-			print("Warning: " + fmtstr % args(lst2[idx]))
-
-def fix_usbvend():
-	"Sort USB vendor list and (optionally) display diffs"
-	if warnsort:
-		oldusbvend = usbvendors[:]
-	usbvendors.sort()
-	if warnsort:
-		display_diff(usbvendors, oldusbvend, 
-				"Unsorted Vendor ID %04x",
-				lambda x: (x.vid,))
-
-def fix_usbprod():
-	"Sort USB products list"
-	if warnsort:
-		oldusbprod = usbproducts[:]
-	usbproducts.sort()
-	if warnsort:
-		display_diff(usbproducts, oldusbprod, 
-				"Unsorted Vendor:Product ID %04x:%04x",
-				lambda x: (x.vid, x.pid))
-
-def fix_usbclass():
-	"Sort USB class list"
-	if warnsort:
-		oldusbcls = usbclasses[:]
-	usbclasses.sort()
-	if warnsort:
-		display_diff(usbclasses, oldusbcls,
-				"Unsorted USB class %02x:%02x:%02x",
-				lambda x: (x.pclass, x.subclass, x.proto))
-
 
 def usage():
 	"Displays usage information"
@@ -568,7 +531,6 @@ def usage():
 	print("  -U            suppress all hubs")
 	print("  -c            use colors")
 	print("  -e            display endpoint info")
-	print("  -w            display warning if usb.ids is not sorted correctly")
 	print("  -f FILE       override filename for /usr/share/usb.ids")
 	print()
 	print("Use lsusb.py -ciu to get a nice overview of your USB devices.")
@@ -592,7 +554,7 @@ def read_usb():
 def main(argv):
 	"main entry point"
 	global showint, showhubint, noemptyhub, nohub
-	global warnsort, cols, usbids, showeps
+	global cols, usbids, showeps
 	try:
 		(optlist, args) = getopt.gnu_getopt(argv[1:], "hiIuUwcef:", ("help",))
 	except getopt.GetoptError as exc:
@@ -620,7 +582,7 @@ def main(argv):
 			cols = (norm, bold, red, green, amber, blue)
 			continue
 		if opt[0] == "-w":
-			warnsort = True
+			print("Warning: option -w is no longer supported", file=sys.stderr)
 			continue
 		if opt[0] == "-f":
 			#usbids = (opt[1], *usbids)
@@ -636,9 +598,6 @@ def main(argv):
 	if usbids[0]:
 		try:
 			parse_usb_ids()
-			fix_usbvend()
-			fix_usbprod()
-			fix_usbclass()
 		except:
 			print(" WARNING: Failure to read usb.ids", file=sys.stderr)
 			#print(sys.exc_info(), file=sys.stderr)
-- 
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