This commit is contained in:
awe
2026-06-09 18:13:01 +03:00
parent 4bc19e3db5
commit 509e487464

View File

@ -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):