diff options
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r-- | drivers/char/keyboard.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 5755b7e5f187..4bb3d2272604 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/vt_kern.h> | 39 | #include <linux/vt_kern.h> |
40 | #include <linux/sysrq.h> | 40 | #include <linux/sysrq.h> |
41 | #include <linux/input.h> | 41 | #include <linux/input.h> |
42 | #include <linux/reboot.h> | ||
42 | 43 | ||
43 | static void kbd_disconnect(struct input_handle *handle); | 44 | static void kbd_disconnect(struct input_handle *handle); |
44 | extern void ctrl_alt_del(void); | 45 | extern void ctrl_alt_del(void); |
@@ -150,6 +151,7 @@ unsigned char kbd_sysrq_xlate[KEY_MAX + 1] = | |||
150 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ | 151 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ |
151 | "\r\000/"; /* 0x60 - 0x6f */ | 152 | "\r\000/"; /* 0x60 - 0x6f */ |
152 | static int sysrq_down; | 153 | static int sysrq_down; |
154 | static int sysrq_alt_use; | ||
153 | #endif | 155 | #endif |
154 | static int sysrq_alt; | 156 | static int sysrq_alt; |
155 | 157 | ||
@@ -672,7 +674,7 @@ static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struc | |||
672 | */ | 674 | */ |
673 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 675 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) |
674 | { | 676 | { |
675 | static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; | 677 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; |
676 | value = ret_diacr[value]; | 678 | value = ret_diacr[value]; |
677 | k_deadunicode(vc, value, up_flag, regs); | 679 | k_deadunicode(vc, value, up_flag, regs); |
678 | } | 680 | } |
@@ -709,8 +711,8 @@ static void k_cur(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
709 | 711 | ||
710 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 712 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) |
711 | { | 713 | { |
712 | static const char *pad_chars = "0123456789+-*/\015,.?()#"; | 714 | static const char pad_chars[] = "0123456789+-*/\015,.?()#"; |
713 | static const char *app_map = "pqrstuvwxylSRQMnnmPQS"; | 715 | static const char app_map[] = "pqrstuvwxylSRQMnnmPQS"; |
714 | 716 | ||
715 | if (up_flag) | 717 | if (up_flag) |
716 | return; /* no action, if this is a key release */ | 718 | return; /* no action, if this is a key release */ |
@@ -1035,7 +1037,7 @@ static void kbd_refresh_leds(struct input_handle *handle) | |||
1035 | #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ | 1037 | #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ |
1036 | ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) | 1038 | ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) |
1037 | 1039 | ||
1038 | static unsigned short x86_keycodes[256] = | 1040 | static const unsigned short x86_keycodes[256] = |
1039 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 1041 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
1040 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 1042 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
1041 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, | 1043 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
@@ -1073,11 +1075,13 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, | |||
1073 | put_queue(vc, 0x1d | up_flag); | 1075 | put_queue(vc, 0x1d | up_flag); |
1074 | put_queue(vc, 0x45 | up_flag); | 1076 | put_queue(vc, 0x45 | up_flag); |
1075 | return 0; | 1077 | return 0; |
1076 | case KEY_HANGUEL: | 1078 | case KEY_HANGEUL: |
1077 | if (!up_flag) put_queue(vc, 0xf1); | 1079 | if (!up_flag) |
1080 | put_queue(vc, 0xf2); | ||
1078 | return 0; | 1081 | return 0; |
1079 | case KEY_HANJA: | 1082 | case KEY_HANJA: |
1080 | if (!up_flag) put_queue(vc, 0xf2); | 1083 | if (!up_flag) |
1084 | put_queue(vc, 0xf1); | ||
1081 | return 0; | 1085 | return 0; |
1082 | } | 1086 | } |
1083 | 1087 | ||
@@ -1142,7 +1146,7 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1142 | kbd = kbd_table + fg_console; | 1146 | kbd = kbd_table + fg_console; |
1143 | 1147 | ||
1144 | if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) | 1148 | if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) |
1145 | sysrq_alt = down; | 1149 | sysrq_alt = down ? keycode : 0; |
1146 | #ifdef CONFIG_SPARC | 1150 | #ifdef CONFIG_SPARC |
1147 | if (keycode == KEY_STOP) | 1151 | if (keycode == KEY_STOP) |
1148 | sparc_l1_a_state = down; | 1152 | sparc_l1_a_state = down; |
@@ -1162,9 +1166,14 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1162 | 1166 | ||
1163 | #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ | 1167 | #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ |
1164 | if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) { | 1168 | if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) { |
1165 | sysrq_down = down; | 1169 | if (!sysrq_down) { |
1170 | sysrq_down = down; | ||
1171 | sysrq_alt_use = sysrq_alt; | ||
1172 | } | ||
1166 | return; | 1173 | return; |
1167 | } | 1174 | } |
1175 | if (sysrq_down && !down && keycode == sysrq_alt_use) | ||
1176 | sysrq_down = 0; | ||
1168 | if (sysrq_down && down && !rep) { | 1177 | if (sysrq_down && down && !rep) { |
1169 | handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty); | 1178 | handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty); |
1170 | return; | 1179 | return; |