#include <linux/ioctl.h>
Go to the source code of this file.
Defines | |
#define | FIFO_NAME "/tmp/my_fifo" |
#define | DEVBUTTON "/dev/buttons" |
#define | CONNECT (0) |
#define | OVERVIEW (2) |
#define | MODE (1) |
#define | NEWSPAPER (3) |
#define | BOOKS (4) |
#define | DOCUMENTS (5) |
#define | NOTES (6) |
#define | PAGETURN_FORWARD (7) |
#define | PAGETURN_BACK (8) |
#define | NAVIGATE_1 (9) |
#define | NAVIGATE_2 (10) |
#define | NAVIGATE_3 (11) |
#define | CRADDLE_SYNC (12) |
#define | PEN_DETECT (13) |
#define | POWER (14) |
#define | NUM_BUTTONS 15 |
#define | BUTTON_LONG_PRESS 0x1000 |
#define | BUTTON_LONG_PRESS_TIMEOUT 500 |
#define | KEYBUFFERING_OFF_TIMEOUT 3000 |
#define | BUTTON_IOCTL_BASE 'b' |
#define | BUTTON_IOCTL_WRITE_INTERVAL _IOW( BUTTON_IOCTL_BASE,1,unsigned int) |
#define | BUTTON_IOCTL_WRITE_ACTIVITY_LED _IOW( BUTTON_IOCTL_BASE,2,unsigned int) |
#define | BUTTON_IOCTL_GET_STATUS _IOR( BUTTON_IOCTL_BASE,7,unsigned int) |
#define | GETBUTTON(x) (x&0xFF) |
#define | GETPENDETECT(x) ((x&0x100)>>8) |
#define | GETLEDSTATUS(x) ((x&0x200)>>9) |
#define | MAX_COMMAND_SIZE 4 |
#define | MAX_KEYCLICKS_WHEN_LOCKED 5 |
Functions | |
int | button_init (gpointer data) |
void | button_block_all_keys (gboolean do_block) |
void | flipbarDirectionSettingInit () |
void | button_enable_key_buffering (gboolean enable) |
void | keybufferingSettingInit () |
<File description>="">
Depending on the configure value "enable-command-line-input" the button input will come from the command line (number 1 till 11) or from the actual button driver
Definition in file button.h.
#define BUTTON_IOCTL_GET_STATUS _IOR( BUTTON_IOCTL_BASE,7,unsigned int) |
#define BUTTON_IOCTL_WRITE_ACTIVITY_LED _IOW( BUTTON_IOCTL_BASE,2,unsigned int) |
#define BUTTON_IOCTL_WRITE_INTERVAL _IOW( BUTTON_IOCTL_BASE,1,unsigned int) |
void button_block_all_keys | ( | gboolean | do_block | ) |
Block/unblock all keys
block | - TRUE/FALSE indicates all keys must be blocked/unblocked |
Definition at line 165 of file button.c.
00166 { 00167 g_block_all_keys = do_block; 00168 }
void button_enable_key_buffering | ( | gboolean | enable | ) |
enable/disable key buffering
enable | - TRUE/FALSE indicates enable key buffering |
Definition at line 177 of file button.c.
00178 { 00179 g_enable_key_buffering = enable; 00180 00181 CL_LOGPRINTF("set g_enable_key_buffering =%d", enable); 00182 00183 if (TRUE == enable) 00184 { 00185 if (g_timeout_handler_id != 0) 00186 { 00187 g_source_remove(g_timeout_handler_id); 00188 g_timeout_handler_id = 0; 00189 } 00190 } 00191 else 00192 { 00193 if (g_timeout_handler_id == 0) 00194 { 00195 g_timeout_handler_id = g_timeout_add (KEYBUFFERING_OFF_TIMEOUT, 00196 button_key_buffering_timeout, NULL); 00197 } 00198 } 00199 }
int button_init | ( | gpointer | data | ) |
Start up button handling thread
data | value that needs to be passed in the button handling routines |
Definition at line 120 of file button.c.
00121 { 00122 00123 pthread_t theThread; 00124 00125 #ifdef COMMAND_LINE_INPUT 00126 CL_LOGPRINTF("Command line input"); 00127 00128 // Create the thread that will read from the keyboard. 00129 if (pthread_create(&theThread, NULL, readFromNamedPipe, (void *)data) != 0) 00130 { 00131 CL_ERRORPRINTF("Could not create thread"); 00132 return -1; 00133 } 00134 else 00135 { 00136 return 0; 00137 } 00138 #else 00139 CL_LOGPRINTF("Button driver input"); 00140 int timoutValue = button_get_timout(); 00141 g_timoutValue.tv_sec = timoutValue / 1000; 00142 g_timoutValue.tv_nsec = (timoutValue % 1000) * 1000000; 00143 keybufferingSettingInit(); 00144 flipbarDirectionSettingInit(); 00145 protectedButton = -1; 00146 pthread_mutex_init(&buttonCondMutex, NULL); 00147 pthread_cond_init(&buttonCond, NULL); 00148 // Create the thread that will read from the button driver. 00149 if (pthread_create(&theThread, NULL, readFromButtons, (void *)data) != 0) 00150 { 00151 CL_ERRORPRINTF("Could not create thread"); 00152 return -1; 00153 } 00154 if (pthread_create(&theThread, NULL, buttonStateMachine, (void *)data) != 0) 00155 { 00156 CL_ERRORPRINTF("Could not create thread"); 00157 return -1; 00158 } 00159 00160 return 0; 00161 #endif //COMMAND_LINE_INPUT 00162 }
void flipbarDirectionSettingInit | ( | ) |
read the value of flipbar direction from er_registry.txt
Definition at line 472 of file button.c.
00473 { 00474 // get the value of flipbar direction from the user settings 00475 g_flipbar_direction = button_get_flipbar_direction_setting(); 00476 }
void keybufferingSettingInit | ( | ) |
read the value of key buffering from er_registry.txt
Definition at line 498 of file button.c.
00499 { 00500 // get the value of key buffering from the user settings 00501 g_keybuffering_setting = button_get_key_buffering_setting(); 00502 }