Specifications
CHAPTER 5. IMPLEMENTATION 52
Once the data structure is filled, the module sends the abstract input event by calling
the library’s function event send(). Correspondingly, the event is delivered to the D-BUS
interface of the Input Abstraction Layer.
The creation and sending of an abstract output event for a concrete input event is illustrated
by the following example. Granted that an input device has the name “AT Translated Set
2 keyboard” and offers a special key indicating a symbol for “E-Mail”. The key’s scancode
equals 0x9b. Once this key is pressed, the driver for AT and PS/2 keyboards (Chapter 2, §2.2)
generates an input event which is processed by the input core. The event interface driver gets
notice of this event since it has registered itself as an event handler. Upon being invoked by
the event loop, the callback function evaluates the input event. Since the input event is a
keypress event and the event is not blacklisted, the callback function continues processing the
event. An abstract input event event of the type IalEvent is created and the members of the
structure are set-up:
– event.sender is set to the module’s token (evdev)
– event.source is set to the input device’s name (AT Translated Set 2 keyboard)
– event.name is set to the key’s description (E-Mail)
– event.raw is set to the scancode (0x9b)
5.6 ACPI Module
The Input Abstraction Layer’s ACPI module libial acpi reports abstract input events for
ACPI events. Input events reported by the ACPI subsystem have been discussed in Chapter 2,
§2.6. The fact that the ACPI mo dule reports input events on all ACPI compliant computers—
desktop and mobile systems—underlines its relevance. The module’s source code is found in
the directory modules. The prefix libial acpi is common for all files of the ACPI module.
The ACPI subsystem reports more than just input events. The ACPI module has to sort
out the relevant input events. Such as the events of the power button, sleep button and lid
switch. The following source co de shows a shortened version of the modules’ relevant data
structures:
ModuleOption mod_options[] = {
{"disable", "false", "disable=(true|false)"},
{NULL}
};
ModuleData mod_data = {
.name = "ACPI Input Abstraction Layer Module",
.token = "acpi",
.options = mod_options,
.load = mod_load,
.unload = mod_unload
};
The module offers the configuration option disable which specifies whether the module
is enabled or disabled. The module’s loading function evaluates the value of disable. By