From a7edd155ce014a6d81c12b4c8195fea705bd0d9e Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Mon, 13 Mar 2023 15:18:12 -0400 Subject: [PATCH] Reduce CPU usage of chip-console This is busy polling the serial port, and as a result uses 100% CPU. Use a non-zero timeout to avoid this. Using asyncio would be better, but pyserial support for this is still experimental. --- examples/common/pigweed/rpc_console/py/chip_rpc/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 7df7214808f47c..7b95b8a502673e 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -328,7 +328,7 @@ def console(device: str, baudrate: int, serial_impl = SerialWithLogging if socket_addr is None: - serial_device = serial_impl(device, baudrate, timeout=0) + serial_device = serial_impl(device, baudrate, timeout=0.1) def read(): return serial_device.read(8192) write = serial_device.write else: