ACPI "special" button device, and Toshiba specific bits
Richard Hughes
hughsient at gmail.com
Tue Nov 29 12:05:06 PST 2005
Here are three patches to add the start of generic "special" ACPI button
support.
The first patch just adds a blank Virtual Input device for all ACPI
machines:
udi = '/org/freedesktop/Hal/devices/acpi_uinput'
info.udi = '/org/freedesktop/Hal/devices/acpi_uinput' (string)
info.addons = {'hald-addon-acpi-buttons-toshiba'} (string list)
linux.hotplug_type = 4 (0x4) (int)
info.capabilities = {'virtualinput'} (string list)
info.category = 'virtualinput' (string)
info.product = 'Virtual Input Device' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
linux.acpi_type = 4 (0x4) (int)
linux.acpi_path = '/dev/uinput' (string)
It's expected that the other addons (soni-pi, ibm, or the generic acpi
addon) can use this device as well, keeping the code to an absolute
minimum in those modules.
Creating the device here allows us to merge keys from an fdi file, and
optionally run other addons for specific hardware.
The second patch, an additional fdi file, maps the laptop specific bits
into a generic name, e.g. toshiba code 0x101 to "Mute".
This is what is emitted as the details field of ButtonPressed.
For other, different Toshiba laptops a user would only have to edit the
FDI file to add the special buttons (and then send it to the m/l like
people do for other hardware).
The third patch is the addon itself. The toshiba addon is roughly 100
lines of code and is 12k in size when compiled. It's only launched if
your computer is a laptop, and a Toshiba.
I've left out the kernel uinput bit for now, until I have talked to
Matthew Garrett. This can easily hook into the acpi_uinput device so
that programs can continue to use the XEvents like normal.
At the moment using these patches on my Toshiba laptop gives the
following ButtonPressed events:
[hughsie at hughsie rpmbuild]$ lshal -m
Start monitoring devicelist:
-------------------------------------------------
acpi_uinput condition ButtonPressed = BrightnessUp
acpi_uinput condition ButtonPressed = BrightnessDown
acpi_uinput condition ButtonPressed = Mute
...
Which work really well.
Please review.
Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-1of3-acpi-uinputdevice.patch
Type: text/x-patch
Size: 2268 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051129/2c2130ca/hal-1of3-acpi-uinputdevice.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-2of3-toshiba-buttons-fdi.patch
Type: text/x-patch
Size: 2606 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051129/2c2130ca/hal-2of3-toshiba-buttons-fdi.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-3of3-toshiba-addon.patch
Type: text/x-patch
Size: 5350 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20051129/2c2130ca/hal-3of3-toshiba-addon.bin
More information about the hal
mailing list