add get sub port

This commit is contained in:
François Boulogne 2024-10-24 14:00:53 +02:00
parent 88da9c0ae1
commit 01234592fd
3 changed files with 17 additions and 1 deletions

15
bin/getUSBport.py Normal file
View file

@ -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}")