1
0
mirror of https://github.com/AG7GN/nexus-utilities.git synced 2025-06-01 22:30:17 -07:00

Update usb_control.py

This commit is contained in:
Steve Magnuson 2020-12-31 11:45:21 -08:00
parent daf882e5d2
commit 61026979fb

View File

@ -12,7 +12,7 @@ __author__ = "Steve Magnuson AG7GN"
__copyright__ = "Copyright 2020, Steve Magnuson" __copyright__ = "Copyright 2020, Steve Magnuson"
__credits__ = ["Steve Magnuson"] __credits__ = ["Steve Magnuson"]
__license__ = "GPL" __license__ = "GPL"
__version__ = "1.0.1" __version__ = "1.0.2"
__maintainer__ = "Steve Magnuson" __maintainer__ = "Steve Magnuson"
__email__ = "ag7gn@arrl.net" __email__ = "ag7gn@arrl.net"
__status__ = "Production" __status__ = "Production"
@ -319,9 +319,16 @@ if __name__ == "__main__":
if arg_info.list: if arg_info.list:
dev_list = get_usb_devices() dev_list = get_usb_devices()
if dev_list: if dev_list:
from tabulate import tabulate try:
print(tabulate(dev_list, headers=["ID", "Tag", "Device", "State"])) from tabulate import tabulate
sys.exit(0) except ModuleNotFoundError:
print("Python 'tabulate' module required. Run 'sudo "
"apt update && sudo apt install python3-tabulate' "
"to install it.", file=sys.stderr)
sys.exit(1)
else:
print(tabulate(dev_list, headers=["ID", "Tag", "Device", "State"]))
sys.exit(0)
else: else:
print("No USB devices found", file=sys.stderr) print("No USB devices found", file=sys.stderr)
sys.exit(0) sys.exit(0)