[U-Boot] [PATCH 09/15] RX-51: Fix keymap

Pali Rohár pali.rohar at gmail.com
Thu Sep 1 13:34:35 CEST 2011


 * make functions and variables static
 * add support for additional key combination with ctrl and fn
 * add support for keys: up, down, left, right, volume_up, volume_down
---
 board/nokia/rx51/rx51.c |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index a90e4dd..01187de 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -132,32 +132,32 @@ void set_muxconf_regs(void)
  * TWL4030 keypad handler for cfb_console
  */
 
-char keymap[] = {
+static char keymap[] = {
 	/* normal */
 	'q',  'o',  'p',  ',', '\b',    0,  'a',  's',
 	'w',  'd',  'f',  'g',  'h',  'j',  'k',  'l',
-	'e',  '.',    0,  '\r',   0,  'z',  'x',  'c',
-	'r',  'v',  'b',  'n',  'm',  ' ',    0,    0,
-	't',    0,    0,    0,    0,    0,    0,    0,
+	'e',  '.',   24,  '\r',   0,  'z',  'x',  'c',
+	'r',  'v',  'b',  'n',  'm',  ' ',  ' ',   27,
+	't',   25,   26,    0,    0,    0,    0,    0,
 	'y',    0,    0,    0,    0,    0,    0,    0,
 	'u',    0,    0,    0,    0,    0,    0,    0,
-	'i',    0,    0,    0,    0,    0,    0,    0,
+	'i',    5,    6,    0,    0,    0,    0,    0,
 	/* fn */
 	'1',  '9',  '0',  '=', '\b',    0,  '*',  '+',
 	'2',  '#',  '-',  '_',  '(',  ')',  '&',  '!',
-	'3',  '?',    0, '\r',    0,    0,  '$',    0,
-	'4',  '/', '\\',  '"', '\'',  '@',    0,    0,
-	'5',    0,    0,    0,    0,    0,    0,    0,
+	'3',  '?',  '^', '\r',    0,  156,  '$',  238,
+	'4',  '/', '\\',  '"', '\'',  '@',    0,  '<',
+	'5',  '|',  '>',    0,    0,    0,    0,    0,
 	'6',    0,    0,    0,    0,    0,    0,    0,
 	'7',    0,    0,    0,    0,    0,    0,    0,
-	'8',    0,    0,    0,    0,    0,    0,    0,
+	'8',   16,   17,    0,    0,    0,    0,    0,
 };
 
-u8 keys[8];
-u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0};
+static u8 keys[8];
+static u8 old_keys[8] = {0, 0, 0, 0, 0, 0, 0, 0};
 #define KEYBUF_SIZE 4
-u8 keybuf[KEYBUF_SIZE];
-u8 keybuf_head = 0, keybuf_tail = 0;
+static u8 keybuf[KEYBUF_SIZE];
+static u8 keybuf_head = 0, keybuf_tail = 0;
 
 int rx51_kp_init(void)
 {
@@ -210,12 +210,16 @@ void hw_watchdog_reset(void)
 	twl_wd_start = get_timer(0);
 }
 
-char rx51_kp_fill(u8 k, u8 mods)
+static void rx51_kp_fill(u8 k, u8 mods)
 {
 	if (mods & 2) { /* fn */
 		k = keymap[k+64];
 	} else {
 		k = keymap[k];
+		if (mods & 1) { /* ctrl */
+			if (k >= 'a' && k <= 'z')
+				k -= 'a' + 1;
+		}
 		if (mods & 4) { /* shift */
 			if (k >= 'a' && k <= 'z')
 				k += 'A' - 'a';
@@ -231,7 +235,7 @@ char rx51_kp_fill(u8 k, u8 mods)
 
 int rx51_kp_tstc(void)
 {
-	u8 c, r, dk, k, i;
+	u8 c, r, dk, i;
 	u8 intr;
 	u8 mods;
 
-- 
1.7.4.1



More information about the U-Boot mailing list