diff options
author | David Zeuthen <davidz@redhat.com> | 2007-03-30 15:13:50 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2007-03-30 15:13:50 -0400 |
commit | 992dbc1929d036195d144e8051fddfd1e5c71779 (patch) | |
tree | 71c77ea19e6cf14f5a9302738ac6605cd83e8107 | |
parent | 51572e8d102bb9cc73f797e1edd9f179ab37f4dd (diff) |
fix IBM, Toshiba ACPI hotkey handling
-rw-r--r-- | configure.in | 143 | ||||
-rw-r--r-- | fdi/policy/10osvendor/10-ibm-buttons.fdi | 14 | ||||
-rw-r--r-- | fdi/policy/10osvendor/10-toshiba-buttons.fdi (renamed from fdi/policy/10osvendor/10-laptop-buttons.fdi) | 7 | ||||
-rw-r--r-- | fdi/policy/10osvendor/Makefile.am | 9 | ||||
-rw-r--r-- | hald/linux/addons/addon-acpi.c | 13 |
5 files changed, 108 insertions, 78 deletions
diff --git a/configure.in b/configure.in index 911c2bd8..8e14728f 100644 --- a/configure.in +++ b/configure.in @@ -168,14 +168,22 @@ fi AC_SUBST(ACPI_PROC) AM_CONDITIONAL(ACPI_PROC, test x$acpi_proc = xyes) -AC_ARG_ENABLE([acpi-ibm], AC_HELP_STRING([--enable-acpi-ibm], [catch IBM ACPI events]), [acpi_ibm=$enableval], [acpi_ibm=no]) +AC_ARG_ENABLE([acpi-ibm], AC_HELP_STRING([--enable-acpi-ibm], [Forward IBM ACPI events]), [acpi_ibm=$enableval], [acpi_ibm=no]) +BUILD_ACPI_IBM=no if test "x$acpi_ibm" = "xyes" ; then - AC_DEFINE(ACPI_IBM_EVENTS,1,[catch and forward IBM ACPI hotkey and button events]) + AC_DEFINE(BUILD_ACPI_IBM,1,[catch and forward IBM ACPI hotkey and button events]) + BUILD_ACPI_IBM=yes fi -AC_SUBST(ACPI_IBM_EVENTS) -AM_CONDITIONAL(ACPI_IBM_EVENTS, test x$acpi_ibm = xyes) +AC_SUBST(BUILD_ACPI_IBM) +AM_CONDITIONAL(BUILD_ACPI_IBM, test x$acpi_ibm = xyes) -AC_ARG_ENABLE([acpi-toshiba], AC_HELP_STRING([--enable-acpi-toshiba], [catch Toshiba ACPI events]), [acpi_toshiba=$enableval], [acpi_toshiba=no]) +AC_ARG_ENABLE([acpi-toshiba], AC_HELP_STRING([--enable-acpi-toshiba], [Forward Toshiba ACPI events]), [acpi_toshiba=$enableval], [acpi_toshiba=no]) +BUILD_ACPI_TOSHIBA=no +if test "x$acpi_toshiba" = "xyes" ; then + AC_DEFINE(BUILD_ACPI_TOSHIBA,1,[catch and forward Toshiba ACPI hotkey and button events]) + BUILD_ACPI_TOSHIBA=yes +fi +AC_SUBST(BUILD_ACPI_TOSHIBA) AM_CONDITIONAL(BUILD_ACPI_TOSHIBA, test x$acpi_toshiba = xyes) @@ -892,63 +900,78 @@ echo " HAL $VERSION ============== - prefix: ${prefix} - libdir: ${LIBDIR} - libexecdir: ${LIBEXECDIR} - bindir: ${BINDIR} - sbindir: ${SBINDIR} - datadir: ${DATADIR} - sysconfdir: ${SYSCONFDIR} - localstatedir: ${LOCALSTATEDIR} - docdir: ${DOCDIR} - dbus-1 system.d dir: ${DBUS_SYS_DIR} - pci.ids dir: ${PCI_IDS_DIR} - usb.ids dir: ${USB_IDS_DIR} - - compiler: ${CC} - cflags: ${CFLAGS} - ldflags: ${LDFLAGS} - cppflags: ${CPPFLAGS} - xmlto: ${XMLTO} - xmllint: ${XMLLINT} - User for HAL: ${HAL_USER} - Group for HAL: ${HAL_GROUP} - hald pidfile: ${HALD_PID_FILE} - hald socket dir: ${HALD_SOCKET_DIR} - eject program: ${EJECT_PROGRAM} - - OS backend: ${HALD_BACKEND} - - use acpi kernel interface: ${acpi_proc} - use acpid interface: ${acpi_acpid} - use libusb: ${USE_LIBUSB} - use libpci: ${USE_LIBPCI} - use libparted: ${USE_PARTED} - use PolicyKit: ${msg_polkit} - use ConsoleKit: ${msg_conkit} - use ACL management: ${msg_aclmgmt} - use umount.hal helper: ${msg_umount_hal} - use ACPI: ${msg_acpi} - use PMU: ${msg_pmu} - use APM: ${msg_apm} - use Sony PIC: ${msg_sonypic} - - Macbook backlight support: ${BUILD_MACBOOK} (Linux only, x86 only, requires libpci) - Macbook Pro utils: ${BUILD_MACBOOKPRO} (Linux only, x86 only, requires libpci) - OMAP utils: ${BUILD_OMAP} (Linux only, arm only) - CPU frequency scaling: ${BUILD_CPUFREQ} (Linux only) - catch IBM acpi events: ${acpi_ibm} (Linux only) - catch Toshiba acpi events: ${acpi_toshiba} (Linux only) - USB wireless mouse power: ${BUILD_USBCSR} (Linux only, requires libusb) - Dell Backlight: ${BUILD_DELL} (Linux only, requires libsmbios >= 0.13.4) - - Maintainer mode: ${USE_MAINTAINER_MODE} - Building verbose mode: ${enable_verbose_mode} - Building api docs: ${enable_gtk_doc} - Building docs: ${enable_docbook_docs} - Building man pages: ${enable_man_pages} + prefix: ${prefix} + libdir: ${LIBDIR} + libexecdir: ${LIBEXECDIR} + bindir: ${BINDIR} + sbindir: ${SBINDIR} + datadir: ${DATADIR} + sysconfdir: ${SYSCONFDIR} + localstatedir: ${LOCALSTATEDIR} + docdir: ${DOCDIR} + dbus-1 system.d dir: ${DBUS_SYS_DIR} + pci.ids dir: ${PCI_IDS_DIR} + usb.ids dir: ${USB_IDS_DIR} + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} + cppflags: ${CPPFLAGS} + xmlto: ${XMLTO} + xmllint: ${XMLLINT} + User for HAL: ${HAL_USER} + Group for HAL: ${HAL_GROUP} + hald pidfile: ${HALD_PID_FILE} + hald socket dir: ${HALD_SOCKET_DIR} + eject program: ${EJECT_PROGRAM} + + OS backend: ${HALD_BACKEND} + + use acpi kernel interface: ${acpi_proc} + use acpid interface: ${acpi_acpid} + use libusb: ${USE_LIBUSB} + use libpci: ${USE_LIBPCI} + use libparted: ${USE_PARTED} + use PolicyKit: ${msg_polkit} + use ConsoleKit: ${msg_conkit} + use ACL management: ${msg_aclmgmt} + use umount.hal helper: ${msg_umount_hal} + use ACPI: ${msg_acpi} + use PMU: ${msg_pmu} + use APM: ${msg_apm} + use Sony PIC: ${msg_sonypic} + + Macbook backlight support: ${BUILD_MACBOOK} (Linux only, x86 only, requires libpci) + Macbook Pro utils: ${BUILD_MACBOOKPRO} (Linux only, x86 only, requires libpci) + OMAP utils: ${BUILD_OMAP} (Linux only, arm only) + CPU frequency scaling: ${BUILD_CPUFREQ} (Linux only) + Forward IBM ACPI events: ${BUILD_ACPI_IBM} (Linux only) + Forward Toshiba ACPI events: ${BUILD_ACPI_TOSHIBA} (Linux only) + USB wireless mouse power: ${BUILD_USBCSR} (Linux only, requires libusb) + Dell Backlight: ${BUILD_DELL} (Linux only, requires libsmbios >= 0.13.4) + + Maintainer mode: ${USE_MAINTAINER_MODE} + Building verbose mode: ${enable_verbose_mode} + Building api docs: ${enable_gtk_doc} + Building docs: ${enable_docbook_docs} + Building man pages: ${enable_man_pages} " +if test x$BUILD_ACPI_IBM = xyes; then + echo "NOTE: Future Linux kernels may provide IBM ACPI events via a kernel." + echo " input device resulting in HAL emitting twice as many events as it" + echo " should. Make sure to rebuild HAL without --enable-acpi-ibm if" + echo " you use such a kernel." + echo +fi + +if test x$BUILD_ACPI_TOSHIBA = xyes; then + echo "NOTE: Future Linux kernels may provide Toshiba ACPI events via a kernel." + echo " input device resulting in HAL emitting twice as many events as it" + echo " should. Make sure to rebuild HAL without --enable-acpi-toshiba if" + echo " you use such a kernel." + echo +fi if test x$enable_umount_hal = xyes; then diff --git a/fdi/policy/10osvendor/10-ibm-buttons.fdi b/fdi/policy/10osvendor/10-ibm-buttons.fdi new file mode 100644 index 00000000..8800f67a --- /dev/null +++ b/fdi/policy/10osvendor/10-ibm-buttons.fdi @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<deviceinfo version="0.2"> + + <device> + <match key="system.formfactor" string="laptop"> + <!-- button capability for IBM laptops --> + <match key="system.hardware.vendor" string="IBM"> + <append key="info.capabilities" type="strlist">button</append> + </match> + </match> + </device> + +</deviceinfo> diff --git a/fdi/policy/10osvendor/10-laptop-buttons.fdi b/fdi/policy/10osvendor/10-toshiba-buttons.fdi index ee7cd0bf..84ff6bab 100644 --- a/fdi/policy/10osvendor/10-laptop-buttons.fdi +++ b/fdi/policy/10osvendor/10-toshiba-buttons.fdi @@ -4,16 +4,11 @@ <device> <match key="system.formfactor" string="laptop"> - <!-- Only launch the addon for Toshiba laptops. --> + <!-- button capability for Toshiba laptops --> <match key="system.hardware.vendor" string="TOSHIBA"> <append key="info.addons" type="strlist">hald-addon-acpi-buttons-toshiba</append> <append key="info.capabilities" type="strlist">button</append> </match> - - <!-- button capability for IBM laptops --> - <match key="system.hardware.vendor" string="IBM"> - <append key="info.capabilities" type="strlist">button</append> - </match> </match> </device> diff --git a/fdi/policy/10osvendor/Makefile.am b/fdi/policy/10osvendor/Makefile.am index d60d5b3b..4677cefb 100644 --- a/fdi/policy/10osvendor/Makefile.am +++ b/fdi/policy/10osvendor/Makefile.am @@ -4,7 +4,6 @@ fdidir = $(datadir)/hal/fdi/policy/10osvendor dist_fdi_DATA = \ 10-keyboard-policy.fdi \ 10-power-mgmt-policy.fdi \ - 10-laptop-buttons.fdi \ 10-rfkill-switch.fdi \ 10-laptop-panel-mgmt-policy.fdi \ 15-storage-luks.fdi \ @@ -34,6 +33,14 @@ if BUILD_DELL dist_fdi_DATA += 10-dell-laptop-brightness.fdi endif +if BUILD_ACPI_TOSHIBA +dist_fdi_DATA += 10-toshiba-buttons.fdi +endif + +if BUILD_ACPI_IBM +dist_fdi_DATA += 10-ibm-buttons.fdi +endif + if HAVE_ACLMGMT dist_fdi_DATA += 20-acl-management.fdi endif diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c index dd27e9c6..ff74c249 100644 --- a/hald/linux/addons/addon-acpi.c +++ b/hald/linux/addons/addon-acpi.c @@ -89,7 +89,7 @@ acpi_get_event_fp_acpid (void) } #endif -#ifdef ACPI_IBM_EVENTS +#ifdef BUILD_ACPI_IBM static void handle_ibm_acpi_events (LibHalContext *ctx, int type, int event) { @@ -116,15 +116,6 @@ handle_ibm_acpi_events (LibHalContext *ctx, int type, int event) break; case 4100: /* sleep button */ button = "sleep"; - devices = libhal_manager_find_device_string_match (ctx, "button.type", - "sleep", &num_devices, - &error); - if (devices != NULL && num_devices > 0) { - snprintf (udi, sizeof (udi), devices[0]); - libhal_free_string_array (devices); - } - if (dbus_error_is_set (&error)) - dbus_error_free (&error); break; case 4101: /* wireless */ button = "wifi-power"; @@ -230,7 +221,7 @@ main_loop (LibHalContext *ctx, FILE *eventfp) HAL_DEBUG (("battery event")); dbus_error_init (&error); libhal_device_rescan (ctx, udi, &error); -#ifdef ACPI_IBM_EVENTS +#ifdef BUILD_ACPI_IBM } else if (strncmp (acpi_path, "ibm/hotkey", sizeof ("ibm/hotkey") -1) == 0) { /* handle ibm ACPI hotkey events*/ handle_ibm_acpi_events(ctx, acpi_num1, acpi_num2); |