From 5b0bea53d1dff2ee81bb842c1e5ec06e25442f42 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 31 Aug 2026 21:55:29 +0200 Subject: [PATCH] ntfc: drop the sim double-newline workaround It papered over a NuttX sim bug: the console read for the wrapped RX buffer segment blocks inside the timer callback when a burst ends exactly at the wrap boundary, freezing the simulator. Fixed on the NuttX side, so send a single newline like every other host device. Signed-off-by: raiden00pl Assisted-by: Claude Code --- src/ntfc/device/sim.py | 3 --- tests/device/test_sim.py | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ntfc/device/sim.py b/src/ntfc/device/sim.py index d4ebeb5..c48c94a 100644 --- a/src/ntfc/device/sim.py +++ b/src/ntfc/device/sim.py @@ -35,9 +35,6 @@ class DeviceSim(DeviceHost): """This class implements host-based sim emulator.""" - # sometimes sim misses a single trailing newline, so send two - NEWLINE_PAD = b"\n\n" - def __init__(self, conf: "CoreConfig"): """Initialize sim emulator device.""" DeviceHost.__init__(self, conf) diff --git a/tests/device/test_sim.py b/tests/device/test_sim.py index b4397ae..fdf8628 100644 --- a/tests/device/test_sim.py +++ b/tests/device/test_sim.py @@ -86,8 +86,7 @@ def send(self, data): sim._child = FakeChild() sim._write(b"abc") - assert sent[:3] == [b"a", b"b", b"c"] - assert sent[-2:] == [b"\n", b"\n"] + assert sent == [b"a", b"b", b"c", b"\n"] def test_device_sim_write_no_extra_newline(): @@ -134,7 +133,7 @@ def send(self, data): sim._child = FakeChild() sim._write(b"abc") - assert sent == [b"abc\n\n"] + assert sent == [b"abc\n"] sent.clear() sim._write(b"abc\n")