diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-22 13:07:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-22 13:07:36 +0200 |
commit | ad568a64804950194e26cd1e320d44e4cccf2d21 (patch) | |
tree | 1c73ed03d2eed850eaa2063c55a737523eb76386 | |
parent | a5372a371f7a0c74df3f79f8384418416eda76ec (diff) | |
download | usbutils-ad568a64804950194e26cd1e320d44e4cccf2d21.tar.gz |
lsusb.py: fix up wakeup logic for devices that do not support it
Some interfaces/devices can not do wakeup at all, and the script will
crash if it runs into them. Handle this properly by reporting
"unsupported" if the file can not be read from sysfs, as that is what
this means.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-x | lsusb.py.in | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lsusb.py.in b/lsusb.py.in index 5104170..ae1d68f 100755 --- a/lsusb.py.in +++ b/lsusb.py.in @@ -399,7 +399,10 @@ class UsbDevice(UsbObject): except: pass if showwakeup: - self.wakeup = self.read_attr('power/wakeup') + try: + self.wakeup = self.read_attr('power/wakeup') + except: + self.wakeup = "unsupported" def readchildren(self): if self.fname[0:3] == "usb": |