python: debug print reading IMSI

It seems to timeout somewhere and I want to know where.
This commit is contained in:
Tobias Mueller 2023-10-17 09:00:56 +02:00
parent 6ac26e1a33
commit 4a16277ac2

View File

@ -42,7 +42,11 @@ TIMEOUT = 3
def get_imsi(): def get_imsi():
if (verbose):
print(f'Obtaining Serial {TTY} with timeout {TIMEOUT}...')
with serial.Serial(TTY, BAUDRATE, timeout=TIMEOUT, exclusive=True) as ser: with serial.Serial(TTY, BAUDRATE, timeout=TIMEOUT, exclusive=True) as ser:
if (verbose):
print('Getting IMSI')
ser.write(b'AT+CIMI\r') ser.write(b'AT+CIMI\r')
# TODO: read loop until we have 'enough' of what to expect # TODO: read loop until we have 'enough' of what to expect
output = ser.read(64) output = ser.read(64)