Messages in this thread Patches in this message |  | | Date | Tue, 14 Aug 2001 23:29:47 +0200 | From | Kurt Garloff <> | Subject | Re: [PATCH] make psaux reconnect adjustable |
| |
On Tue, Aug 14, 2001 at 09:58:55AM -0700, Linus Torvalds wrote: > - do we actually need the config switch AT ALL, whether at bootup or not? > What exactly breaks if we just always pass the AA 00 values through? > Apparently nothing ever breaks, which makes me suspect that people are > just being unnecessarily defensive. > > In short, I'd prefer a patch that just unconditionally removes the code, > unless somebody KNOWS that it could break something. That failing, a > simple kernel command line option sounds better than more files in /proc.
OK, here come two patches. The first one removes the special PSAUX reconnect handling completely. So userspace should handle it. (Which is possible; just not implemented in gpm/X11 at this time AFAIK.)
Second patch reintroduces the special handling again, but does * react on AA 00 instead of just AA, thus much less likely breaking other drivers (such as synps2). All PS/2 mouses I could access (about 5 different models) produced AA 00, so this seems OK. * is disabled by default, and needs to be enabled by the psaux-reconnect boot parameter, like in 2.2.19.
Second patch depends on first. Please apply just the first or both.
(Current failure of gpm/X11 would make me choose for both, but then I'm more the one thinking of customers of a distro than the one trying to keep the kernel clean. On the long term, I'd drop the second in any case.)
Regards, -- Kurt Garloff <garloff@suse.de> Eindhoven, NL GPG key: See mail header, key servers Linux kernel development SuSE GmbH, Nuernberg, DE SCSI, Security diff -uNr linux-2.4.7.kurt-1/drivers/char/pc_keyb.c linux-2.4.7.kurt-1-noreconnect/drivers/char/pc_keyb.c --- linux-2.4.7.kurt-1/drivers/char/pc_keyb.c Tue Jul 24 18:42:36 2001 +++ linux-2.4.7.kurt-1-noreconnect/drivers/char/pc_keyb.c Tue Aug 14 22:47:38 2001 @@ -81,8 +81,6 @@ static int __init psaux_init(void); -#define AUX_RECONNECT 170 /* scancode when ps2 device is plugged (back) in */ - static struct aux_queue *queue; /* Mouse data buffer. */ static int aux_count; /* used when we send commands to the mouse that expect an ACK. */ @@ -406,11 +404,6 @@ return; } mouse_reply_expected = 0; - } - else if(scancode == AUX_RECONNECT){ - queue->head = queue->tail = 0; /* Flush input queue */ - __aux_write_ack(AUX_ENABLE_DEV); /* ping the mouse :) */ - return; } add_mouse_randomness(scancode);diff -uNr linux-2.4.7.kurt-1-noreconnect/drivers/char/pc_keyb.c linux-2.4.7.kurt-1-recon_bootpar/drivers/char/pc_keyb.c --- linux-2.4.7.kurt-1-noreconnect/drivers/char/pc_keyb.c Tue Aug 14 22:47:38 2001 +++ linux-2.4.7.kurt-1-recon_bootpar/drivers/char/pc_keyb.c Tue Aug 14 23:13:49 2001 @@ -63,6 +63,7 @@ #ifdef CONFIG_PSMOUSE static void aux_write_ack(int val); static void __aux_write_ack(int val); +static int aux_reconnect = 0; #endif static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED; @@ -81,6 +82,9 @@ static int __init psaux_init(void); +#define AUX_RECONNECT1 0xaa /* scancode1 when ps2 device is plugged (back) in */ +#define AUX_RECONNECT2 0x00 /* scancode2 when ps2 device is plugged (back) in */ + static struct aux_queue *queue; /* Mouse data buffer. */ static int aux_count; /* used when we send commands to the mouse that expect an ACK. */ @@ -398,6 +402,7 @@ static inline void handle_mouse_event(unsigned char scancode) { #ifdef CONFIG_PSMOUSE + static unsigned char prev_code; if (mouse_reply_expected) { if (scancode == AUX_ACK) { mouse_reply_expected--; @@ -405,7 +410,15 @@ } mouse_reply_expected = 0; } + else if(scancode == AUX_RECONNECT2 && prev_code == AUX_RECONNECT1 + && aux_reconnect) { + printk (KERN_INFO "PS/2 mouse reconnect detected\n"); + queue->head = queue->tail = 0; /* Flush input queue */ + __aux_write_ack(AUX_ENABLE_DEV); /* ping the mouse :) */ + return; + } + prev_code = scancode; add_mouse_randomness(scancode); if (aux_count) { int head = queue->head; @@ -751,6 +764,14 @@ } #if defined CONFIG_PSMOUSE + +static int __init aux_reconnect_setup (char *str) +{ + aux_reconnect = 1; + return 1; +} + +__setup("psaux-reconnect", aux_reconnect_setup); /* * Check if this is a dual port controller.[unhandled content-type:application/pgp-signature] |  |