ublox-config: Exit script only when modem reset is complete

This commit is contained in:
Alexandre Bard 2019-03-28 15:00:06 +01:00
parent d0e8bfaf25
commit 56295e2ed0
1 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@
import serial
import sys
import time
import os
MAX_TRY = 5
tries = 0
@ -37,3 +38,12 @@ execute_and_check(b'AT+UUSBCONF=2,"ECM",0')
print("Resetting modem")
ser.write(b'AT+CFUN=16\r')
ser.close()
# Wait until modem rebooted
while True:
dirs = os.listdir("/dev")
for file in dirs:
if file == 'ttyACM2':
sys.exit(0);
time.sleep(1)