-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop.py
42 lines (29 loc) · 892 Bytes
/
top.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
'''
serProg for serT
fangbo 2017.02.06
'''
import re
import platform
import scanwin
import cloudfile
binpath = './bin/'
#comport = 'COM1'
if __name__ == '__main__':
if (platform.architecture()[1] != 'WindowsPE'):
pass
#print 'support windows only.'
#exit()
else:
print 'Available com port:\r\n----'
for port, desc, hwid in sorted(scanwin.comports()):
print("{}: {} [{}]".format(port, desc, hwid))
pcom1 = re.compile(r'(C|c)(O|o)(M|m)\d+$')
while True:
comnumber = raw_input("Enter com number\r\n")
if ((pcom1.match(comnumber))):
break
else:
print 'Error input = ', comnumber
cloudfile.getbin()
cloudfile.buildConfig()
cloudfile.writeAllbin(comnumber)