diff --git a/bin/getUSBport.py b/bin/getUSBport.py new file mode 100644 index 0000000..d7ae0fc --- /dev/null +++ b/bin/getUSBport.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import sys +import labhw + + +name = 'Arduino__www_arduino_cc__75833353035351903182' +name = sys.argv[1] + +devices = labhw.list_USB_devices() + +try: + print(devices[name]) +except KeyError as e: + raise RuntimeError(f"unknown device {name}") diff --git a/labhw/__init__.py b/labhw/__init__.py index fe815bc..517ecd8 100644 --- a/labhw/__init__.py +++ b/labhw/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.1.3' +__version__ = '0.1.4' from .LTS import * from .USBdev import * diff --git a/setup.py b/setup.py index 1bb02bb..fab7632 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ setup( long_description=long_description, long_description_content_type='text/markdown', scripts = ['bin/listUSBdevice.py', + 'bin/getUSBport.py', ], # Automatically find packages in the current directory