[PATCH 20/34] lsusb.py: move unrelated code out of try..except

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

 



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

diff --git a/lsusb.py.in b/lsusb.py.in
index fc3e7a6..823cc8a 100644
--- a/lsusb.py.in
+++ b/lsusb.py.in
@@ -356,14 +356,12 @@ class UsbDevice:
 		try:
 			self.name = readattr(fname, "manufacturer") + " " \
 				  + readattr(fname, "product")
-			if self.name[:5] == "Linux":
-				rx = re.compile(r"Linux [^ ]* (.hci_hcd) .HCI Host Controller")
-				mch = rx.match(self.name)
-				if mch:
-					self.name = mch.group(1)
-
 		except:
 			pass
+		if self.name and self.name[:5] == "Linux":
+			mch = re.match(r"Linux [^ ]* (.hci_hcd) .HCI Host Controller", self.name)
+			if mch:
+				self.name = mch.group(1)
 		if not self.name:
 			self.name = find_usb_prod(self.vid, self.pid)
 		# Some USB Card readers have a better name then Generic ...
-- 
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