00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00028
00029
00030
00031
00032
00033 #include <linux/ioctl.h>
00034
00035 #ifndef __CL_BUTTON__H__
00036 #define __CL_BUTTON__H__
00037
00038 #ifdef __cplusplus
00039 extern "C"
00040 {
00041 #endif
00042
00043 #define FIFO_NAME "/tmp/my_fifo"
00044 #define DEVBUTTON "/dev/buttons"
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #define CONNECT (0)
00057 #define OVERVIEW (2)
00058 #define MODE (1)
00059 #define NEWSPAPER (3)
00060 #define BOOKS (4)
00061 #define DOCUMENTS (5)
00062 #define NOTES (6)
00063 #define PAGETURN_FORWARD (7)
00064 #define PAGETURN_BACK (8)
00065 #define NAVIGATE_1 (9)
00066 #define NAVIGATE_2 (10)
00067 #define NAVIGATE_3 (11)
00068 #define CRADDLE_SYNC (12)
00069 #define PEN_DETECT (13)
00070 #define POWER (14)
00071
00072 #define NUM_BUTTONS 15
00073 #define BUTTON_LONG_PRESS 0x1000
00074 #define BUTTON_LONG_PRESS_TIMEOUT 500 //timeout defined in ms
00075 #define KEYBUFFERING_OFF_TIMEOUT 3000
00076
00077 #define BUTTON_IOCTL_BASE 'b'
00078 #define BUTTON_IOCTL_WRITE_INTERVAL _IOW( BUTTON_IOCTL_BASE,1,unsigned int)
00079 #define BUTTON_IOCTL_WRITE_ACTIVITY_LED _IOW( BUTTON_IOCTL_BASE,2,unsigned int)
00080 #define BUTTON_IOCTL_GET_STATUS _IOR( BUTTON_IOCTL_BASE,7,unsigned int)
00081
00082 #define GETBUTTON(x) (x&0xFF)
00083 #define GETPENDETECT(x) ((x&0x100)>>8)
00084 #define GETLEDSTATUS(x) ((x&0x200)>>9)
00085
00086
00087 #define MAX_COMMAND_SIZE 4
00088
00089 #define MAX_KEYCLICKS_WHEN_LOCKED 5
00090
00091
00100 int button_init(gpointer data);
00101
00109 void button_block_all_keys(gboolean do_block);
00110
00118 void flipbarDirectionSettingInit();
00119
00127 void button_enable_key_buffering(gboolean enable);
00128
00136 void keybufferingSettingInit();
00137
00138
00139 #ifdef __cplusplus
00140 }
00141 #endif
00142
00143 #endif //__CL_BUTTON__H__