don't accidentally open segger jlink devices

This commit is contained in:
geeksville
2020-05-21 21:29:38 -07:00
parent f73dea44b6
commit 8a195430b9
2 changed files with 6 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
{
"cSpell.words": [
"Meshtastic",
"TORADIO"
"TORADIO",
"Vids"
]
}

View File

@@ -3,6 +3,9 @@ from collections import defaultdict
import serial
import serial.tools.list_ports
"""Some devices such as a seger jlink we never want to accidentally open"""
blacklistVids = dict.fromkeys([0x1366])
def findPorts():
"""Find all ports that might have meshtastic devices
@@ -11,7 +14,7 @@ def findPorts():
list -- a list of device paths
"""
l = list(map(lambda port: port.device,
filter(lambda port: port.vid != None,
filter(lambda port: port.vid != None and port.vid not in blacklistVids,
serial.tools.list_ports.comports())))
l.sort()
return l