Create generic interface for handling device-specific ACPI events in user-definable ways
There should be a way to handle ACPI events from things like button presses & switches on a device in a way that is device agnostic and supports users re-defining actions.
ACPI events are not generic, but seem to be specific to different devices even though the 'button' is shared. One example is a 'power button', which might generate different ACPI events on different devices, but the desired behavior for such event might the same across different devices (e.g. to turn off the display or power off the device)
One idea of how this flow would play out, using an example of a keyboard slider that generates a specific, unique (to the specific device) ACPI event:
-
user slides out keyboard on device
-
acpid receives
KBD_SLIDE/00BB0000
(I made this up, but the point is this can be specific to devices/hardware and is not generic) -
acpid runs generic handler which matches
KBD_SLIDE/00BB0000
withKEYBOARD_SLIDE_OUT
(a 'generic' event to associate with what just happened) -
The generic handler calls
xdg-open pmarketos:keyboard_slide_out
to run whatever the user wants -
pmarketos:ACTIONs are defined in
/etc/xdg/mimeapps.list
, device maintainers can provide default settings for their respective devices (e.g.device-nokia-rx51
provides some defaults for acpi events specific to the rx51) -
The device-specific-ACPI-event to generic-event mapping is made in some .conf file accessible by the handler, defined by device maintainers, and provided in the device-specific package (e.g.
device-nokia-rx51
)