diff --git a/plugins/USBPrinting/AutoDetectBaudJob.py b/plugins/USBPrinting/AutoDetectBaudJob.py index 04fe64baaa..52666427bc 100644 --- a/plugins/USBPrinting/AutoDetectBaudJob.py +++ b/plugins/USBPrinting/AutoDetectBaudJob.py @@ -71,7 +71,8 @@ class AutoDetectBaudJob(Job): timeout_time = time() + wait_response_timeout while timeout_time > time(): - line = serial.readline() + # If baudrate is wrong, then readline() might never return, even with timeouts set. Using read_until with size limit seems to fix this. + line = serial.read_until(size = 100) if b"ok" in line and b"T:" in line: successful_responses += 1 if successful_responses >= 1: