r2209 - trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src
mickey at sita.openmoko.org
mickey at sita.openmoko.org
Sun Jun 10 13:14:18 CEST 2007
Author: mickey
Date: 2007-06-10 13:14:14 +0200 (Sun, 10 Jun 2007)
New Revision: 2209
Modified:
trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/buttonactions.c
Log:
openmoko-panel-mainmenu: set display backlight
Modified: trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/buttonactions.c
===================================================================
--- trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/buttonactions.c 2007-06-10 10:53:46 UTC (rev 2208)
+++ trunk/src/target/OM-2007/panel-plugins/openmoko-panel-mainmenu/src/buttonactions.c 2007-06-10 11:14:14 UTC (rev 2209)
@@ -41,8 +41,11 @@
#include <linux/input.h>
#undef DEBUG_THIS_FILE
-#define DEBUG_THIS_FILE
+//#define DEBUG_THIS_FILE
+//FIXME load this from sysfs
+static const int MAX_BRIGHTNESS = 5000;
+
//FIXME find out through sysfs
#ifndef DEBUG_THIS_FILE
#define AUX_BUTTON_EVENT_PATH "/dev/input/event1"
@@ -410,6 +413,16 @@
void panel_mainmenu_set_display( int brightness )
{
g_debug( "mainmenu set display %d", brightness );
+ int fd = g_open( "/sys/class/backlight/gta01-bl/brightness" );
+ if ( fd != -1 )
+ g_debug( "can't open backlight device: %s", strerror( errno ) );
+ else
+ {
+ char buf[10];
+ int numbytes = g_sprintf( buf, "%d\0", MAX_BRIGHTNESS * 100 / brightness );
+ write( fd, buf, numbytes );
+ close( fd );
+ }
}
gboolean panel_mainmenu_powersave_timeout1( guint timeout )
More information about the commitlog
mailing list