mirror of
https://github.com/meshtastic/python.git
synced 2025-12-25 08:57:53 -05:00
25 lines
688 B
Python
25 lines
688 B
Python
"""Program to scan for hardware
|
|
To run: python examples/scan_for_devices.py
|
|
"""
|
|
|
|
import sys
|
|
from meshtastic.util import detect_supported_devices, get_unique_vendor_ids, active_ports_on_supported_devices
|
|
|
|
# simple arg check
|
|
if len(sys.argv) != 1:
|
|
print(f"usage: {sys.argv[0]}")
|
|
print("Detect which device we might have.")
|
|
sys.exit(3)
|
|
|
|
vids = get_unique_vendor_ids()
|
|
print(f'Searching for all devices with these vendor ids {vids}')
|
|
|
|
sds = detect_supported_devices()
|
|
if len(sds) > 0:
|
|
print('Detected possible devices:')
|
|
for d in sds:
|
|
print(f' name:{d.name}{d.version} firmware:{d.for_firmware}')
|
|
|
|
ports = active_ports_on_supported_devices(sds)
|
|
print(f'ports:{ports}')
|