X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fkeyboard.c;h=8b603b2d1c4211ebedb7a4e575db84278b75c276;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=3d75591eb0ff34c18889aa9c2a16e740fa30b388;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 3d75591eb..8b603b2d1 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c @@ -74,7 +74,7 @@ void compute_shiftstate(void); k_self, k_fn, k_spec, k_pad,\ k_dead, k_cons, k_cur, k_shift,\ k_meta, k_ascii, k_lock, k_lowercase,\ - k_slock, k_dead2, k_brl, k_ignore + k_slock, k_dead2, k_ignore, k_ignore typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs); @@ -100,7 +100,7 @@ static fn_handler_fn *fn_handler[] = { FN_HANDLERS }; const int max_vals[] = { 255, ARRAY_SIZE(func_table) - 1, ARRAY_SIZE(fn_handler) - 1, NR_PAD - 1, NR_DEAD - 1, 255, 3, NR_SHIFT - 1, 255, NR_ASCII - 1, NR_LOCK - 1, - 255, NR_LOCK - 1, 255, NR_BRL - 1 + 255, NR_LOCK - 1, 255 }; const int NR_TYPES = ARRAY_SIZE(max_vals); @@ -126,7 +126,7 @@ static unsigned long key_down[NBITS(KEY_MAX)]; /* keyboard key bitmap */ static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ static int dead_key_next; static int npadch = -1; /* -1 or number assembled on pad */ -static unsigned int diacr; +static unsigned char diacr; static char rep; /* flag telling character repeat */ static unsigned char ledstate = 0xff; /* undefined */ @@ -394,30 +394,22 @@ void compute_shiftstate(void) * Otherwise, conclude that DIACR was not combining after all, * queue it and return CH. */ -static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch) +static unsigned char handle_diacr(struct vc_data *vc, unsigned char ch) { - unsigned int d = diacr; + int d = diacr; unsigned int i; diacr = 0; - if ((d & ~0xff) == BRL_UC_ROW) { - if ((ch & ~0xff) == BRL_UC_ROW) - return d | ch; - } else { - for (i = 0; i < accent_table_size; i++) - if (accent_table[i].diacr == d && accent_table[i].base == ch) - return accent_table[i].result; + for (i = 0; i < accent_table_size; i++) { + if (accent_table[i].diacr == d && accent_table[i].base == ch) + return accent_table[i].result; } - if (ch == ' ' || ch == (BRL_UC_ROW|0) || ch == d) + if (ch == ' ' || ch == d) return d; - if (kbd->kbdmode == VC_UNICODE) - to_utf8(vc, d); - else if (d < 0x100) - put_queue(vc, d); - + put_queue(vc, d); return ch; } @@ -427,10 +419,7 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch) static void fn_enter(struct vc_data *vc, struct pt_regs *regs) { if (diacr) { - if (kbd->kbdmode == VC_UNICODE) - to_utf8(vc, diacr); - else if (diacr < 0x100) - put_queue(vc, diacr); + put_queue(vc, diacr); diacr = 0; } put_queue(vc, 13); @@ -626,7 +615,7 @@ static void k_lowercase(struct vc_data *vc, unsigned char value, char up_flag, s printk(KERN_ERR "keyboard.c: k_lowercase was called - impossible\n"); } -static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) +static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) { if (up_flag) return; /* no action, if this is a key release */ @@ -639,10 +628,7 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, stru diacr = value; return; } - if (kbd->kbdmode == VC_UNICODE) - to_utf8(vc, value); - else if (value < 0x100) - put_queue(vc, value); + put_queue(vc, value); } /* @@ -650,23 +636,13 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag, stru * dead keys modifying the same character. Very useful * for Vietnamese. */ -static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag, struct pt_regs *regs) +static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) { if (up_flag) return; diacr = (diacr ? handle_diacr(vc, value) : value); } -static void k_self(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) -{ - k_unicode(vc, value, up_flag, regs); -} - -static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) -{ - k_deadunicode(vc, value, up_flag, regs); -} - /* * Obsolete - for backwards compatibility only */ @@ -674,7 +650,7 @@ static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct { static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; value = ret_diacr[value]; - k_deadunicode(vc, value, up_flag, regs); + k_dead2(vc, value, up_flag, regs); } static void k_cons(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) @@ -859,80 +835,6 @@ static void k_slock(struct vc_data *vc, unsigned char value, char up_flag, struc } } -/* by default, 300ms interval for combination release */ -static unsigned brl_timeout = 300; -MODULE_PARM_DESC(brl_timeout, "Braille keys release delay in ms (0 for commit on first key release)"); -module_param(brl_timeout, uint, 0644); - -static unsigned brl_nbchords = 1; -MODULE_PARM_DESC(brl_nbchords, "Number of chords that produce a braille pattern (0 for dead chords)"); -module_param(brl_nbchords, uint, 0644); - -static void k_brlcommit(struct vc_data *vc, unsigned int pattern, char up_flag, struct pt_regs *regs) -{ - static unsigned long chords; - static unsigned committed; - - if (!brl_nbchords) - k_deadunicode(vc, BRL_UC_ROW | pattern, up_flag, regs); - else { - committed |= pattern; - chords++; - if (chords == brl_nbchords) { - k_unicode(vc, BRL_UC_ROW | committed, up_flag, regs); - chords = 0; - committed = 0; - } - } -} - -static void k_brl(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) -{ - static unsigned pressed,committing; - static unsigned long releasestart; - - if (kbd->kbdmode != VC_UNICODE) { - if (!up_flag) - printk("keyboard mode must be unicode for braille patterns\n"); - return; - } - - if (!value) { - k_unicode(vc, BRL_UC_ROW, up_flag, regs); - return; - } - - if (value > 8) - return; - - if (up_flag) { - if (brl_timeout) { - if (!committing || - jiffies - releasestart > (brl_timeout * HZ) / 1000) { - committing = pressed; - releasestart = jiffies; - } - pressed &= ~(1 << (value - 1)); - if (!pressed) { - if (committing) { - k_brlcommit(vc, committing, 0, regs); - committing = 0; - } - } - } else { - if (committing) { - k_brlcommit(vc, committing, 0, regs); - committing = 0; - } - pressed &= ~(1 << (value - 1)); - } - } else { - pressed |= 1 << (value - 1); - if (!brl_timeout) - committing = pressed; - } -} - /* * The leds display either (i) the status of NumLock, CapsLock, ScrollLock, * or (ii) whatever pattern of lights people want to show using KDSETLED, @@ -1223,13 +1125,9 @@ static void kbd_keycode(unsigned int keycode, int down, } if (keycode > NR_KEYS) - if (keycode >= KEY_BRL_DOT1 && keycode <= KEY_BRL_DOT8) - keysym = K(KT_BRL, keycode - KEY_BRL_DOT1 + 1); - else - return; - else - keysym = key_map[keycode]; + return; + keysym = key_map[keycode]; type = KTYP(keysym); if (type < 0xf0) { @@ -1343,7 +1241,7 @@ int __init kbd_init(void) kbd0.lockstate = KBD_DEFLOCK; kbd0.slockstate = 0; kbd0.modeflags = KBD_DEFMODE; - kbd0.kbdmode = VC_UNICODE; + kbd0.kbdmode = VC_XLATE; for (i = 0 ; i < MAX_NR_CONSOLES ; i++) kbd_table[i] = kbd0;