|
|
@@ -6,11 +6,15 @@ import re
|
|
|
import time
|
|
|
from os import listdir
|
|
|
from os.path import isfile, join
|
|
|
+from os import system
|
|
|
+
|
|
|
|
|
|
DEVDIR = "/dev"
|
|
|
|
|
|
ttyfn = [f for f in listdir(DEVDIR) if re.match(r'^ttyUSB', f)]
|
|
|
|
|
|
+ret = system("rm -f /dev/ttyPIU /dev/ttyGPRS /dev/ttyDIU /dev/ttyGPS")
|
|
|
+
|
|
|
for devfn in ttyfn:
|
|
|
print devfn
|
|
|
ser = serial.Serial(join(DEVDIR,devfn), 115200, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=0, rtscts=0)
|
|
|
@@ -32,11 +36,21 @@ for devfn in ttyfn:
|
|
|
if (x0 == "ok" or x0 == "OK" or
|
|
|
x1 == "ok" or x1 == "OK" or
|
|
|
x2 == "ok" or x2 == "OK"):
|
|
|
- print join(DEVDIR,devfn), "->", join(DEVDIR,"ttyGPRS")
|
|
|
+ src_tty = join(DEVDIR,devfn)
|
|
|
+ dst_tty = join(DEVDIR,"ttyGPRS")
|
|
|
+ #print join(DEVDIR,devfn), "->", join(DEVDIR,"ttyGPRS")
|
|
|
+ print src_tty, "->", dst_tty
|
|
|
+
|
|
|
+ system("ln -s " + src_tty + " " + dst_tty)
|
|
|
|
|
|
if (x0[0:4] == "/?: " or
|
|
|
x1[0:4] == "/?: " or
|
|
|
x2[0:4] == "/?: "):
|
|
|
- print join(DEVDIR,devfn), "->", join(DEVDIR,"ttyPIU")
|
|
|
+ src_tty = join(DEVDIR,devfn)
|
|
|
+ dst_tty = join(DEVDIR,"ttyPIU")
|
|
|
+ #print join(DEVDIR,devfn), "->", join(DEVDIR,"ttyPIU")
|
|
|
+
|
|
|
+ print src_tty, "->", dst_tty
|
|
|
+ system("ln -s " + src_tty + " " + dst_tty)
|
|
|
|
|
|
|