Changeset 3350
- Timestamp:
- 11/04/07 18:46:06 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/daemons/neod/src
- Files:
-
- 3 edited
-
buttonactions.c (modified) (6 diffs)
-
buttonactions.h (modified) (1 diff)
-
neod-main.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.c
r3348 r3350 21 21 #include <gtk/gtkmenuitem.h> 22 22 #include <gtk/gtkcheckmenuitem.h> 23 #include <gtk/gtkseparatormenuitem.h> 23 24 24 25 #include <gdk/gdkx.h> … … 75 76 #define HEADPHONE_INSERTION_SWITCHCODE 0x02 76 77 #define CHARGER_INSERTION_BUTTON 0xa4 78 79 #define BIT_MASK( name, numbits ) \ 80 unsigned short name[ ((numbits) - 1) / (sizeof( short ) * 8) + 1 ]; \ 81 memset( name, 0, sizeof( name ) ) 82 #define BIT_TEST( bitmask, bit ) \ 83 ( bitmask[ (bit) / sizeof(short) / 8 ] & (1u << ( (bit) % (sizeof(short) * 8))) ) 77 84 78 85 GPollFD input_fd[10]; … … 499 506 void neod_buttonactions_popup_selected_fullscreen( GtkMenuItem* menu, gpointer user_data ) 500 507 { 501 static i s_fullscreen = 0;508 static int is_fullscreen = 0; 502 509 503 510 gtk_widget_hide( aux_menu ); … … 708 715 { 709 716 g_debug( "sorry, i'm not going to close the today window" ); 710 return ;717 return FALSE; 711 718 } 712 719 … … 831 838 { 832 839 if ( pm_value != FULL ) 833 return ;840 return FALSE; 834 841 g_debug( "mainmenu powersave timeout 3" ); 835 842 //FIXME talk to neod … … 891 898 } 892 899 900 gboolean neod_buttonactions_initial_update() 901 { 902 g_debug( "neod_buttonactions_initial_update" ); 903 for ( int i = 0; i <= max_input_fd; ++i ) 904 { 905 char name[256] = "Unknown"; 906 if( ioctl( input_fd[i].fd, EVIOCGNAME(sizeof(name)), name ) < 0) 907 { 908 perror("evdev ioctl"); 909 continue; 910 } 911 912 g_debug( "input node %d corresponds to %s", i, name ); 913 914 BIT_MASK( keys, KEY_MAX ); 915 if( ioctl( input_fd[i].fd, EVIOCGKEY(sizeof(keys)), keys ) < 0) 916 { 917 perror("evdev ioctl"); 918 continue; 919 } 920 921 if ( BIT_TEST( keys, CHARGER_INSERTION_BUTTON ) ) 922 { 923 g_debug( "charger already inserted" ); 924 g_spawn_command_line_async( "dbus-send /org/freedesktop/PowerManagement org.freesmartphone.powermanagement.ChargerConnected", NULL ); 925 } 926 else 927 { 928 g_debug( "charger not yet inserted" ); 929 g_spawn_command_line_async( "dbus-send /org/freedesktop/PowerManagement org.freesmartphone.powermanagement.ChargerDisconnected", NULL ); 930 } 931 } 932 933 return FALSE; 934 } -
trunk/src/target/OM-2007.2/daemons/neod/src/buttonactions.h
r2899 r3350 41 41 void neod_buttonactions_set_display( int brightness ); 42 42 void neod_buttonactions_sound_play( const gchar* samplename ); 43 gboolean neod_buttonactions_initial_update(); 43 44 44 45 #endif -
trunk/src/target/OM-2007.2/daemons/neod/src/neod-main.c
r2665 r3350 27 27 neod_buttonactions_set_display( 100 ); 28 28 neod_buttonactions_sound_init(); 29 g_timeout_add_seconds( 10, (GSourceFunc) neod_buttonactions_initial_update, NULL ); 29 30 gtk_main(); 30 31 return 0;
Note: See TracChangeset
for help on using the changeset viewer.
