aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/keyboard.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-04-26 00:14:10 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2006-04-26 00:14:10 -0400
commit77426d7210430b70a7f5b21c05c4e7505528937d (patch)
tree52b89cfd45b49cb6dbb7c993cec73ba803ef5b0f /drivers/char/keyboard.c
parent1a0ccece05efb8a9c04b1130c24a2652239f3bea (diff)
Input: allow using several chords for braille
For coping with bad keyboards, permit to type a braille pattern by pressing several chords. By default, only one chord is needed. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r--drivers/char/keyboard.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 935670a3cd98..5755b7e5f187 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -860,9 +860,32 @@ static void k_slock(struct vc_data *vc, unsigned char value, char up_flag, struc
860} 860}
861 861
862/* by default, 300ms interval for combination release */ 862/* by default, 300ms interval for combination release */
863static long brl_timeout = 300; 863static unsigned brl_timeout = 300;
864MODULE_PARM_DESC(brl_timeout, "Braille keys release delay in ms (0 for combination on first release, < 0 for dead characters)"); 864MODULE_PARM_DESC(brl_timeout, "Braille keys release delay in ms (0 for commit on first key release)");
865module_param(brl_timeout, long, 0644); 865module_param(brl_timeout, uint, 0644);
866
867static unsigned brl_nbchords = 1;
868MODULE_PARM_DESC(brl_nbchords, "Number of chords that produce a braille pattern (0 for dead chords)");
869module_param(brl_nbchords, uint, 0644);
870
871static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag, struct pt_regs *regs)
872{
873 static unsigned long chords;
874 static unsigned committed;
875
876 if (!brl_nbchords)
877 k_deadunicode(vc, BRL_UC_ROW | pattern, up_flag, regs);
878 else {
879 committed |= pattern;
880 chords++;
881 if (chords == brl_nbchords) {
882 k_unicode(vc, BRL_UC_ROW | committed, up_flag, regs);
883 chords = 0;
884 committed = 0;
885 }
886 }
887}
888
866static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) 889static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs)
867{ 890{
868 static unsigned pressed,committing; 891 static unsigned pressed,committing;
@@ -882,11 +905,6 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct
882 if (value > 8) 905 if (value > 8)
883 return; 906 return;
884 907
885 if (brl_timeout < 0) {
886 k_deadunicode(vc, BRL_UC_ROW | (1 << (value - 1)), up_flag, regs);
887 return;
888 }
889
890 if (up_flag) { 908 if (up_flag) {
891 if (brl_timeout) { 909 if (brl_timeout) {
892 if (!committing || 910 if (!committing ||
@@ -897,13 +915,13 @@ static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct
897 pressed &= ~(1 << (value - 1)); 915 pressed &= ~(1 << (value - 1));
898 if (!pressed) { 916 if (!pressed) {
899 if (committing) { 917 if (committing) {
900 k_unicode(vc, BRL_UC_ROW | committing, 0, regs); 918 k_brlcommit(vc, committing, 0, regs);
901 committing = 0; 919 committing = 0;
902 } 920 }
903 } 921 }
904 } else { 922 } else {
905 if (committing) { 923 if (committing) {
906 k_unicode(vc, BRL_UC_ROW | committing, 0, regs); 924 k_brlcommit(vc, committing, 0, regs);
907 committing = 0; 925 committing = 0;
908 } 926 }
909 pressed &= ~(1 << (value - 1)); 927 pressed &= ~(1 << (value - 1));