diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-03-22 01:31:26 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-04-14 02:26:35 -0400 |
commit | e0785572ce8620beb117530645e6989d2217d3b7 (patch) | |
tree | ed786a9f20be7d8118f8281973c7b7e6cde5862d /drivers/char | |
parent | 9272e9a2f8872a0f9fb15aaa10f2a993524343e0 (diff) |
Input: keyboard - fix formatting issues
Also convert few variables to 'bool'.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/keyboard.c | 278 |
1 files changed, 147 insertions, 131 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 157f23ad434f..54109dc9240c 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -133,7 +133,7 @@ static struct input_handler kbd_handler; | |||
133 | static DEFINE_SPINLOCK(kbd_event_lock); | 133 | static DEFINE_SPINLOCK(kbd_event_lock); |
134 | static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */ | 134 | static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */ |
135 | static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ | 135 | static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ |
136 | static int dead_key_next; | 136 | static bool dead_key_next; |
137 | static int npadch = -1; /* -1 or number assembled on pad */ | 137 | static int npadch = -1; /* -1 or number assembled on pad */ |
138 | static unsigned int diacr; | 138 | static unsigned int diacr; |
139 | static char rep; /* flag telling character repeat */ | 139 | static char rep; /* flag telling character repeat */ |
@@ -345,8 +345,8 @@ static void to_utf8(struct vc_data *vc, uint c) | |||
345 | /* 110***** 10****** */ | 345 | /* 110***** 10****** */ |
346 | put_queue(vc, 0xc0 | (c >> 6)); | 346 | put_queue(vc, 0xc0 | (c >> 6)); |
347 | put_queue(vc, 0x80 | (c & 0x3f)); | 347 | put_queue(vc, 0x80 | (c & 0x3f)); |
348 | } else if (c < 0x10000) { | 348 | } else if (c < 0x10000) { |
349 | if (c >= 0xD800 && c < 0xE000) | 349 | if (c >= 0xD800 && c < 0xE000) |
350 | return; | 350 | return; |
351 | if (c == 0xFFFF) | 351 | if (c == 0xFFFF) |
352 | return; | 352 | return; |
@@ -354,7 +354,7 @@ static void to_utf8(struct vc_data *vc, uint c) | |||
354 | put_queue(vc, 0xe0 | (c >> 12)); | 354 | put_queue(vc, 0xe0 | (c >> 12)); |
355 | put_queue(vc, 0x80 | ((c >> 6) & 0x3f)); | 355 | put_queue(vc, 0x80 | ((c >> 6) & 0x3f)); |
356 | put_queue(vc, 0x80 | (c & 0x3f)); | 356 | put_queue(vc, 0x80 | (c & 0x3f)); |
357 | } else if (c < 0x110000) { | 357 | } else if (c < 0x110000) { |
358 | /* 11110*** 10****** 10****** 10****** */ | 358 | /* 11110*** 10****** 10****** 10****** */ |
359 | put_queue(vc, 0xf0 | (c >> 18)); | 359 | put_queue(vc, 0xf0 | (c >> 18)); |
360 | put_queue(vc, 0x80 | ((c >> 12) & 0x3f)); | 360 | put_queue(vc, 0x80 | ((c >> 12) & 0x3f)); |
@@ -453,6 +453,7 @@ static void fn_enter(struct vc_data *vc) | |||
453 | } | 453 | } |
454 | diacr = 0; | 454 | diacr = 0; |
455 | } | 455 | } |
456 | |||
456 | put_queue(vc, 13); | 457 | put_queue(vc, 13); |
457 | if (vc_kbd_mode(kbd, VC_CRLF)) | 458 | if (vc_kbd_mode(kbd, VC_CRLF)) |
458 | put_queue(vc, 10); | 459 | put_queue(vc, 10); |
@@ -462,6 +463,7 @@ static void fn_caps_toggle(struct vc_data *vc) | |||
462 | { | 463 | { |
463 | if (rep) | 464 | if (rep) |
464 | return; | 465 | return; |
466 | |||
465 | chg_vc_kbd_led(kbd, VC_CAPSLOCK); | 467 | chg_vc_kbd_led(kbd, VC_CAPSLOCK); |
466 | } | 468 | } |
467 | 469 | ||
@@ -469,12 +471,14 @@ static void fn_caps_on(struct vc_data *vc) | |||
469 | { | 471 | { |
470 | if (rep) | 472 | if (rep) |
471 | return; | 473 | return; |
474 | |||
472 | set_vc_kbd_led(kbd, VC_CAPSLOCK); | 475 | set_vc_kbd_led(kbd, VC_CAPSLOCK); |
473 | } | 476 | } |
474 | 477 | ||
475 | static void fn_show_ptregs(struct vc_data *vc) | 478 | static void fn_show_ptregs(struct vc_data *vc) |
476 | { | 479 | { |
477 | struct pt_regs *regs = get_irq_regs(); | 480 | struct pt_regs *regs = get_irq_regs(); |
481 | |||
478 | if (regs) | 482 | if (regs) |
479 | show_regs(regs); | 483 | show_regs(regs); |
480 | } | 484 | } |
@@ -499,7 +503,7 @@ static void fn_hold(struct vc_data *vc) | |||
499 | 503 | ||
500 | static void fn_num(struct vc_data *vc) | 504 | static void fn_num(struct vc_data *vc) |
501 | { | 505 | { |
502 | if (vc_kbd_mode(kbd,VC_APPLIC)) | 506 | if (vc_kbd_mode(kbd, VC_APPLIC)) |
503 | applkey(vc, 'P', 1); | 507 | applkey(vc, 'P', 1); |
504 | else | 508 | else |
505 | fn_bare_num(vc); | 509 | fn_bare_num(vc); |
@@ -594,7 +598,7 @@ static void fn_boot_it(struct vc_data *vc) | |||
594 | 598 | ||
595 | static void fn_compose(struct vc_data *vc) | 599 | static void fn_compose(struct vc_data *vc) |
596 | { | 600 | { |
597 | dead_key_next = 1; | 601 | dead_key_next = true; |
598 | } | 602 | } |
599 | 603 | ||
600 | static void fn_spawn_con(struct vc_data *vc) | 604 | static void fn_spawn_con(struct vc_data *vc) |
@@ -653,7 +657,7 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag) | |||
653 | value = handle_diacr(vc, value); | 657 | value = handle_diacr(vc, value); |
654 | 658 | ||
655 | if (dead_key_next) { | 659 | if (dead_key_next) { |
656 | dead_key_next = 0; | 660 | dead_key_next = false; |
657 | diacr = value; | 661 | diacr = value; |
658 | return; | 662 | return; |
659 | } | 663 | } |
@@ -675,6 +679,7 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag) | |||
675 | { | 679 | { |
676 | if (up_flag) | 680 | if (up_flag) |
677 | return; | 681 | return; |
682 | |||
678 | diacr = (diacr ? handle_diacr(vc, value) : value); | 683 | diacr = (diacr ? handle_diacr(vc, value) : value); |
679 | } | 684 | } |
680 | 685 | ||
@@ -694,25 +699,24 @@ static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) | |||
694 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag) | 699 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag) |
695 | { | 700 | { |
696 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; | 701 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; |
697 | value = ret_diacr[value]; | 702 | |
698 | k_deadunicode(vc, value, up_flag); | 703 | k_deadunicode(vc, ret_diacr[value], up_flag); |
699 | } | 704 | } |
700 | 705 | ||
701 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag) | 706 | static void k_cons(struct vc_data *vc, unsigned char value, char up_flag) |
702 | { | 707 | { |
703 | if (up_flag) | 708 | if (up_flag) |
704 | return; | 709 | return; |
710 | |||
705 | set_console(value); | 711 | set_console(value); |
706 | } | 712 | } |
707 | 713 | ||
708 | static void k_fn(struct vc_data *vc, unsigned char value, char up_flag) | 714 | static void k_fn(struct vc_data *vc, unsigned char value, char up_flag) |
709 | { | 715 | { |
710 | unsigned v; | ||
711 | |||
712 | if (up_flag) | 716 | if (up_flag) |
713 | return; | 717 | return; |
714 | v = value; | 718 | |
715 | if (v < ARRAY_SIZE(func_table)) { | 719 | if ((unsigned)value < ARRAY_SIZE(func_table)) { |
716 | if (func_table[value]) | 720 | if (func_table[value]) |
717 | puts_queue(vc, func_table[value]); | 721 | puts_queue(vc, func_table[value]); |
718 | } else | 722 | } else |
@@ -725,6 +729,7 @@ static void k_cur(struct vc_data *vc, unsigned char value, char up_flag) | |||
725 | 729 | ||
726 | if (up_flag) | 730 | if (up_flag) |
727 | return; | 731 | return; |
732 | |||
728 | applkey(vc, cur_chars[value], vc_kbd_mode(kbd, VC_CKMODE)); | 733 | applkey(vc, cur_chars[value], vc_kbd_mode(kbd, VC_CKMODE)); |
729 | } | 734 | } |
730 | 735 | ||
@@ -742,43 +747,45 @@ static void k_pad(struct vc_data *vc, unsigned char value, char up_flag) | |||
742 | return; | 747 | return; |
743 | } | 748 | } |
744 | 749 | ||
745 | if (!vc_kbd_led(kbd, VC_NUMLOCK)) | 750 | if (!vc_kbd_led(kbd, VC_NUMLOCK)) { |
751 | |||
746 | switch (value) { | 752 | switch (value) { |
747 | case KVAL(K_PCOMMA): | 753 | case KVAL(K_PCOMMA): |
748 | case KVAL(K_PDOT): | 754 | case KVAL(K_PDOT): |
749 | k_fn(vc, KVAL(K_REMOVE), 0); | 755 | k_fn(vc, KVAL(K_REMOVE), 0); |
750 | return; | 756 | return; |
751 | case KVAL(K_P0): | 757 | case KVAL(K_P0): |
752 | k_fn(vc, KVAL(K_INSERT), 0); | 758 | k_fn(vc, KVAL(K_INSERT), 0); |
753 | return; | 759 | return; |
754 | case KVAL(K_P1): | 760 | case KVAL(K_P1): |
755 | k_fn(vc, KVAL(K_SELECT), 0); | 761 | k_fn(vc, KVAL(K_SELECT), 0); |
756 | return; | 762 | return; |
757 | case KVAL(K_P2): | 763 | case KVAL(K_P2): |
758 | k_cur(vc, KVAL(K_DOWN), 0); | 764 | k_cur(vc, KVAL(K_DOWN), 0); |
759 | return; | 765 | return; |
760 | case KVAL(K_P3): | 766 | case KVAL(K_P3): |
761 | k_fn(vc, KVAL(K_PGDN), 0); | 767 | k_fn(vc, KVAL(K_PGDN), 0); |
762 | return; | 768 | return; |
763 | case KVAL(K_P4): | 769 | case KVAL(K_P4): |
764 | k_cur(vc, KVAL(K_LEFT), 0); | 770 | k_cur(vc, KVAL(K_LEFT), 0); |
765 | return; | 771 | return; |
766 | case KVAL(K_P6): | 772 | case KVAL(K_P6): |
767 | k_cur(vc, KVAL(K_RIGHT), 0); | 773 | k_cur(vc, KVAL(K_RIGHT), 0); |
768 | return; | 774 | return; |
769 | case KVAL(K_P7): | 775 | case KVAL(K_P7): |
770 | k_fn(vc, KVAL(K_FIND), 0); | 776 | k_fn(vc, KVAL(K_FIND), 0); |
771 | return; | 777 | return; |
772 | case KVAL(K_P8): | 778 | case KVAL(K_P8): |
773 | k_cur(vc, KVAL(K_UP), 0); | 779 | k_cur(vc, KVAL(K_UP), 0); |
774 | return; | 780 | return; |
775 | case KVAL(K_P9): | 781 | case KVAL(K_P9): |
776 | k_fn(vc, KVAL(K_PGUP), 0); | 782 | k_fn(vc, KVAL(K_PGUP), 0); |
777 | return; | 783 | return; |
778 | case KVAL(K_P5): | 784 | case KVAL(K_P5): |
779 | applkey(vc, 'G', vc_kbd_mode(kbd, VC_APPLIC)); | 785 | applkey(vc, 'G', vc_kbd_mode(kbd, VC_APPLIC)); |
780 | return; | 786 | return; |
781 | } | 787 | } |
788 | } | ||
782 | 789 | ||
783 | put_queue(vc, pad_chars[value]); | 790 | put_queue(vc, pad_chars[value]); |
784 | if (value == KVAL(K_PENTER) && vc_kbd_mode(kbd, VC_CRLF)) | 791 | if (value == KVAL(K_PENTER) && vc_kbd_mode(kbd, VC_CRLF)) |
@@ -864,6 +871,7 @@ static void k_lock(struct vc_data *vc, unsigned char value, char up_flag) | |||
864 | { | 871 | { |
865 | if (up_flag || rep) | 872 | if (up_flag || rep) |
866 | return; | 873 | return; |
874 | |||
867 | chg_vc_kbd_lock(kbd, value); | 875 | chg_vc_kbd_lock(kbd, value); |
868 | } | 876 | } |
869 | 877 | ||
@@ -872,6 +880,7 @@ static void k_slock(struct vc_data *vc, unsigned char value, char up_flag) | |||
872 | k_shift(vc, value, up_flag); | 880 | k_shift(vc, value, up_flag); |
873 | if (up_flag || rep) | 881 | if (up_flag || rep) |
874 | return; | 882 | return; |
883 | |||
875 | chg_vc_kbd_slock(kbd, value); | 884 | chg_vc_kbd_slock(kbd, value); |
876 | /* try to make Alt, oops, AltGr and such work */ | 885 | /* try to make Alt, oops, AltGr and such work */ |
877 | if (!key_maps[kbd->lockstate ^ kbd->slockstate]) { | 886 | if (!key_maps[kbd->lockstate ^ kbd->slockstate]) { |
@@ -909,7 +918,7 @@ static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag) | |||
909 | 918 | ||
910 | static void k_brl(struct vc_data *vc, unsigned char value, char up_flag) | 919 | static void k_brl(struct vc_data *vc, unsigned char value, char up_flag) |
911 | { | 920 | { |
912 | static unsigned pressed,committing; | 921 | static unsigned pressed, committing; |
913 | static unsigned long releasestart; | 922 | static unsigned long releasestart; |
914 | 923 | ||
915 | if (kbd->kbdmode != VC_UNICODE) { | 924 | if (kbd->kbdmode != VC_UNICODE) { |
@@ -926,32 +935,28 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag) | |||
926 | if (value > 8) | 935 | if (value > 8) |
927 | return; | 936 | return; |
928 | 937 | ||
929 | if (up_flag) { | 938 | if (!up_flag) { |
930 | if (brl_timeout) { | ||
931 | if (!committing || | ||
932 | time_after(jiffies, | ||
933 | releasestart + msecs_to_jiffies(brl_timeout))) { | ||
934 | committing = pressed; | ||
935 | releasestart = jiffies; | ||
936 | } | ||
937 | pressed &= ~(1 << (value - 1)); | ||
938 | if (!pressed) { | ||
939 | if (committing) { | ||
940 | k_brlcommit(vc, committing, 0); | ||
941 | committing = 0; | ||
942 | } | ||
943 | } | ||
944 | } else { | ||
945 | if (committing) { | ||
946 | k_brlcommit(vc, committing, 0); | ||
947 | committing = 0; | ||
948 | } | ||
949 | pressed &= ~(1 << (value - 1)); | ||
950 | } | ||
951 | } else { | ||
952 | pressed |= 1 << (value - 1); | 939 | pressed |= 1 << (value - 1); |
953 | if (!brl_timeout) | 940 | if (!brl_timeout) |
954 | committing = pressed; | 941 | committing = pressed; |
942 | } else if (brl_timeout) { | ||
943 | if (!committing || | ||
944 | time_after(jiffies, | ||
945 | releasestart + msecs_to_jiffies(brl_timeout))) { | ||
946 | committing = pressed; | ||
947 | releasestart = jiffies; | ||
948 | } | ||
949 | pressed &= ~(1 << (value - 1)); | ||
950 | if (!pressed && committing) { | ||
951 | k_brlcommit(vc, committing, 0); | ||
952 | committing = 0; | ||
953 | } | ||
954 | } else { | ||
955 | if (committing) { | ||
956 | k_brlcommit(vc, committing, 0); | ||
957 | committing = 0; | ||
958 | } | ||
959 | pressed &= ~(1 << (value - 1)); | ||
955 | } | 960 | } |
956 | } | 961 | } |
957 | 962 | ||
@@ -972,6 +977,7 @@ void setledstate(struct kbd_struct *kbd, unsigned int led) | |||
972 | kbd->ledmode = LED_SHOW_IOCTL; | 977 | kbd->ledmode = LED_SHOW_IOCTL; |
973 | } else | 978 | } else |
974 | kbd->ledmode = LED_SHOW_FLAGS; | 979 | kbd->ledmode = LED_SHOW_FLAGS; |
980 | |||
975 | set_leds(); | 981 | set_leds(); |
976 | } | 982 | } |
977 | 983 | ||
@@ -1059,7 +1065,7 @@ static const unsigned short x86_keycodes[256] = | |||
1059 | 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; | 1065 | 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; |
1060 | 1066 | ||
1061 | #ifdef CONFIG_SPARC | 1067 | #ifdef CONFIG_SPARC |
1062 | static int sparc_l1_a_state = 0; | 1068 | static int sparc_l1_a_state; |
1063 | extern void sun_do_break(void); | 1069 | extern void sun_do_break(void); |
1064 | #endif | 1070 | #endif |
1065 | 1071 | ||
@@ -1069,53 +1075,54 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, | |||
1069 | int code; | 1075 | int code; |
1070 | 1076 | ||
1071 | switch (keycode) { | 1077 | switch (keycode) { |
1072 | case KEY_PAUSE: | ||
1073 | put_queue(vc, 0xe1); | ||
1074 | put_queue(vc, 0x1d | up_flag); | ||
1075 | put_queue(vc, 0x45 | up_flag); | ||
1076 | break; | ||
1077 | 1078 | ||
1078 | case KEY_HANGEUL: | 1079 | case KEY_PAUSE: |
1079 | if (!up_flag) | 1080 | put_queue(vc, 0xe1); |
1080 | put_queue(vc, 0xf2); | 1081 | put_queue(vc, 0x1d | up_flag); |
1081 | break; | 1082 | put_queue(vc, 0x45 | up_flag); |
1083 | break; | ||
1082 | 1084 | ||
1083 | case KEY_HANJA: | 1085 | case KEY_HANGEUL: |
1084 | if (!up_flag) | 1086 | if (!up_flag) |
1085 | put_queue(vc, 0xf1); | 1087 | put_queue(vc, 0xf2); |
1086 | break; | 1088 | break; |
1087 | 1089 | ||
1088 | case KEY_SYSRQ: | 1090 | case KEY_HANJA: |
1089 | /* | 1091 | if (!up_flag) |
1090 | * Real AT keyboards (that's what we're trying | 1092 | put_queue(vc, 0xf1); |
1091 | * to emulate here emit 0xe0 0x2a 0xe0 0x37 when | 1093 | break; |
1092 | * pressing PrtSc/SysRq alone, but simply 0x54 | ||
1093 | * when pressing Alt+PrtSc/SysRq. | ||
1094 | */ | ||
1095 | if (test_bit(KEY_LEFTALT, key_down) || | ||
1096 | test_bit(KEY_RIGHTALT, key_down)) { | ||
1097 | put_queue(vc, 0x54 | up_flag); | ||
1098 | } else { | ||
1099 | put_queue(vc, 0xe0); | ||
1100 | put_queue(vc, 0x2a | up_flag); | ||
1101 | put_queue(vc, 0xe0); | ||
1102 | put_queue(vc, 0x37 | up_flag); | ||
1103 | } | ||
1104 | break; | ||
1105 | 1094 | ||
1106 | default: | 1095 | case KEY_SYSRQ: |
1107 | if (keycode > 255) | 1096 | /* |
1108 | return -1; | 1097 | * Real AT keyboards (that's what we're trying |
1098 | * to emulate here emit 0xe0 0x2a 0xe0 0x37 when | ||
1099 | * pressing PrtSc/SysRq alone, but simply 0x54 | ||
1100 | * when pressing Alt+PrtSc/SysRq. | ||
1101 | */ | ||
1102 | if (test_bit(KEY_LEFTALT, key_down) || | ||
1103 | test_bit(KEY_RIGHTALT, key_down)) { | ||
1104 | put_queue(vc, 0x54 | up_flag); | ||
1105 | } else { | ||
1106 | put_queue(vc, 0xe0); | ||
1107 | put_queue(vc, 0x2a | up_flag); | ||
1108 | put_queue(vc, 0xe0); | ||
1109 | put_queue(vc, 0x37 | up_flag); | ||
1110 | } | ||
1111 | break; | ||
1109 | 1112 | ||
1110 | code = x86_keycodes[keycode]; | 1113 | default: |
1111 | if (!code) | 1114 | if (keycode > 255) |
1112 | return -1; | 1115 | return -1; |
1113 | 1116 | ||
1114 | if (code & 0x100) | 1117 | code = x86_keycodes[keycode]; |
1115 | put_queue(vc, 0xe0); | 1118 | if (!code) |
1116 | put_queue(vc, (code & 0x7f) | up_flag); | 1119 | return -1; |
1117 | 1120 | ||
1118 | break; | 1121 | if (code & 0x100) |
1122 | put_queue(vc, 0xe0); | ||
1123 | put_queue(vc, (code & 0x7f) | up_flag); | ||
1124 | |||
1125 | break; | ||
1119 | } | 1126 | } |
1120 | 1127 | ||
1121 | return 0; | 1128 | return 0; |
@@ -1138,6 +1145,7 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, unsigned char u | |||
1138 | static void kbd_rawcode(unsigned char data) | 1145 | static void kbd_rawcode(unsigned char data) |
1139 | { | 1146 | { |
1140 | struct vc_data *vc = vc_cons[fg_console].d; | 1147 | struct vc_data *vc = vc_cons[fg_console].d; |
1148 | |||
1141 | kbd = kbd_table + vc->vc_num; | 1149 | kbd = kbd_table + vc->vc_num; |
1142 | if (kbd->kbdmode == VC_RAW) | 1150 | if (kbd->kbdmode == VC_RAW) |
1143 | put_queue(vc, data); | 1151 | put_queue(vc, data); |
@@ -1147,10 +1155,12 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1147 | { | 1155 | { |
1148 | struct vc_data *vc = vc_cons[fg_console].d; | 1156 | struct vc_data *vc = vc_cons[fg_console].d; |
1149 | unsigned short keysym, *key_map; | 1157 | unsigned short keysym, *key_map; |
1150 | unsigned char type, raw_mode; | 1158 | unsigned char type; |
1159 | bool raw_mode; | ||
1151 | struct tty_struct *tty; | 1160 | struct tty_struct *tty; |
1152 | int shift_final; | 1161 | int shift_final; |
1153 | struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; | 1162 | struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down }; |
1163 | int rc; | ||
1154 | 1164 | ||
1155 | tty = vc->vc_tty; | 1165 | tty = vc->vc_tty; |
1156 | 1166 | ||
@@ -1168,7 +1178,8 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1168 | 1178 | ||
1169 | rep = (down == 2); | 1179 | rep = (down == 2); |
1170 | 1180 | ||
1171 | if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) | 1181 | raw_mode = (kbd->kbdmode == VC_RAW); |
1182 | if (raw_mode && !hw_raw) | ||
1172 | if (emulate_raw(vc, keycode, !down << 7)) | 1183 | if (emulate_raw(vc, keycode, !down << 7)) |
1173 | if (keycode < BTN_MISC && printk_ratelimit()) | 1184 | if (keycode < BTN_MISC && printk_ratelimit()) |
1174 | pr_warning("can't emulate rawmode for keycode %d\n", | 1185 | pr_warning("can't emulate rawmode for keycode %d\n", |
@@ -1176,7 +1187,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1176 | 1187 | ||
1177 | #ifdef CONFIG_SPARC | 1188 | #ifdef CONFIG_SPARC |
1178 | if (keycode == KEY_A && sparc_l1_a_state) { | 1189 | if (keycode == KEY_A && sparc_l1_a_state) { |
1179 | sparc_l1_a_state = 0; | 1190 | sparc_l1_a_state = false; |
1180 | sun_do_break(); | 1191 | sun_do_break(); |
1181 | } | 1192 | } |
1182 | #endif | 1193 | #endif |
@@ -1198,7 +1209,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1198 | put_queue(vc, (keycode >> 7) | 0x80); | 1209 | put_queue(vc, (keycode >> 7) | 0x80); |
1199 | put_queue(vc, keycode | 0x80); | 1210 | put_queue(vc, keycode | 0x80); |
1200 | } | 1211 | } |
1201 | raw_mode = 1; | 1212 | raw_mode = true; |
1202 | } | 1213 | } |
1203 | 1214 | ||
1204 | if (down) | 1215 | if (down) |
@@ -1221,29 +1232,32 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1221 | param.ledstate = kbd->ledflagstate; | 1232 | param.ledstate = kbd->ledflagstate; |
1222 | key_map = key_maps[shift_final]; | 1233 | key_map = key_maps[shift_final]; |
1223 | 1234 | ||
1224 | if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYCODE, ¶m) == NOTIFY_STOP || !key_map) { | 1235 | rc = atomic_notifier_call_chain(&keyboard_notifier_list, |
1225 | atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNBOUND_KEYCODE, ¶m); | 1236 | KBD_KEYCODE, ¶m); |
1237 | if (rc == NOTIFY_STOP || !key_map) { | ||
1238 | atomic_notifier_call_chain(&keyboard_notifier_list, | ||
1239 | KBD_UNBOUND_KEYCODE, ¶m); | ||
1226 | compute_shiftstate(); | 1240 | compute_shiftstate(); |
1227 | kbd->slockstate = 0; | 1241 | kbd->slockstate = 0; |
1228 | return; | 1242 | return; |
1229 | } | 1243 | } |
1230 | 1244 | ||
1231 | if (keycode >= NR_KEYS) | 1245 | if (keycode < NR_KEYS) |
1232 | if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) | ||
1233 | keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1)); | ||
1234 | else | ||
1235 | return; | ||
1236 | else | ||
1237 | keysym = key_map[keycode]; | 1246 | keysym = key_map[keycode]; |
1247 | else if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) | ||
1248 | keysym = U(K(KT_BRL, keycode - KEY_BRL_DOT1 + 1)); | ||
1249 | else | ||
1250 | return; | ||
1238 | 1251 | ||
1239 | type = KTYP(keysym); | 1252 | type = KTYP(keysym); |
1240 | 1253 | ||
1241 | if (type < 0xf0) { | 1254 | if (type < 0xf0) { |
1242 | param.value = keysym; | 1255 | param.value = keysym; |
1243 | if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNICODE, ¶m) == NOTIFY_STOP) | 1256 | rc = atomic_notifier_call_chain(&keyboard_notifier_list, |
1244 | return; | 1257 | KBD_UNICODE, ¶m); |
1245 | if (down && !raw_mode) | 1258 | if (rc != NOTIFY_STOP) |
1246 | to_utf8(vc, keysym); | 1259 | if (down && !raw_mode) |
1260 | to_utf8(vc, keysym); | ||
1247 | return; | 1261 | return; |
1248 | } | 1262 | } |
1249 | 1263 | ||
@@ -1257,9 +1271,11 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1257 | keysym = key_map[keycode]; | 1271 | keysym = key_map[keycode]; |
1258 | } | 1272 | } |
1259 | } | 1273 | } |
1260 | param.value = keysym; | ||
1261 | 1274 | ||
1262 | if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYSYM, ¶m) == NOTIFY_STOP) | 1275 | param.value = keysym; |
1276 | rc = atomic_notifier_call_chain(&keyboard_notifier_list, | ||
1277 | KBD_KEYSYM, ¶m); | ||
1278 | if (rc == NOTIFY_STOP) | ||
1263 | return; | 1279 | return; |
1264 | 1280 | ||
1265 | if (raw_mode && type != KT_SPEC && type != KT_SHIFT) | 1281 | if (raw_mode && type != KT_SPEC && type != KT_SHIFT) |