arduino-pico/tools/discovery.py
Earle F. Philhower, III c892443b5b Adjust directories for cleaner use w/Arduino
/system is only downloaded tools
/tools is all scripts/submodules that are part of the main core
/lib is the linker libs
2021-03-17 08:33:51 -07:00

39 lines
772 B
Python
Executable file

#!/usr/bin/env python3
import time
import subprocess
import uf2conv
boards = False
while True:
l = uf2conv.get_drives()
if (len(l) > 0) and (not boards):
print ("""
{
"eventType": "add",
"port": {
"address": "1",
"label": "Board",
"boardName": "RPI 2040",
"protocol": "uf2",
"protocolLabel": "UF2 Devices",
"prefs": {},
"identificationPrefs": {}
}
}""", flush=True)
boards = True
elif (len(l) == 0) and boards:
print ("""
{
"eventType": "remove",
"port": {
"address": "1",
"label": "Board",
"boardName": "RPI 2040",
"protocol": "uf2",
"protocolLabel": "UF2 Devices",
"prefs": {},
"identificationPrefs": {}
}
}""", flush=True)
boards = False
time.sleep(1)