[Pommed-commits] r341 - in trunk: . dbus-client gpomme pommed pommed/mactel pommed/pmac
jblache at alioth.debian.org
jblache at alioth.debian.org
Thu Jul 26 15:49:44 UTC 2007
Author: jblache
Date: 2007-07-26 15:49:44 +0000 (Thu, 26 Jul 2007)
New Revision: 341
Modified:
trunk/ChangeLog
trunk/dbus-client/dbus-client.h
trunk/gpomme/gpomme.c
trunk/pommed/dbus.c
trunk/pommed/dbus.h
trunk/pommed/lcd_backlight.h
trunk/pommed/mactel/gma950_backlight.c
trunk/pommed/mactel/x1600_backlight.c
trunk/pommed/pmac/sysfs_backlight.c
Log:
Send out DBus notification for automatic LCD backlight dimming, similar to the automatic keyboard backlight handling.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/ChangeLog 2007-07-26 15:49:44 UTC (rev 341)
@@ -6,6 +6,10 @@
handling code. The path has changed in Linux 2.6.22.
- pommed: added automatic LCD backlight dimming when switching
from AC to battery power (and vice-versa).
+ - pommed: send out DBus notification when the automatic LCD
+ backlight dimming kicks in (similar to the automatic keyboard
+ backlight notification).
+ - gpomme: adjust for the new LCD backlight notification.
version 1.7:
- pommed: add partial support for the MacBookPro3,1 (Core2 Duo,
Modified: trunk/dbus-client/dbus-client.h
===================================================================
--- trunk/dbus-client/dbus-client.h 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/dbus-client/dbus-client.h 2007-07-26 15:49:44 UTC (rev 341)
@@ -14,6 +14,9 @@
#define MBP_DBUS_SIG_LIGHT (1 << 5)
+#define LCD_USER 0
+#define LCD_AUTO 1
+
#define KBD_USER 0
#define KBD_AUTO 1
Modified: trunk/gpomme/gpomme.c
===================================================================
--- trunk/gpomme/gpomme.c 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/gpomme/gpomme.c 2007-07-26 15:49:44 UTC (rev 341)
@@ -336,11 +336,15 @@
DBUS_TYPE_UINT32, &cur,
DBUS_TYPE_UINT32, &scratch, /* previous */
DBUS_TYPE_UINT32, &max,
+ DBUS_TYPE_UINT32, &who,
DBUS_TYPE_INVALID);
- ratio = (double)cur / (double)max;
+ if (who == LCD_USER)
+ {
+ ratio = (double)cur / (double)max;
- show_window(IMG_LCD_BCK, _("LCD backlight level"), ratio);
+ show_window(IMG_LCD_BCK, _("LCD backlight level"), ratio);
+ }
}
else if (dbus_message_is_signal(msg, "org.pommed.signal.kbdBacklight", "kbdBacklight"))
{
Modified: trunk/pommed/dbus.c
===================================================================
--- trunk/pommed/dbus.c 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/dbus.c 2007-07-26 15:49:44 UTC (rev 341)
@@ -39,7 +39,7 @@
void
-mbpdbus_send_lcd_backlight(int cur, int prev)
+mbpdbus_send_lcd_backlight(int cur, int prev, int who)
{
DBusMessage *msg;
@@ -64,6 +64,7 @@
DBUS_TYPE_UINT32, &cur,
DBUS_TYPE_UINT32, &prev,
DBUS_TYPE_UINT32, &lcd_bck_info.max,
+ DBUS_TYPE_UINT32, &who,
DBUS_TYPE_INVALID);
if (ret == FALSE)
{
Modified: trunk/pommed/dbus.h
===================================================================
--- trunk/pommed/dbus.h 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/dbus.h 2007-07-26 15:49:44 UTC (rev 341)
@@ -7,7 +7,7 @@
void
-mbpdbus_send_lcd_backlight(int cur, int prev);
+mbpdbus_send_lcd_backlight(int cur, int prev, int who);
void
mbpdbus_send_kbd_backlight(int cur, int prev, int who);
Modified: trunk/pommed/lcd_backlight.h
===================================================================
--- trunk/pommed/lcd_backlight.h 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/lcd_backlight.h 2007-07-26 15:49:44 UTC (rev 341)
@@ -16,6 +16,9 @@
extern struct _lcd_bck_info lcd_bck_info;
+#define LCD_USER 0
+#define LCD_AUTO 1
+
#define LCD_ON_AC_LEVEL 0
#define LCD_ON_BATT_LEVEL 1
Modified: trunk/pommed/mactel/gma950_backlight.c
===================================================================
--- trunk/pommed/mactel/gma950_backlight.c 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/mactel/gma950_backlight.c 2007-07-26 15:49:44 UTC (rev 341)
@@ -201,7 +201,7 @@
gma950_backlight_unmap();
- mbpdbus_send_lcd_backlight(newval, val);
+ mbpdbus_send_lcd_backlight(newval, val, LCD_USER);
lcd_bck_info.level = newval;
}
@@ -223,17 +223,25 @@
{
case LCD_ON_AC_LEVEL:
logdebug("LCD switching to AC level\n");
+
gma950_backlight_set(lcd_bck_info.ac_lvl);
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.ac_lvl, lcd_bck_info.level, LCD_AUTO);
+
lcd_bck_info.level = lcd_bck_info.ac_lvl;
break;
case LCD_ON_BATT_LEVEL:
logdebug("LCD switching to battery level\n");
+
lcd_bck_info.ac_lvl = lcd_bck_info.level;
+
if (lcd_bck_info.level > lcd_gma950_cfg.on_batt)
{
gma950_backlight_set(lcd_gma950_cfg.on_batt);
lcd_bck_info.level = lcd_gma950_cfg.on_batt;
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.level, lcd_bck_info.ac_lvl, LCD_AUTO);
}
break;
}
Modified: trunk/pommed/mactel/x1600_backlight.c
===================================================================
--- trunk/pommed/mactel/x1600_backlight.c 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/mactel/x1600_backlight.c 2007-07-26 15:49:44 UTC (rev 341)
@@ -169,7 +169,7 @@
x1600_backlight_unmap();
- mbpdbus_send_lcd_backlight(newval, val);
+ mbpdbus_send_lcd_backlight(newval, val, LCD_USER);
lcd_bck_info.level = newval;
}
@@ -190,17 +190,25 @@
{
case LCD_ON_AC_LEVEL:
logdebug("LCD switching to AC level\n");
+
x1600_backlight_set(lcd_bck_info.ac_lvl);
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.ac_lvl, lcd_bck_info.level, LCD_AUTO);
+
lcd_bck_info.level = lcd_bck_info.ac_lvl;
break;
case LCD_ON_BATT_LEVEL:
logdebug("LCD switching to battery level\n");
+
lcd_bck_info.ac_lvl = lcd_bck_info.level;
+
if (lcd_bck_info.level > lcd_x1600_cfg.on_batt)
{
x1600_backlight_set(lcd_x1600_cfg.on_batt);
lcd_bck_info.level = lcd_x1600_cfg.on_batt;
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.level, lcd_bck_info.ac_lvl, LCD_AUTO);
}
break;
}
Modified: trunk/pommed/pmac/sysfs_backlight.c
===================================================================
--- trunk/pommed/pmac/sysfs_backlight.c 2007-07-26 15:23:27 UTC (rev 340)
+++ trunk/pommed/pmac/sysfs_backlight.c 2007-07-26 15:49:44 UTC (rev 341)
@@ -192,7 +192,7 @@
sysfs_backlight_set(newval);
- mbpdbus_send_lcd_backlight(newval, val);
+ mbpdbus_send_lcd_backlight(newval, val, LCD_USER);
lcd_bck_info.level = newval;
}
@@ -208,17 +208,25 @@
{
case LCD_ON_AC_LEVEL:
logdebug("LCD switching to AC level\n");
+
sysfs_backlight_set(lcd_bck_info.ac_lvl);
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.ac_lvl, lcd_bck_info.level, LCD_AUTO);
+
lcd_bck_info.level = lcd_bck_info.ac_lvl;
break;
case LCD_ON_BATT_LEVEL:
logdebug("LCD switching to battery level\n");
+
lcd_bck_info.ac_lvl = lcd_bck_info.level;
+
if (lcd_bck_info.level > lcd_sysfs_cfg.on_batt)
{
sysfs_backlight_set(lcd_sysfs_cfg.on_batt);
lcd_bck_info.level = lcd_sysfs_cfg.on_batt;
+
+ mbpdbus_send_lcd_backlight(lcd_bck_info.level, lcd_bck_info.ac_lvl, LCD_AUTO);
}
break;
}
@@ -237,7 +245,7 @@
logdebug("LCD stepping: %d -> %d\n", lcd_bck_info.level, val);
- mbpdbus_send_lcd_backlight(val, lcd_bck_info.level);
+ mbpdbus_send_lcd_backlight(val, lcd_bck_info.level, LCD_USER);
lcd_bck_info.level = val;
}
More information about the Pommed-commits
mailing list