ublox-config: Make sure that device is available before sending commands

BugzID: 56371
This commit is contained in:
Alexandre Bard 2019-04-01 12:26:38 +02:00
parent 7ee9cc8cce
commit eedea0b72d
1 changed files with 6 additions and 1 deletions

View File

@ -7,7 +7,12 @@ import os
MAX_TRY = 5
tries = 0
ser = serial.Serial('/dev/ttyACM0', 115200, timeout=0.5)
SERIAL_DEV = '/dev/ttyACM0'
while not os.path.exists(SERIAL_DEV):
time.sleep(1)
ser = serial.Serial(SERIAL_DEV, 115200, timeout=0.5)
def execute_and_check(cmd):
global tries