aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rwxr-xr-xreset.py12
-rwxr-xr-xwait.py7
3 files changed, 11 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 8bed507..2de5847 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/reset.py b/reset.py
index 020d8cb..ae5d74b 100755
--- a/reset.py
+++ b/reset.py
@@ -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"