This program was inspired by discussion about Funkey and
2.6 Linux kernels. Just read what Vojtech Pavlik think
about Funkey patch. (at the end of file)

How to use this program?

1. Compile kernel with event interface input support.
(generic kernels should have it)

1a. If compiled as a module (best choice) load module.
(type "modprobe evdev" - as root)

2. If you know what permissions are set it correctly ;-P
(e.g. prevent users from installing key loggers)

3. Compile program.
(type "./configure ; make")

4. Install program.
(type "make install" AS ROOT)

5. Run keytest and test if your keys works.
(type "keytest")

6. Run learnkeys and make config file.
(type "learnkeys config_file_name")

7. Edit config file generated by learnkeys.
(use your favorite editor)

8. Run it with the config file name.
(type "esekeyd config_file_name",
you don`t have to run it as root if you set permissions correctly,
if you want to do root need things (like init 5) use sudo,
my config file is included in exaples directory)

9. Have fun!

Krzysztof Burghardt <krzysztof@burghardt.pl>

-=[ LKML ]=---------------------------------------------------------------

Form: Vojtech Pavlik <vojtech@suse.cz>
Subject: Re:Re: [BUG] setkeycodes with 2.6.0-test5 / -test6

On Tue, Sep 30, 2003 at 10:53:08AM +0100, Ivo van Doorn wrote:
> Hi!
>

> I'va been working on a kernelpatch for the 2.6 test kernel named the
> Funkey patch. This patch has been created by Rick van Rein for 2.2 and
> 2.4 kernels: website is here: http://rck.vanrein.org/linux/funkey.

> When i ported this patch to 2.6 I run into small problem., which also
> occurs when no patch is applied. First I will give a small
> explanation on how the Funkey patch works:

> Modern keyboards have extra multimedia keys (think of the "www" "mail"
> "search" sound volume etc.) By using setkeycodes to give these buttons
> a keycode and in the keymap giving that keycode a highbyte the key
> gets picked up by the funkey patch and instead of sending the signal
> through /dev/console, it gets send through /dev/funkey. Using the
> matching daemon the /dev/funkey can be read and programs can be
> launched when the buton is pressed. "www" button can for example start
> lynx, or mozilla or whatever.

You shouldn't need any patch for 2.6 to implement this functionality.
Basically you need to modify the funkey daemon to do this:

1) Open /proc/bus/input/devices and read it to find out which device
is the system keyboard.
2) Open the correct /dev/input/event? device
3) Program the scancode/keycode mappings using the EVIOCSKEYCODE
ioctl()
4) Use the EVIOCGRAB ioctl() to prevent any other program to get
keycodes from the keyboard.
5) Open /dev/uinput and create a new virtual keyboard
6) Read events from /dev/input/event? and process them. Either forward
them to /dev/uinput (normal keys) or do whatever action is needed
(fun keys)

Does that sound reasonable?

Another option is to omit steps 4 and 5, and just let the extra keys
reach the applications. If they're not mapped in kernel/xfree keymaps,
they'll be simply ignored.

One more thing: Microsoft standardized some of the WWW/Multimedia keys.
I'll be changing the default scancode/keycode/rawmode tables to support
them soon.

[...]

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR
