Notes by Jonathan Riddell from a phone call with Matthew Garrett about how laptop support works.


Three types of key events:

  • Normal keyboard scancodes picked up by Linux
  • ACPI events picked up by /etc/acpid/events and turned into keyboard scancodes for linux
  • weird things like thinkpad's nvram foo picked up by thinkpad-buttons and turned into keyboard scancodes

Those keycodes get translated into X keycodes

In Gnome default values are put into hotkey preferences for keyboard-shortcuts which then does sensible things with them such as launch an e-mail client or change the volume and show an on screen display or play/pause music.

View keycodes with xev, also dpkg-monitor --system (LukaRenko: or did you mean "lshal -m"?)

Conclusion: use generic kmilo plugin (or if necessary write a new one) that listens for key events and does sensible things.

Fix thinkpad-keys for R40e so Jonathan can test it

gnome-settings-daemon is what listens for X events (keycodes). For audio keys is turns them into XFAudioFoo KEYSYMNAMES for other events it does something sensible. We need to get kmilo or a standalone application to do something similar. gnome-settings-daemon just calls xmodmap for the audio keys, we could just do that then have global keybindings to listen for them.

LukaRenko's notes:

  • gnome-settings-daemon (control-center source package) handles multimedia laptop keys by filtering X event loop for specific keycodes

    • gnome-settings-daemon/gnome-settings-multimedia-keys.c - code for X event hook (acme_filter_events()) and performing actions

    • debian/patches/07_default_keys.patch - default key bindings for laptop keys
  • gnome-power-manager handles laptop keys emmited by HAL

    • src/gpm-hal-monitor.c - emit_button_pressed() dispatches signal on button press which is handled in:

    • src/gpm-manager.c - power_button_pressed_cb() calls appropriate action


Power management mostly interfaced through HAL.

PMI may go in edgy.

lshal has computer device at top, includes methods for power management, org.freedesktop.Hal.Device.SystemPowerManagement.method_execpaths.

Power management keys often don't end up as X keycodes, so needs to use HAL.

gnome-power-manager catches HAL events (power key pressed) and calls HAL's powersave interface based on configuration.

also talks to screensaver to lock screen

At the moment powersaved does suspend and resume itself, needs to be changed to make HAL calls.

powersaved conflicts with powernowd which does intelligent cpu throtelling based on current activity, need to turn off cpu throttelling in powersaved

also conflicts with apmd, turn off APM support in powersaved.

There is also a laptop_panel device, which has method_execpaths that can be called to change display brightness, kpowersave seems to do this well.

KubuntuLaptopNotes (last edited 2008-08-06 16:31:53 by localhost)