This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nuttx-ntfc.git


The following commit(s) were added to refs/heads/main by this push:
     new 8a03a4d  ntfc: drop the sim double-newline workaround
8a03a4d is described below

commit 8a03a4da7c77d111d892dab3e8033c406c2ea387
Author: raiden00pl <[email protected]>
AuthorDate: Mon Aug 31 21:55:29 2026 +0200

    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 <[email protected]>
    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 @@ if TYPE_CHECKING:
 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 test_device_sim_write_adds_newline():
         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 test_device_sim_line_buffered_write():
         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")

Reply via email to