The same can be said for files in '/dev/input'. Why are mouse and touchpad input exposed as files?
The same can be said for files in '/dev/input'. Why are mouse and touchpad input exposed as files?
In the email you quote, Linus gives two reasons why futex and sockets should not be files:
> there's absolutely no point in opening /dev/futex from a shell script or similar, because you don't get anything from it.
> Perhaps because you cannot enumerate sockets and pipes?
It stands to reason that the converse of those _are_ reasons to make things a file:
I can open /dev/input/$X and get something from it. The normal thing to do is open a file under /dev/input/ and read data from it. No, we don't usually do that directly, because libinput does it for us; but that's what it's doing. As an exception, if code deals with joysticks, it seems to me that it's common to open /dev/input/js$X yourself.
I can list the entries in /dev/input/ and enumerate the input devices attached to the system.