hal/hald/linux2 acpi.c,1.48,1.49
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Apr 26 15:27:45 PDT 2006
Update of /cvs/hal/hal/hald/linux2
In directory kemper:/tmp/cvs-serv16903/hald/linux2
Modified Files:
acpi.c
Log Message:
2006-04-26 Richard Hughes <richard at hughsie.com>
Patch from Bastien Nocera <hadess at hadess.net>:
* hald/linux2/acpi.c: (laptop_panel_refresh),
(acpi_synthesize_sonypi_display), (acpi_synthesize_hotplug_events):
Create an LCD Panel object of type sonypi, necessary for getting the
methods supported for panasonic notebooks.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=6729
* tools/hal-system-lcd-get-brightness:
* tools/hal-system-lcd-set-brightness:
Support the sonypi brightness type.
Index: acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/acpi.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- acpi.c 17 Apr 2006 15:04:49 -0000 1.48
+++ acpi.c 26 Apr 2006 22:27:43 -0000 1.49
@@ -48,6 +48,7 @@
ACPI_TYPE_PANASONIC_DISPLAY,
ACPI_TYPE_SONY_DISPLAY,
ACPI_TYPE_OMNIBOOK_DISPLAY,
+ ACPI_TYPE_SONYPI_DISPLAY,
ACPI_TYPE_BUTTON
};
@@ -766,6 +767,10 @@
type = "omnibook";
desc = "Omnibook LCD Panel";
br_levels = 8;
+ } else if (acpi_type == ACPI_TYPE_SONYPI_DISPLAY) {
+ type = "sonypi";
+ desc = "Sony LCD Panel";
+ br_levels = 256;
} else {
type = "unknown";
desc = "Unknown LCD Panel";
@@ -919,6 +924,44 @@
acpi_synthesize_item (path, method);
}
+static int sonypi_irq_list[] = { 11, 10, 9, 6, 5 };
+
+/** Synthesizes a sonypi object.
+ */
+static void
+acpi_synthesize_sonypi_display (void)
+{
+ HotplugEvent *hotplug_event;
+ gboolean found = FALSE;
+ guint i;
+ gchar *path;
+
+ HAL_INFO (("Processing sonypi display"));
+
+ /* Find the sonypi device, this doesn't work
+ * if the sonypi device doesn't have an IRQ, sorry */
+ for (i = 0; i < G_N_ELEMENTS (sonypi_irq_list); i++) {
+ path = g_strdup_printf ("/proc/irq/%d/sonypi", sonypi_irq_list[i]);
+ if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ found = TRUE;
+ break;
+ }
+ g_free (path);
+ }
+
+ if (!found)
+ return;
+
+ hotplug_event = g_new0 (HotplugEvent, 1);
+ hotplug_event->action = HOTPLUG_ACTION_ADD;
+ hotplug_event->type = HOTPLUG_EVENT_ACPI;
+ g_strlcpy (hotplug_event->acpi.acpi_path, path, sizeof (hotplug_event->acpi.acpi_path));
+ hotplug_event->acpi.acpi_type = ACPI_TYPE_SONYPI_DISPLAY;
+ hotplug_event_enqueue (hotplug_event);
+
+ g_free (path);
+}
+
/** Scan the data structures exported by the kernel and add hotplug
* events for adding ACPI objects.
*
@@ -981,8 +1024,10 @@
acpi_synthesize_display ("acpi/pcc", "brightness", ACPI_TYPE_PANASONIC_DISPLAY);
acpi_synthesize_display ("acpi/ibm", "brightness", ACPI_TYPE_IBM_DISPLAY);
acpi_synthesize_display ("acpi/sony", "brightness", ACPI_TYPE_SONY_DISPLAY);
- /* onmibook does not live under acpi GNOME#331458 */
+ /* omnibook does not live under acpi GNOME#331458 */
acpi_synthesize_display ("omnibook", "lcd", ACPI_TYPE_OMNIBOOK_DISPLAY);
+ /* sonypi doesn't have an acpi object fd.o#6729 */
+ acpi_synthesize_sonypi_display ();
/* setup timer for things that we need to poll */
g_timeout_add (ACPI_POLL_INTERVAL,
@@ -1105,6 +1150,14 @@
.remove = acpi_generic_remove
};
+static ACPIDevHandler acpidev_handler_laptop_panel_sonypi = {
+ .acpi_type = ACPI_TYPE_SONYPI_DISPLAY,
+ .add = acpi_generic_add,
+ .compute_udi = acpi_generic_compute_udi,
+ .refresh = laptop_panel_refresh,
+ .remove = acpi_generic_remove
+};
+
static ACPIDevHandler acpidev_handler_button = {
.acpi_type = ACPI_TYPE_BUTTON,
.add = acpi_generic_add,
@@ -1133,6 +1186,7 @@
&acpidev_handler_laptop_panel_asus,
&acpidev_handler_laptop_panel_sony,
&acpidev_handler_laptop_panel_omnibook,
+ &acpidev_handler_laptop_panel_sonypi,
NULL
};
More information about the hal-commit
mailing list