I would like to open a character device e.g.
/dev/tty1 by multiple processes in a way that would not interfere reads between them. I noticed that if one process consumes a byte, no other process would receive it.
I'm writing console app on Linux, which requires receiving both: key presses and key releases. I managed already to switch from default terminal mode
K_RAW mode using
ioctl(fd,KDSKBMODE,K_RAW) on newly opened
/dev/tty1. Unfortunately reading from this descriptor resulted in missing bytes as mc tries to intercept
Ctrl+O key strokes in parallel (to bring its interface on top or hide it back) by reading from same device.
So I tried also to read data from stdin, pseudo terminal pipe created by
mc (after setting
K_RAW mode). It almost worked, except now I have collision of
Ctrl+O character code
0x0F with Tab key scancode (also
I'm looking for solution to that interference problem in a way not requiring more privileges than
cap_sys_tty_config, so accessing
/dev/input in order to read keyboard directly is not way to go for me.