mirror of
https://github.com/meshtastic/python.git
synced 2026-02-25 11:10:14 -05:00
don't accidentally open segger jlink devices
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"Meshtastic",
|
||||
"TORADIO"
|
||||
"TORADIO",
|
||||
"Vids"
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user