hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Wed Feb 7 11:08:03 PST 2007
hald/linux/acpi.c | 18 +++++++++++++++++-
tools/linux/hal-system-lcd-set-brightness-linux | 2 +-
2 files changed, 18 insertions(+), 2 deletions(-)
New commits:
diff-tree f92db4967e050bbecd5775802fb6ffb7c963958b (from 215a01bafed3c450185bbe9c6e0c82d042dc7f8d)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Wed Feb 7 20:07:24 2007 +0100
fix detection of max. available omnibook brightness levels
This patch fix the the number of max. available brightness levels for the
proc omnibook interface.
The reason for this change:
* there exist two different versions of the omnibook kernel module (the older
version is from [1] and the new one from project [2]).
* different hardware supported by this module have different max levels.
(older machines have 11 (0-10) and newer hardware support 8 levels (0-7))
How this patch handle this:
* for the newer module version the max. level can be parsed
from /proc/omnibook/lcd
* for the older version we assume now always max. 11 levels, since this module
only support level 0-10 for brightness.
[1] http://sourceforge.net/projects/omke/
[2] http://sourceforge.net/projects/omnibook/
diff --git a/hald/linux/acpi.c b/hald/linux/acpi.c
index 65ea78e..38914d0 100644
--- a/hald/linux/acpi.c
+++ b/hald/linux/acpi.c
@@ -775,9 +775,25 @@ laptop_panel_refresh (HalDevice *d, ACPI
desc = "Sony LCD Panel";
br_levels = 8;
} else if (acpi_type == ACPI_TYPE_OMNIBOOK_DISPLAY) {
+ gchar *proc_lcd;
+ gchar proc_path[HAL_PATH_MAX];
+ int current = -1;
+ int max = -1;
+
type = "omnibook";
desc = "Omnibook LCD Panel";
- br_levels = 11;
+ /*
+ * There are different support brightness level, depending on
+ * the hardware and the kernel module version.
+ */
+ snprintf (proc_path, sizeof (proc_path), "%s/%s", get_hal_proc_path (), "omnibook");
+ proc_lcd = hal_util_grep_file(proc_path, "lcd", "LCD brightness:", FALSE);
+ proc_lcd = g_strstrip (proc_lcd);
+ if (sscanf (proc_lcd, "%d (max value: %d)", ¤t, &max) == 2) {
+ br_levels = max + 1;
+ } else {
+ br_levels = 11;
+ }
} else if (acpi_type == ACPI_TYPE_SONYPI_DISPLAY) {
type = "sonypi";
desc = "Sony LCD Panel";
diff --git a/tools/linux/hal-system-lcd-set-brightness-linux b/tools/linux/hal-system-lcd-set-brightness-linux
index 38e5730..0354fde 100755
--- a/tools/linux/hal-system-lcd-set-brightness-linux
+++ b/tools/linux/hal-system-lcd-set-brightness-linux
@@ -49,7 +49,7 @@ elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_ME
# http://popies.net/sonypi/2.6-sony_acpi4.patch
echo "$((value + 1))" > $HAL_PROP_LINUX_ACPI_PATH
elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
- # echo "{0..7}" > /proc/omnibook/lcd
+ # echo "{0..7} || {0...11}" > /proc/omnibook/lcd
# http://bugzilla.gnome.org/show_bug.cgi?id=331458
echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
More information about the hal-commit
mailing list