2011-07-13 22:02:03 +00:00
|
|
|
#!/opt/local/bin/python
|
|
|
|
|
|
|
|
import sys,serial
|
|
|
|
|
|
|
|
def read_until(token):
|
|
|
|
while 1:
|
|
|
|
line = ser.readline(None,"\r")
|
|
|
|
sys.stdout.write(line)
|
|
|
|
|
2011-07-13 22:28:34 +00:00
|
|
|
if (line.startswith(token)):
|
2011-07-13 22:02:03 +00:00
|
|
|
break
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
ser = serial.Serial(sys.argv[1], 57600, timeout=5)
|
|
|
|
line = read_until("+OK")
|
|
|
|
if (line.find("PASS") != -1):
|
|
|
|
sys.exit(0)
|
|
|
|
else:
|
|
|
|
sys.exit(1)
|