node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

No support for CRNL

Open mousseq opened this issue 4 months ago • 0 comments

SerialPort Version

10.5

Node Version

20.2

Electron Version

No response

Platform

Linux p4-1u-rt 6.8.0-2025-raspi-realtime #26-Ubuntu SMP PREEMPT_RT Tue Jun 24 12:25:16 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux

Architecture

ARM

Hardware or chipset of serialport

BCM2711

What steps will reproduce the bug?

There is no way to modify the ICRNL flag with the binding interface. My application requires ~ICRNL

  1. Connect a device that produces \r\n termination to a serial port.
  2. Create a serialport binding interface to the serial port.
  3. Attempt to parse incoming messages where parsing depends upon the \r\n termination.

What happens?

Parsing fails.

What should have happened?

If the serial port is set to ~ICRNL, then the \r is NOT converted to \n and parsing suceeds.

Additional information

There is a comment in serialport_unix.cpp: // ICRNL: map CR to NL (otherwise a CR input on the other computer will not terminate input) // Future potential option // options.c_iflag = ICRNL; // otherwise make device raw (no other input processing)

This should be implemented for all interfaces, not just Unix.

mousseq avatar Aug 22 '25 17:08 mousseq