I'm working on a small C videogames library for the Raspberry Pi. I'm coding the input system from scratch and after reading and seeing some examples about raw input reading, I got some doubts.

For mouse reading, I just use /dev/input/event1, I open() it as O\_NONBLOCK, I read() input\_event(s) and I also put the mouse reading in a separate pthread. Easy.

For keyboard reading, I saw some examples that reconfigure stdin to O\_NONBLOCK (using fcntl()), then save and reconfigure keyboard termios attibutes (ICANON, ECHO), and some example also save and reconfigure keyboard mode with ioctl(). What's the point of doing all that stuff instead of just reading /dev/input/event0 input\_event(s) (same way as mouse)?

Note that I undestand what those functions do, I just don't undestand why should be better to do all that stuff instead of just reading input\_event(s).