aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2019-05-06 12:02:27 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-06 14:29:36 +0200
commit1d14ddf076be5d1a293877b310d7178575da604e (patch)
tree29a95aedd77f53cc9932e923af4adae75da59695
parent9ee63f53d5d21b2350fc85b9fd07c5b1f98b88cd (diff)
downloadusbutils-1d14ddf076be5d1a293877b310d7178575da604e.tar.gz
lsusb.py: move unrelated code out of try..except
Signed-off-by: Mantas Mikulėnas <grawity@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--lsusb.py.in10
1 files changed, 4 insertions, 6 deletions
diff --git a/lsusb.py.in b/lsusb.py.in
index 819ae16..9d2c4ae 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 ...