From: <hol...@us...> - 2006-12-24 21:17:51
|
Revision: 713 http://svn.sourceforge.net/hackndev/?rev=713&view=rev Author: holger_bocklet Date: 2006-12-24 13:17:48 -0800 (Sun, 24 Dec 2006) Log Message: ----------- X-Mas Update Palmtc-Keyboard: add reboot on blue-power key Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtc/palmtc_keyboard.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtc/palmtc_keyboard.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtc/palmtc_keyboard.c 2006-12-19 09:21:33 UTC (rev 712) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtc/palmtc_keyboard.c 2006-12-24 21:17:48 UTC (rev 713) @@ -18,6 +18,8 @@ #include <linux/platform_device.h> #include <linux/workqueue.h> #include <linux/delay.h> +#include <linux/reboot.h> +#include <linux/sched.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> @@ -28,7 +30,7 @@ #define USE_RELEASE_TIMER #define USE_DOUBLECLICK -#define PALMTC_KEYBOARD_DEBUG +//#define PALMTC_KEYBOARD_DEBUG #ifdef PALMTC_KEYBOARD_DEBUG #define DBG(x...) \ @@ -48,15 +50,16 @@ #define PRESSED_BIT 1 #define PALMTC_BLUEKEY -17 +#define PALMTC_REBOOT -19 #define RELEASE_CHECK_TIME_MS 50 #define DOUBLECLICK_TIME_MS 250 #define GET_GPIO(gpio) (GPLR(gpio) & GPIO_bit(gpio)) -#define GET_KEY_BIT(vkey, bit) ((vkey >> (bit) ) & 0x01) -#define SET_KEY_BIT(vkey, bit) (vkey |= (1 << (bit)) ) -#define CLEAR_KEY_BIT(vkey, bit) (vkey &= ~(1 << (bit)) ) +//#define GET_KEY_BIT(vkey, bit) ((vkey >> (bit) ) & 0x01) +//#define SET_KEY_BIT(vkey, bit) (vkey |= (1 << (bit)) ) +//#define CLEAR_KEY_BIT(vkey, bit) (vkey &= ~(1 << (bit)) ) #ifdef USE_RELEASE_TIMER static void release_timer_went_off (unsigned long); @@ -87,7 +90,7 @@ static struct { // matrix for real buttons int key; int alt_key; - u8 flags; // for recording last status and shift_bit + u8 flags; // for recording last status (lowest) and shift_bit (highest) unsigned long tstamp; // timestamp (jiffies) char *desc; } palmtc_buttons[MAX_ROW][MAX_COL] = { @@ -101,7 +104,7 @@ {KEY_DOWN,KEY_PAGEDOWN,FALSE,0,"down/pgdown"} , {KEY_LEFTCTRL,KEY_F9,FALSE,0,"cmd/ctrl/f9"}, {KEY_ENTER,-1,FALSE,0,"Select/enter/;"} }, //1 free -/*20*/ {{KEY_POWER,-1,FALSE,0,"power"}, //0 +/*20*/ {{KEY_POWER,PALMTC_REBOOT,FALSE,0,"power"}, //0 {-1,-1,FALSE,0,"unused 9/20"}, //9 {-1,-1,FALSE,0,"unused 10/20"}, //10 {-1,-1,FALSE,0,"unused 11/20"} }, //11 @@ -220,12 +223,19 @@ } } else { if (alternate_key) { - if(palmtc_buttons[row][col].alt_key >= 0) { - if (palmtc_buttons[row][col].flags&SHIFT_BIT) - input_report_key(keyboard_dev,KEY_LEFTSHIFT,1); - input_report_key(keyboard_dev, palmtc_buttons[row][col].alt_key, 1); - //DBG("alt: ms:%0lu char: %s\n",palmtc_buttons[row][col].tstamp,palmtc_buttons[row][col].desc); - input_sync(keyboard_dev); + if (palmtc_buttons[row][col].alt_key==PALMTC_REBOOT) { + DBG("reboot\n"); + //kernel_restart(NULL); + kill_proc(1, SIGINT, 1); + input_sync(keyboard_dev); + } else { + if(palmtc_buttons[row][col].alt_key >= 0) { + if (palmtc_buttons[row][col].flags&SHIFT_BIT) + input_report_key(keyboard_dev,KEY_LEFTSHIFT,1); + input_report_key(keyboard_dev, palmtc_buttons[row][col].alt_key, 1); + //DBG("alt: ms:%0lu char: %s\n",palmtc_buttons[row][col].tstamp,palmtc_buttons[row][col].desc); + input_sync(keyboard_dev); + } } if(! (alternate_key==PERMANENT)) { alternate_key=FALSE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |