r3357 - trunk/src/target/OM-2007.2/daemons/neod/src

mickey at sita.openmoko.org mickey at sita.openmoko.org
Mon Nov 5 11:15:11 CET 2007


Author: mickey
Date: 2007-11-05 11:15:10 +0100 (Mon, 05 Nov 2007)
New Revision: 3357

Modified:
   trunk/src/target/OM-2007.2/daemons/neod/src/Makefile.am
   trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
Log:
neod: add workaround for gathering the initial KEY_BATTERY status
until OM bug #991 has been fixed


Modified: trunk/src/target/OM-2007.2/daemons/neod/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/daemons/neod/src/Makefile.am	2007-11-04 22:14:13 UTC (rev 3356)
+++ trunk/src/target/OM-2007.2/daemons/neod/src/Makefile.am	2007-11-05 10:15:10 UTC (rev 3357)
@@ -12,7 +12,7 @@
   buttonactions.c \
   neod-main.c
 
-neod_LDADD = @NEOD_LIBS@
+neod_LDADD = @NEOD_LIBS@ -lapm
 
 MAINTAINERCLEANFILES  = config.h.in Makefile.in
 

Modified: trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
===================================================================
--- trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c	2007-11-04 22:14:13 UTC (rev 3356)
+++ trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c	2007-11-05 10:15:10 UTC (rev 3357)
@@ -40,6 +40,8 @@
 #include <sys/stat.h>
 #include <linux/input.h>
 
+#include <apm.h>
+
 #define SYS_CLASS_BACKLIGHT "/sys/class/backlight/"
 
 static gchar* backlight_node = NULL;
@@ -899,7 +901,10 @@
 
 gboolean neod_buttonactions_initial_update()
 {
+    // need a workaround until OM bug #991 has been fixed
+    // http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=991
     g_debug( "neod_buttonactions_initial_update" );
+#ifdef BUG_991_FIXED
     for ( int i = 0; i <= max_input_fd; ++i )
     {
         char name[256] = "Unknown";
@@ -922,6 +927,12 @@
         }
 
         if ( BIT_TEST( keys, CHARGER_INSERTION_BUTTON ) )
+#else
+        apm_info info;
+        memset (&info, 0, sizeof (apm_info));
+        apm_read (&info);
+        if ( info.battery_status == BATTERY_STATUS_CHARGING )
+#endif
         {
             g_debug( "charger already inserted" );
             g_spawn_command_line_async( "dbus-send --system /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.ChargerConnected", NULL );
@@ -931,7 +942,9 @@
             g_debug( "charger not yet inserted" );
             g_spawn_command_line_async( "dbus-send --system /org/freedesktop/PowerManagement org.freedesktop.PowerManagement.ChargerDisconnected", NULL );
         }
+#ifdef BUG_991_FIXED
     }
+#endif
 
     return FALSE;
 }





More information about the commitlog mailing list