Skip to content

Harden serial driver I/O behavior and request safety - #2

Draft
coxep wants to merge 3 commits into
mainfrom
cursor/driver-hardening-f19e
Draft

Harden serial driver I/O behavior and request safety#2
coxep wants to merge 3 commits into
mainfrom
cursor/driver-hardening-f19e

Conversation

@coxep

@coxep coxep commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • harden Interface transaction behavior to handle partial serial writes and reads reliably
  • enforce request-direction safety at runtime (read on write-only and write on read-only now throw std::invalid_argument)
  • harden SerialDevice low-level I/O behavior and serial configuration:
    • return actual bytes written from write (fixing bool-as-size_t bug)
    • handle EINTR and nonblocking EAGAIN/EWOULDBLOCK with retry
    • use correct select nfds (fd + 1) and timeout handling
    • add configurable read timeout and baud rate setters
    • configure termios with raw mode, explicit baud rate, and VMIN/VTIME settings
  • add regression tests proving:
    • write path retries until full payload is transferred
    • read path retries until full fixed-size response is assembled
    • unsupported request direction operations fail fast with std::invalid_argument

Testing

  • cmake -DCMAKE_CXX_COMPILER=g++ ..
  • cmake --build . -j
  • ctest --output-on-failure

All tests pass (6/6).

Notes

  • branch includes explicit TDD red-phase commit followed by green implementation commit.
Open in Web Open in Cursor 

cursoragent and others added 3 commits April 18, 2026 02:43
…st directions

Co-authored-by: Eric Cox <coxep@users.noreply.github.com>
Co-authored-by: Eric Cox <coxep@users.noreply.github.com>
Co-authored-by: Eric Cox <coxep@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants