diff --git a/rfg_vna_viewer.py b/rfg_vna_viewer.py index 9d32571..413db7b 100644 --- a/rfg_vna_viewer.py +++ b/rfg_vna_viewer.py @@ -41,10 +41,15 @@ DATA_PATH = "/tmp/ttyADC_data" # DataReader # --------------------------------------------------------------------------- class DataReader: - """Non-blocking raw reader for /tmp/ttyADC_data.""" + """Non-blocking raw reader for /tmp/ttyADC_data (PTY-safe).""" def __init__(self, path=DATA_PATH): + import termios, tty self._fd = os.open(path, os.O_RDONLY | os.O_NOCTTY) + try: + tty.setraw(self._fd) # disable line discipline processing + except termios.error: + pass # not a TTY — fine, skip os.set_blocking(self._fd, False) def read_available(self):