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

mickey at sita.openmoko.org mickey at sita.openmoko.org
Thu Aug 30 22:48:11 CEST 2007


Author: mickey
Date: 2007-08-30 22:48:08 +0200 (Thu, 30 Aug 2007)
New Revision: 2860

Modified:
   trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
Log:
neod: try to capture headphone insertion / removal


Modified: trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
===================================================================
--- trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c	2007-08-30 12:24:39 UTC (rev 2859)
+++ trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c	2007-08-30 20:48:08 UTC (rev 2860)
@@ -55,6 +55,8 @@
     #define TOUCHSCREEN_BUTTON_KEYCODE 0x14a
 #endif
 
+#define HEADPHONE_INSERTION_SWITCHCODE 0x02
+
 GPollFD input_fd[10];
 int max_input_fd = 0;
 
@@ -309,6 +311,25 @@
                     power_state = NORMAL;
                 }
             }
+            else
+            if ( event.type == 5 && event.code == HEADPHONE_INSERTION_SWITCHCODE )
+            {
+                if ( event.value == 1 ) /* inserted */
+                {
+                    g_debug( "headphones IN" );
+                    neod_buttonactions_sound_play( "touchscreen" );
+                }
+                else if ( event.value == 0 ) /* released */
+                {
+                    g_debug( "headphones OUT" );
+                }
+                neod_buttonactions_powersave_reset();
+                if ( power_state != NORMAL )
+                {
+                    neod_buttonactions_set_display( 100 );
+                    power_state = NORMAL;
+                }
+            }
         }
     }
     return TRUE;





More information about the commitlog mailing list