ACPI to uinput bridge

Richard Hughes hughsient at gmail.com
Fri Oct 14 19:08:49 PDT 2005


Further to all the feedback and new ideas, I've spend a couple of hours
hacking on a acpi to uinput hal addon, using IAL as a source for the
Toshiba specific bits.

I've created two files, acpi_uinput.c and acpi_uinput.h which provide
all the shared acpi->uinput code, and created an example addon,
addon-acpi-buttons-toshiba which uses this shared code.

The toshiba addon uses just 2 small functions copied from IAL:

toshiba_key_flush
toshiba_key_ready

That's only 44 lines of copied code copied from approx 2500 lines of IAL
daemon. The addon *and* shared headers added together are only 254 lines
total.

Using this new hal addon (which is only launched for toshiba hardware
using an FDI file to match against smbios) I can type:

gnome-keybinding-properties

and click "launch web-browser" and press Fn-F1. From this point onwards
Fn-F1 generates a scancode to automatically launch my web browser.

I can also map my "next track" acpi button to the GNOME "Skip to Next
Track" function, so that it works in rhythmbox and totem.

If you have an IBM laptop (i.e. not toshiba), the addon would never be
matched, and there would be no extra memory usage or boot time delay.

Writing a vendor acpi button driver is easy -- you can use the source of
the custom scripts people have used over the years.

You can map the other "weird" buttons to scancodes too. The wifi
enable/disable could be mapped, as could the extra cdplayer buttons on
some asus laptops.

I think it's important to add functionality like this to HAL.
Now, feedback is very welcome. Initial code attached (WIP).

Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acpi_uinput.c
Type: text/x-csrc
Size: 3737 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051015/da619882/acpi_uinput.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acpi_uinput.h
Type: text/x-chdr
Size: 1251 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051015/da619882/acpi_uinput.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: addon-acpi-buttons-toshiba.c
Type: text/x-csrc
Size: 3996 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051015/da619882/addon-acpi-buttons-toshiba.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: addon-acpi-buttons-toshiba.h
Type: text/x-chdr
Size: 3479 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051015/da619882/addon-acpi-buttons-toshiba.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 775 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051015/da619882/Makefile.bin


More information about the hal mailing list