contentLister/inc/button.h File Reference

content lister - eReader button handling More...

#include <linux/ioctl.h>

This graph shows which files directly or indirectly include this file:

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 ()


Detailed Description

content lister - eReader button handling

<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 Documentation

#define BOOKS   (4)

Definition at line 60 of file button.h.

#define BUTTON_IOCTL_BASE   'b'

Definition at line 77 of file button.h.

#define BUTTON_IOCTL_GET_STATUS   _IOR( BUTTON_IOCTL_BASE,7,unsigned int)

Definition at line 80 of file button.h.

#define BUTTON_IOCTL_WRITE_ACTIVITY_LED   _IOW( BUTTON_IOCTL_BASE,2,unsigned int)

Definition at line 79 of file button.h.

#define BUTTON_IOCTL_WRITE_INTERVAL   _IOW( BUTTON_IOCTL_BASE,1,unsigned int)

Definition at line 78 of file button.h.

#define BUTTON_LONG_PRESS   0x1000

Definition at line 73 of file button.h.

#define BUTTON_LONG_PRESS_TIMEOUT   500

Definition at line 74 of file button.h.

#define CONNECT   (0)

Definition at line 56 of file button.h.

#define CRADDLE_SYNC   (12)

Definition at line 68 of file button.h.

#define DEVBUTTON   "/dev/buttons"

Definition at line 44 of file button.h.

#define DOCUMENTS   (5)

Definition at line 61 of file button.h.

#define FIFO_NAME   "/tmp/my_fifo"

Definition at line 43 of file button.h.

#define GETBUTTON (  )     (x&0xFF)

Definition at line 82 of file button.h.

#define GETLEDSTATUS (  )     ((x&0x200)>>9)

Definition at line 84 of file button.h.

#define GETPENDETECT (  )     ((x&0x100)>>8)

Definition at line 83 of file button.h.

#define KEYBUFFERING_OFF_TIMEOUT   3000

Definition at line 75 of file button.h.

#define MAX_COMMAND_SIZE   4

Definition at line 87 of file button.h.

#define MAX_KEYCLICKS_WHEN_LOCKED   5

Definition at line 89 of file button.h.

#define MODE   (1)

Definition at line 58 of file button.h.

#define NAVIGATE_1   (9)

Definition at line 65 of file button.h.

#define NAVIGATE_2   (10)

Definition at line 66 of file button.h.

#define NAVIGATE_3   (11)

Definition at line 67 of file button.h.

#define NEWSPAPER   (3)

Definition at line 59 of file button.h.

#define NOTES   (6)

Definition at line 62 of file button.h.

#define NUM_BUTTONS   15

Definition at line 72 of file button.h.

#define OVERVIEW   (2)

Definition at line 57 of file button.h.

#define PAGETURN_BACK   (8)

Definition at line 64 of file button.h.

#define PAGETURN_FORWARD   (7)

Definition at line 63 of file button.h.

#define PEN_DETECT   (13)

Definition at line 69 of file button.h.

#define POWER   (14)

Definition at line 70 of file button.h.


Function Documentation

void button_block_all_keys ( gboolean  do_block  ) 

Block/unblock all keys

Parameters:
block - TRUE/FALSE indicates all keys must be blocked/unblocked
Returns:
-

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

Parameters:
enable - TRUE/FALSE indicates enable key buffering
Returns:
-

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 }

Here is the call graph for this function:

int button_init ( gpointer  data  ) 

Start up button handling thread

Parameters:
data value that needs to be passed in the button handling routines
Returns:
-1 in case of failure

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 }

Here is the call graph for this function:

void flipbarDirectionSettingInit (  ) 

read the value of flipbar direction from er_registry.txt

Parameters:
 
Returns:
-

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 }

Here is the call graph for this function:

void keybufferingSettingInit (  ) 

read the value of key buffering from er_registry.txt

Parameters:
 
Returns:
-

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 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:12:39 2008 by  doxygen 1.5.6