blob: cc944ee3c09a1466732d77904dcf00f01f69a30d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/python
# NOTE: On Mac OSX this script must be run as sudo?
import serial
import os
from struct import pack
try:
ser = serial.Serial('/dev/maple', baudrate=115200, xonxoff=1)
ser.open()
# try to toggle DTR/RTS (old scheme)
ser.setRTS(0)
ser.setDTR(0)
ser.setDTR(1)
ser.setDTR(0)
# try magic number
ser.setRTS(1)
ser.setDTR(1)
ser.setDTR(0)
ser.write("1EAF")
# ok we're done here
ser.close()
except:
print "Failed to open the serial port for reset, perhaps this is your first upload or the board was already in bootloader mode"
|