Hi. I'm trying to automatically flash our board via uboot using labgrid. So i try to get to uboot console, but after sending a string to cancel autoboot, reading from serial line hangs indefinitely. The cause seems to be that the uboot prompt doesn't contain new line or what.
I first tried to use labgrid's uboot strategy which didn't work, so then tried to write a python script that would connect to tty, send autoboot canceling string, but unless i used timeout (see below) when setting up the serial in python, the script would hang on pyserial's readline method.
Here is the script i wrote:
import serial
with serial.Serial(port='/dev/ttyUSB0', baudrate=115200, timeout=3) as ser:
in_uboot = False
while True:
if not in_uboot:
ser.write(b"...")
line = ser.readline()
print(line.decode("utf-8"))
if b"Colibri VFxx" in line:
in_uboot = True
ser.write(b"help\r\n")
So without the timeout=3 it hangs on line = ser.readline() after canceling autoboot and the same seems to happen when trying to get to uboot using uboot strategy. The issue is i don't know how to tell labgrid to timeout if reading from serial hangs. This note in pyserial's documentation seems to be relevant: https://pyserial.readthedocs.io/en/latest/shortintro.html#shortintro-readline.
So is something like this possible to set in labgrid? Thank you.
Hi. I'm trying to automatically flash our board via uboot using labgrid. So i try to get to uboot console, but after sending a string to cancel autoboot, reading from serial line hangs indefinitely. The cause seems to be that the uboot prompt doesn't contain new line or what.
I first tried to use labgrid's uboot strategy which didn't work, so then tried to write a python script that would connect to tty, send autoboot canceling string, but unless i used timeout (see below) when setting up the serial in python, the script would hang on pyserial's readline method.
Here is the script i wrote:
So without the timeout=3 it hangs on
line = ser.readline()
after canceling autoboot and the same seems to happen when trying to get to uboot using uboot strategy. The issue is i don't know how to tell labgrid to timeout if reading from serial hangs. This note in pyserial's documentation seems to be relevant: https://pyserial.readthedocs.io/en/latest/shortintro.html#shortintro-readline.So is something like this possible to set in labgrid? Thank you.