[no subject]

From: Matthew Garrett
Date: Wed Jun 21 2006 - 06:00:25 EST


Subject: Re: [Ubuntu PATCH] input: allow root to inject unknown scan codes
In-Reply-To: <4498D9F6.6020700@xxxxxxxxxx>
References: <4498D9F6.6020700@xxxxxxxxxx>

Randy Dunlap <randy.dunlap@xxxxxxxxxx> wrote:
> Allow root to inject unknown scan codes for input device.

I should probably describe what this does. The current code refuses to
synthesise any keyboard events that don't appear in the mask of
supported keycodes for the associated device. We've found that it's
sometimes helpful to be able to inject "fake" keyboard events through
the keyboard device. Consider the following scenario:

1) User presses ACPI hotkey that corresponds to volume up
2) Userspace turns ACPI event into volume up key, either via uinput or
injecting into an existing /dev/input node
3) HAL fires off a dbus event based on the volume up key (removes the
need for media players to do unpleasent things with xgrabkey)

Using the existing /dev/input/whatever node, this is all
straightforward. Using uinput, we either need a daemon that provides a
uinput device or a new uinput device every time an ACPI hotkey is
pressed. The former solution requires building some sort of IPC
mechanism, and the latter means that every key will generate a line in
dmesg (input: foo as /class/input/input3, and so on) and HAL will have
to notice a new event device, bind to it, launch the keyboard listener
daemon, fire off the dbus message, notice that the device has vanished
and then shut stuff down again. So injection through the keyboard device
is much simpler.

At the moment this fails if the keycode doesn't correspond to one
present in the keyboard mask - the input layer drops it on the floor
instead. I'm not sure that there's an especially good reason for that,
so we removed the check in order to make it easier to put as many input
events through the input layer as possible.

(In the future where we have food pills and flying cars and Linux has
become Atomic Fresh Linux, all these things generating acpi events
should probably be converted into proper input drivers instead)
--
Matthew Garrett | mjg59-chiark.mail.linux-rutgers.kernel@xxxxxxxxxxxxx
-
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/