Re: PATCH: sticky shift keys: bug fix and more intuitive behaviour

Werner Almesberger (almesber@lrc.di.epfl.ch)
Sun, 16 May 1999 12:04:20 +0200 (MET DST)


Linus Torvalds wrote:
> Adding a new config option doesn't seem to make sense, just fix the bug ;)

Okay ;-) New patch below.

Cheers, Werner

---------------------------------- cut here -----------------------------------

--- linux.orig/drivers/char/keyboard.c Tue May 11 23:37:40 1999
+++ linux/drivers/char/keyboard.c Sun May 16 12:04:32 1999
@@ -279,7 +279,8 @@
u_char type;

/* the XOR below used to be an OR */
- int shift_final = shift_state ^ kbd->lockstate ^ kbd->slockstate;
+ int shift_final = (shift_state | kbd->slockstate) ^
+ kbd->lockstate;
ushort *key_map = key_maps[shift_final];

if (key_map != NULL) {
@@ -311,6 +312,7 @@
/* we have at least to update shift_state */
#if 1 /* how? two almost equivalent choices follow */
compute_shiftstate();
+ kbd->slockstate = 0; /* play it safe */
#else
keysym = U(plain_map[keycode]);
type = KTYP(keysym);
@@ -472,6 +474,7 @@

static void boot_it(void)
{
+ if (kbd->slockstate & ~shift_state) return;
ctrl_alt_del();
}

@@ -741,7 +744,7 @@
for(j=0; j<BITS_PER_LONG; j++,k++)
if(test_bit(k, key_down)) {
sym = U(plain_map[k]);
- if(KTYP(sym) == KT_SHIFT) {
+ if(KTYP(sym) == KT_SHIFT || KTYP(sym) == KT_SLOCK) {
val = KVAL(sym);
if (val == KVAL(K_CAPSSHIFT))
val = KVAL(K_SHIFT);
@@ -793,9 +796,15 @@

static void do_slock(unsigned char value, char up_flag)
{
+ do_shift(value,up_flag);
if (up_flag || rep)
return;
chg_vc_kbd_slock(kbd, value);
+ /* try to make Alt, oops, AltGr and such work */
+ if (!key_maps[kbd->lockstate ^ kbd->slockstate]) {
+ kbd->slockstate = 0;
+ chg_vc_kbd_slock(kbd, value);
+ }
}

/*

-- 
  _________________________________________________________________________
 / Werner Almesberger, DI-ICA,EPFL,CH   werner.almesberger@lrc.di.epfl.ch /
/_IN_R_131__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/