Index: hald/linux2/acpi.c =================================================================== RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v retrieving revision 1.43 diff -u -r1.43 acpi.c --- hald/linux2/acpi.c 2 Dec 2005 17:11:00 -0000 1.43 +++ hald/linux2/acpi.c 2 Dec 2005 18:09:30 -0000 @@ -47,6 +47,7 @@ ACPI_TYPE_IBM_DISPLAY, ACPI_TYPE_PANASONIC_DISPLAY, ACPI_TYPE_SONY_DISPLAY, + ACPI_TYPE_VBUTTON, ACPI_TYPE_BUTTON }; @@ -375,6 +376,27 @@ return TRUE; } +static gboolean +vbutton_refresh (HalDevice *d, ACPIDevHandler *handler) +{ + const char *path; + path = hal_device_property_get_string (d, "linux.acpi_path"); + if (path == NULL) + return FALSE; + + /* only set up device new if really needed */ + if (!hal_device_has_capability (d, "button")){ + device_property_atomic_update_begin (); + hal_device_property_set_string (d, "info.product", "Virtual Button"); + hal_device_property_set_string (d, "info.category", "button"); + hal_device_property_set_string (d, "button.type", "virtual"); + hal_device_property_set_bool (d, "button.has_state", FALSE); + hal_device_add_capability (d, "button"); + device_property_atomic_update_end (); + } + return TRUE; +} + /** Removes all the possible battery.* keys. * * @param d Valid battery HalDevice @@ -880,6 +902,10 @@ snprintf (path, sizeof (path), "%s/acpi/button/sleep", get_hal_proc_path ()); acpi_synthesize (path, ACPI_TYPE_BUTTON); + /* create the extra vbutton button */ + snprintf (path, sizeof (path), "/dev/uinput"); + acpi_synthesize_item (path, ACPI_TYPE_VBUTTON); + /* * Collect video adaptors (from vendor added modules) * I *know* we should use the /proc/acpi/video/LCD method, but this @@ -1022,12 +1048,21 @@ .remove = acpi_generic_remove }; +static ACPIDevHandler acpidev_handler_vbutton = { + .acpi_type = ACPI_TYPE_VBUTTON, + .add = acpi_generic_add, + .compute_udi = acpi_generic_compute_udi, + .refresh = vbutton_refresh, + .remove = acpi_generic_remove +}; + static ACPIDevHandler *acpi_handlers[] = { &acpidev_handler_battery, &acpidev_handler_processor, &acpidev_handler_fan, &acpidev_handler_button, &acpidev_handler_ac_adapter, + &acpidev_handler_vbutton, &acpidev_handler_laptop_panel_toshiba, &acpidev_handler_laptop_panel_ibm, &acpidev_handler_laptop_panel_panasonic,