diff options
author | Anthony DiGirolamo <tonymd@google.com> | 2022-04-04 12:31:30 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-04 20:30:39 +0000 |
commit | 29f95b9c94c772bfaae4dad5953b3c50337dce35 (patch) | |
tree | 882b74343361a30b9118e6a013e3dc94b1d517f7 | |
parent | 4776aec5a9441ac8e4efb461b91d65caff57b3e5 (diff) | |
download | pigweed-29f95b9c94c772bfaae4dad5953b3c50337dce35.tar.gz |
pw_system: Use PySerial non-blocking mode
This avoids delays each time the serial port is read from. The end
effect of the old 1second timeout is that you could only issue one
rpc per second.
Change-Id: Idc0fb8de88b3f0e7885a6772340f601bb46f377c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/89940
Reviewed-by: Rob Oliver <rgoliver@google.com>
Pigweed-Auto-Submit: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
-rw-r--r-- | pw_hdlc/py/pw_hdlc/rpc_console.py | 6 | ||||
-rw-r--r-- | pw_system/py/pw_system/console.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/pw_hdlc/py/pw_hdlc/rpc_console.py b/pw_hdlc/py/pw_hdlc/rpc_console.py index 27d402880..38bc6e0f5 100644 --- a/pw_hdlc/py/pw_hdlc/rpc_console.py +++ b/pw_hdlc/py/pw_hdlc/rpc_console.py @@ -256,7 +256,11 @@ def console(device: str, serial_impl = SerialWithLogging if socket_addr is None: - serial_device = serial_impl(device, baudrate, timeout=1) + serial_device = serial_impl( + device, + baudrate, + timeout=0, # Non-blocking mode + ) read = lambda: serial_device.read(8192) write = serial_device.write else: diff --git a/pw_system/py/pw_system/console.py b/pw_system/py/pw_system/console.py index 2a676e0d8..8a9de01e0 100644 --- a/pw_system/py/pw_system/console.py +++ b/pw_system/py/pw_system/console.py @@ -263,7 +263,11 @@ def console(device: str, timestamp_decoder = None if socket_addr is None: - serial_device = serial_impl(device, baudrate, timeout=1) + serial_device = serial_impl( + device, + baudrate, + timeout=0, # Non-blocking mode + ) read = lambda: serial_device.read(8192) write = serial_device.write |