input devices handling
From: Michael Tokarev
Date: Wed Oct 22 2008 - 17:12:39 EST
Similar question has been asked already by me in the past,
regarding "conversions" of ACPI button events to "keyboard
events". The talk is about how one is supposed to handle
various "common" "meta-buttons" like Power, Sleep, and so
Before, there was /proc/acpi/event and /etc/acpid/* stuff,
and it was easy (but somewhat clumsy) to act to system power
down button. But the "proper way" now is to handle
/dev/input/event* interface, because such "Power" button can
be on a keyboard, on a remote control, and so on. I understand
the idea, and I like it.
But now the question. How one supposed to find all the devices
which generate such events? I mean not about scanning the /dev
directory, which can be done once at startup, but about REscanning
it to find which NEW keyboards and the like appeared since last
(re)scan and which were removed.
For mouse, there is /dev/[input/]mice, which is a meta-device
for all mouse-like devices out there, and it actually works.
For an application that reacts to system button events, there
is no such device, and the only way is to scan all keyboard-like
devices and open them all (well, only ones which actually have
the buttons in question, but that's minor detail).
So now I have to know WHEN to (re)scan the devices. Should I
depend on udevd/hald for that (i really dislike this way)?
Or should I just rescan periodically, say, every 10 sec or
so? Or is there other, better way?
The only thing I need so far is to be able to shut down the
machine on a power down button. Maybe in the future something
like changing audio volume etc will be of interest too, but
that should be pretty similar.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/