0

I am currently reading LDD3, and have some question about how Linux actually proesses input from a device in /dev/input/mouse*?

When I cat /dev/input/mouse2 (for my logitech mouse) I see input when I move.

How does the kernel take the bytes from this char device and make it display the mouse on my screen? I have also read about the Linux input subsystem kernel API, which confuses me because why would I need to write to an inode I create at /dev/input/mouse* when I can just send information directly through this API?

1 Answers1

0

The Linux kernel doesn't process /dev/input/mouse*

The kernel is what provides /dev/input/mouse*

Userspace programs like X.org can then read this device and show a cursor moving accordingly.

that other guy
  • 116,971
  • 11
  • 170
  • 194
  • thank you very much @that other guy What I now have as a lingering question is: when X.org is running, will it automatically inspect all possible /dev/input/mouse* for mouse data? In other words: If I create an inode for my char driver and have it write its buffers to that inode, as long as it follows the correct usb mouse protocol, X.org should look at my /dev/input/mouseX and show a moving cursor? – Paul Mikulskis Apr 23 '18 at 19:19
  • Traditionally it would use the aggregation device `/dev/input/mice` that provided events from all devices, but since 2008 or so I think it's started auto-adding them based on udev events. Either way, yes, X.org should pick them up automatically unless configured not to (e.g. for multiseat). – that other guy Apr 23 '18 at 19:46