uart.generic.baudscan multiple issues
Detection
The detection of the baud rate doesn't work reliable on all devices and produces false-positives. E.g., ESP32-S2 with CircuitPython (115200):
ef> run uart.generic.baudscan -p /dev/ttyACM0 [...] [] Connecting to the the serial port (/dev/ttyACM0) timeout (3) [] Scanning for baud rates: 1200,2400,4800,9600,19200,38400,57600,115200 [?] Checking baud rate: 1200 [+] ASCII ratio: 25/30, 83.33 % [+] [?] Checking baud rate: 2400 [-] Error: SerialException:device reports readiness to read but returned no data (device disconnected or multiple access on port?) [+] [?] Checking baud rate: 4800 [-] Error: SerialException:[Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0' [...] [?] Checking baud rate: 115200 [-] Error: SerialException:[Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0' [+] [*] Baud rate 1200 has max. ASCII percentage of 83.33 % [-] Test uart.generic.baudscan failed. Reason = No good baud rate found
Error message
The exception handling and the error messages should be improved. If the device crashes then the testing should be terminated immediately. It doesn't make much sense to go on a device which is unresponsive.
Error: SerialException:[Errno 2] could not open port /dev/ttyACM0: [Errno 2] No such file or directory: '/dev/ttyACM0'
Access to port
On "fresh" installations often the user is no in the dialout group which could also lead to false-positives or wrong results. Evaluate the need for needroot for the plugin (and other UART/serial plugings).