-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathreset.py
executable file
·64 lines (44 loc) · 1.06 KB
/
reset.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python2
from __future__ import print_function
from serial import Serial
import time
import sys
def resetserial(name):
def timeread(s):
s.timeout = 6
return s.read(10000)
def serialwrite(s, m):
s.write(m + '\r\n')
s = Serial(port=name, baudrate=9600)
s.write('\r\n')
m = timeread(s)
#print(repr(m))
s.write('Config\r\n')
m = timeread(s)
#print(repr(m))
s.write('3\r\n')
m = timeread(s)
#print(m)
if 'Disable Confirmation' in m:
#print('Found disable')
s.write('Y\r\n')
else:
s.write('N\r\n')
m = timeread(s)
#print(repr(m))
s.write('4\r\n')
m = timeread(s)
#print(m)
if 'Disable Status Menu' in m:
#print('Found disable')
s.write('Y\r\n')
else:
s.write('N\r\n')
m = timeread(s)
#print(repr(m))
# Return to 'normal'
s.write('\r\n')
m = timeread(s)
#print(repr(m))
if __name__ == '__main__':
resetserial(sys.argv[1])