Hi, I'm creating a pseudo-terminal (alternatively using forkpty(3) or openpty(3) directly) where the child process is running a shell and the parent a simple terminal emulator that reads stdin and writes it to the child, and reads the child's output and displays it graphically via /derv/dri.
I set the parent stdin to raw mode (tcgetattr(3) -> cfmakeraw(3) -> tcsetattr(3)) to disable line buffering. I'm now reading stdin character by character and writing it to the child, and the pty/child echoes back every character I send it. One of my use cases requires the child process to emit a binary stream to be read by the parent. The parent is notified first via a specific escape sequence. This almost works, except I can't figure out how to disable output processing on this stream, and in particular the parent receives extra CR characters for every LF (NL) the child sends. I have tried setting every file descriptor I could think of to raw mode (parent stdin, child stdin, both sides of the duplex fd between parent and child) via the tcsetattr(3) gymnastics mentioned above, to no avail. At this point I don't think I quite understand what I'm doing and would really appreciate help. Many thanks, Pouya P.S. This other one's not as important but I'm also confused by why disabling ECHO on the parent stdin also disables it for the pseudo-terminal.