diff options
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | reset.py | 12 | ||||
-rwxr-xr-x | wait.py | 7 |
3 files changed, 11 insertions, 12 deletions
@@ -199,12 +199,12 @@ jtag: $(BUILD_PATH)/main.bin program_ram: ram ./reset.py - ./wait.py + sleep 1 $(DFU) -a0 -d $(VENDOR_ID):$(PRODUCT_ID) -D build/main.bin -R program_flash: flash ./reset.py - ./wait.py + sleep 1 $(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D build/main.bin -R program_jtag: jtag @@ -1,11 +1,17 @@ #!/usr/bin/python import serial -import time - +import os try: - ser = serial.Serial('/dev/ttyACM0', baudrate=115200) + highest = 0 + # this totally won't work on Mac OSX! /dev/ttySOMETHINGELSE? + for f in filter(lambda x: x.startswith('ttyACM'), os.listdir('/dev/')): + if (int(f[6:]) > highest): + highest = int(f[6:]) + + print "Trying /dev/ttyACM%d..." % highest + ser = serial.Serial('/dev/ttyACM%d' % highest, baudrate=115200) ser.open() # pull dtr and rts low diff --git a/wait.py b/wait.py deleted file mode 100755 index 3347089..0000000 --- a/wait.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/python - -import time - -time.sleep(1) - -print "Done" |