Reconnect serial for connection when retry.
In our lab, we found some boards will disconnect from usb hub, especially for some imx6 ard boards.
This all happens when lava try to connect to the device, pdu reset, and then begin to operate the uboot command line, reported below dmesg on lava slave:
[Mon Apr 13 10:21:42 2020] ftdi_sio ttyUSB8: usb_serial_generic_read_bulk_callback - urb stopped: -32
[Mon Apr 13 10:21:42 2020] usb 2-1.6.3-port2: disabled by hub (EMI?), re-enabling...
[Mon Apr 13 10:21:42 2020] ftdi_sio ttyUSB8: FTDI USB Serial Device converter now disconnected from ttyUSB8
[Mon Apr 13 10:21:43 2020] usb 2-1.6.3.2: FTDI USB Serial Device converter now attached to ttyUSB8
Then, when operate uboot, lava reported Connection closed
. Although we define retry
, but lava reported Already connected
which then not try to open the serial connection any more.
You can see the serial ttyUSB8 just leave for about 1 second, if reconnect, everything will be ok. In fact, after this job incomplete, if run a new job again quickly which open a new connection, you will see it's ok.
So, we propose this MR to open serial again if serial leaves a while, not let lava to maintain a invalid connection there.
Log without serial reconnect when retry: job_without_reconnect.log
Log with serial reconnect when retry (applied this patch): job_with_reconnect.log
I know this is an issue maybe just existed in our product chip, but let lava's connection always maintain a valid raw serial link sounds reasonable?