Re: [gpm] Support for brightness_in_hardware hal property
- From: Tomaž Šolc <tomaz solc tablix org>
- To: Richard Hughes <hughsient gmail com>
- Cc: gnome-power-manager-list gnome org
- Subject: Re: [gpm] Support for brightness_in_hardware hal property
- Date: Sun, 22 Jun 2008 13:54:10 +0200
Hi
A while ago I sent a patch to this list that added support for
"brightness_in_hardware" hal property to g-p-m 2.22.1.
This is the same patch against the current SVN trunk, however I'm unable
to test it since the current g-p-m fails to start on my system:
(gnome-power-manager:2601): GLib-GObject-WARNING **:
/build/buildd/glib2.0-2.16.3/gobject/gsignal.c:1669: signal
`monitors_changed' is invalid for instance `0x80b40b0'
Segmentation fault
Backtrace is attached below.
Best regards
Tomaz
#0 0xb71f70f3 in strlen () from /lib/i686/cmov/libc.so.6
#1 0x08055de6 in gpm_cell_get_id (cell=0x81059c0) at gpm-cell.c:478
#2 0x08057d0e in gpm_cell_array_collection_changed (cell_array=0x8179140)
at gpm-cell-array.c:466
#3 0x0805813b in gpm_cell_array_add_hal_udi (cell_array=0x8179140,
udi=0x818e828 "/org/freedesktop/Hal/devices/acpi_BAT0")
at gpm-cell-array.c:819
#4 0x0805822e in gpm_cell_array_coldplug (cell_array=0x8179140)
at gpm-cell-array.c:855
#5 0x080583b1 in gpm_cell_array_set_type (cell_array=0x8179140,
kind=GPM_CELL_UNIT_KIND_PRIMARY) at gpm-cell-array.c:879
#6 0x080517b3 in gpm_engine_start (engine=0x814b210) at gpm-engine.c:1027
#7 0x08069878 in gpm_manager_init (manager=0x80b6600) at gpm-manager.c:1813
#8 0xb73c6e66 in g_type_create_instance () from
/usr/lib/libgobject-2.0.so.0
#9 0xb73ac1e2 in ?? () from /usr/lib/libgobject-2.0.so.0
#10 0x080d86f0 in ?? ()
#11 0x00000000 in ?? ()
Index: gpm-brightness-hal.c
===================================================================
--- gpm-brightness-hal.c (revision 2822)
+++ gpm-brightness-hal.c (working copy)
@@ -58,6 +58,10 @@
gchar *udi;
gboolean hw_changed;
DbusProxy *gproxy;
+
+ /* true if hardware automatically sets brightness in response to
+ * key press events */
+ gboolean does_own_updates;
};
enum {
@@ -315,7 +319,8 @@
gpm_brightness_hal_get_hw (brightness, ¤t_hw);
/* the panel has been updated in firmware */
- if (current_hw != brightness->priv->last_set_hw) {
+ if (current_hw != brightness->priv->last_set_hw ||
+ brightness->priv->does_own_updates) {
brightness->priv->last_set_hw = current_hw;
} else {
/* macbook pro has a bazzillion brightness levels, be a bit clever */
@@ -357,7 +362,8 @@
gpm_brightness_hal_get_hw (brightness, ¤t_hw);
/* the panel has been updated in firmware */
- if (current_hw != brightness->priv->last_set_hw) {
+ if (current_hw != brightness->priv->last_set_hw ||
+ brightness->priv->does_own_updates) {
gpm_brightness_hal_get_hw (brightness, &brightness->priv->last_set_hw);
} else {
/* macbook pro has a bazzillion brightness levels, be a bit clever */
@@ -438,6 +444,7 @@
gchar **names;
HalGManager *manager;
HalGDevice *device;
+ gboolean res;
brightness->priv = GPM_BRIGHTNESS_HAL_GET_PRIVATE (brightness);
brightness->priv->gproxy = NULL;
@@ -466,6 +473,24 @@
if (brightness->priv->levels == 0 || brightness->priv->levels > 256) {
gpm_warning ("Laptop panel levels are invalid!");
}
+
+ /* Check if hardware handles brightness changes automatically */
+ res = hal_gdevice_get_bool (device,
+ "laptop_panel.brightness_in_hardware",
+ &brightness->priv->does_own_updates, NULL);
+
+ if (!res) {
+ brightness->priv->does_own_updates = FALSE;
+ gpm_debug ("laptop_panel.brightness_in_hardware not found. "
+ "Assuming false");
+ } else {
+ if (brightness->priv->does_own_updates) {
+ gpm_debug ("laptop_panel.brightness_in_hardware: True");
+ } else {
+ gpm_debug ("laptop_panel.brightness_in_hardware: False");
+ }
+ }
+
g_object_unref (device);
/* get a managed proxy */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]