Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 31 Aug 2002 14:49:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 31 Aug 2002 14:49:30 -0400 Received: from twilight.ucw.cz ([195.39.74.230]:35259 "EHLO twilight.ucw.cz") by vger.kernel.org with ESMTP id ; Sat, 31 Aug 2002 14:49:19 -0400 Date: Sat, 31 Aug 2002 20:53:37 +0200 From: Vojtech Pavlik To: bert hubert , Vojtech Pavlik , linux-kernel@vger.kernel.org Subject: Re: keyboard slowdown regression in 2.5.32 (right .config) Re: FIXED in 2.5.29 Re: keyboard ONLY functions in 2.5.27 with local APIC on for UP Message-ID: <20020831205337.A65739@ucw.cz> References: <20020720222905.GA15288@outpost.ds9a.nl> <20020728204051.A15238@ucw.cz> <20020728203211.GA20082@outpost.ds9a.nl> <20020831182645.GA8812@outpost.ds9a.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020831182645.GA8812@outpost.ds9a.nl>; from ahu@ds9a.nl on Sat, Aug 31, 2002 at 08:26:45PM +0200 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 30759 Lines: 952 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Aug 31, 2002 at 08:26:45PM +0200, bert hubert wrote: > Vojtech, list, I think we may have a small regression in the keyboard > support. > > In 2.5.27 my keyboard only worked when I turned on Local APIC on UP, which > was fixed in 2.5.29 (original message below). > > In 2.5.32 I'm back to almost the exact same problem, but the APIC setting > does not matter. > > It boots fine without keyboard support, which I had initially after make > oldconfig (except no keyboard). When I turn on the keyboard support, just > after 'Freeing unused kernel memory', my harddisk light starts to blink > roughly once every .75 seconds and the boot proceeds *very* slowly. > Furthermore, I can feel that the CPU is hard at work, the fan exhaust of my > laptop gets pretty hot. > > Numlock does not react and keystrokes do not appear on the screen. I do see > some keyboard related printk's early in the bootprocess but they are gone > quickly and do not look like errors. > > This is the exact same behaviour I had with 2.5.27 and APIC *off*. > > 2.5.31 works fine. This is a nearly-completely-SiS laptop from a company > called 'Gericom'. > > ahu@snapcount:/mnt/linux-2.5.32$ egrep 'KEY|INPUT' .config > CONFIG_INPUT_KEYBOARD=y > CONFIG_KEYBOARD_ATKBD=y > CONFIG_INPUT_MOUSE=y > CONFIG_INPUT_MISC=y > CONFIG_INPUT_PCSPKR=y How about I8042 support? Also enabled? If not, then the keyboard driver isn't even touching the hardware. > Let me know if there are further things I can try. I think I know where my > nullmodem cable is, so I could try that. Can you check with the attached patch? Or (better) Linus's current BK tree? -- Vojtech Pavlik SuSE Labs --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=linusfix You can import this changeset into BK by piping this whole message to: '| bk receive [path to repository]' or apply the patch as usual. 'bk pull bk://linux-input.bkbits.net/linux-input' should work as well. =================================================================== ChangeSet@1.543, 2002-08-28 19:48:23+02:00, vojtech@suse.cz Remove uninformative coments in input.c. Silence hotplug printk()s in input.c More careful probe and init in atkbd.c and psmouse.c to avoid triggering bugs in certain keyboards. Accept old AT (non PS/2) keyboards with limited command set. Accept Logitech mice which can only do IMPS/2 and not PS2++. Use a buffer in i8042.c to avoid spinlock deadlocks when serio_write is called from within serio_interrupt. Only ask keyboard to resent if the keyboard is there (ie no timeout). Linus, this should fix both your keyboard and your mouse! =================================================================== input.c | 112 ++++-------------------------------------- keyboard/atkbd.c | 103 ++++++++++++++------------------------- mouse/psmouse.c | 145 +++++++++++++++++++++++++------------------------------ serio/i8042.c | 34 +++++++++--- 4 files changed, 143 insertions(+), 251 deletions(-) =================================================================== diff -Nru a/drivers/input/input.c b/drivers/input/input.c --- a/drivers/input/input.c Wed Aug 28 19:50:15 2002 +++ b/drivers/input/input.c Wed Aug 28 19:50:15 2002 @@ -1,29 +1,13 @@ /* - * $Id: input.c,v 1.48 2001/12/26 21:08:33 jsimmons Exp $ + * The input core * - * Copyright (c) 1999-2001 Vojtech Pavlik - * - * The input core + * Copyright (c) 1999-2002 Vojtech Pavlik */ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: - * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. */ #include @@ -39,7 +23,7 @@ #include #include -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("Input core"); MODULE_LICENSE("GPL"); @@ -337,7 +321,7 @@ int i = 0, j, value; if (!hotplug_path[0]) { - printk(KERN_ERR "input.c: calling hotplug a hotplug agent defined\n"); + printk(KERN_ERR "input.c: calling hotplug without a hotplug agent defined\n"); return; } if (in_interrupt()) { @@ -395,16 +379,20 @@ envp[i++] = 0; +#ifdef INPUT_DEBUG printk(KERN_DEBUG "input.c: calling %s %s [%s %s %s %s %s]\n", argv[0], argv[1], envp[0], envp[1], envp[2], envp[3], envp[4]); +#endif value = call_usermodehelper(argv [0], argv, envp); kfree(buf); kfree(envp); +#ifdef INPUT_DEBUG if (value != 0) - printk(KERN_WARNING "input.c: hotplug returned %d\n", value); + printk(KERN_DEBUG "input.c: hotplug returned %d\n", value); +#endif } #endif @@ -415,31 +403,17 @@ struct input_handle *handle; struct input_device_id *id; -/* - * Add the EV_SYN capability. - */ - set_bit(EV_SYN, dev->evbit); -/* - * Initialize repeat timer to default values. - */ - init_timer(&dev->timer); dev->timer.data = (long) dev; dev->timer.function = input_repeat_key; dev->rep[REP_DELAY] = HZ/4; dev->rep[REP_PERIOD] = HZ/33; -/* - * Add the device. - */ INIT_LIST_HEAD(&dev->h_list); list_add_tail(&dev->node,&input_dev_list); -/* - * Notify handlers. - */ list_for_each(node,&input_handler_list) { struct input_handler *handler = to_handler(node); if ((id = input_match_device(handler->id_table, dev))) @@ -447,18 +421,10 @@ input_link_handle(handle); } -/* - * Notify the hotplug agent. - */ - #ifdef CONFIG_HOTPLUG input_call_hotplug("add", dev); #endif -/* - * Notify /proc. - */ - #ifdef CONFIG_PROC_FS input_devices_state++; wake_up(&input_devices_poll_wait); @@ -471,22 +437,11 @@ if (!dev) return; -/* - * Turn off power management for the device. - */ if (dev->pm_dev) pm_unregister(dev->pm_dev); -/* - * Kill any pending repeat timers. - */ - del_timer_sync(&dev->timer); -/* - * Notify handlers. - */ - list_for_each_safe(node,next,&dev->h_list) { struct input_handle * handle = to_handle(node); list_del_init(&handle->d_node); @@ -494,23 +449,12 @@ handle->handler->disconnect(handle); } -/* - * Notify the hotplug agent. - */ - #ifdef CONFIG_HOTPLUG input_call_hotplug("remove", dev); #endif -/* - * Remove the device. - */ list_del_init(&dev->node); -/* - * Notify /proc. - */ - #ifdef CONFIG_PROC_FS input_devices_state++; wake_up(&input_devices_poll_wait); @@ -526,22 +470,12 @@ if (!handler) return; INIT_LIST_HEAD(&handler->h_list); -/* - * Add minors if needed. - */ if (handler->fops != NULL) input_table[handler->minor >> 5] = handler; -/* - * Add the handler. - */ list_add_tail(&handler->node,&input_handler_list); -/* - * Notify it about all existing devices. - */ - list_for_each(node,&input_dev_list) { struct input_dev *dev = to_dev(node); if ((id = input_match_device(handler->id_table, dev))) @@ -549,10 +483,6 @@ input_link_handle(handle); } -/* - * Notify /proc. - */ - #ifdef CONFIG_PROC_FS input_devices_state++; wake_up(&input_devices_poll_wait); @@ -563,10 +493,6 @@ { struct list_head * node, * next; - -/* - * Tell the handler to disconnect from all devices it keeps open. - */ list_for_each_safe(node,next,&handler->h_list) { struct input_handle * handle = to_handle_h(node); list_del_init(&handle->h_node); @@ -574,21 +500,11 @@ handler->disconnect(handle); } -/* - * Remove it. - */ list_del_init(&handler->node); -/* - * Remove minors. - */ if (handler->fops != NULL) input_table[handler->minor >> 5] = NULL; -/* - * Notify /proc. - */ - #ifdef CONFIG_PROC_FS input_devices_state++; wake_up(&input_devices_poll_wait); @@ -643,10 +559,6 @@ { devfs_unregister(handle); } - -/* - * ProcFS interface for the input drivers. - */ #ifdef CONFIG_PROC_FS diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c --- a/drivers/input/keyboard/atkbd.c Wed Aug 28 19:50:15 2002 +++ b/drivers/input/keyboard/atkbd.c Wed Aug 28 19:50:15 2002 @@ -1,27 +1,13 @@ /* - * $Id: atkbd.c,v 1.33 2002/02/12 09:34:34 vojtech Exp $ + * AT and PS/2 keyboard driver * - * Copyright (c) 1999-2001 Vojtech Pavlik + * Copyright (c) 1999-2002 Vojtech Pavlik */ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: - * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. */ #include @@ -33,7 +19,7 @@ #include #include -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("AT and PS/2 keyboard driver"); MODULE_PARM(atkbd_set, "1i"); MODULE_LICENSE("GPL"); @@ -94,9 +80,11 @@ #define ATKBD_CMD_SETLEDS 0x10ed #define ATKBD_CMD_GSCANSET 0x11f0 #define ATKBD_CMD_SSCANSET 0x10f0 -#define ATKBD_CMD_GETID 0x02f2 +#define ATKBD_CMD_GETID 0x01f2 +#define ATKBD_CMD_GETID2 0x0100 #define ATKBD_CMD_ENABLE 0x00f4 #define ATKBD_CMD_RESET_DIS 0x00f5 +#define ATKBD_CMD_RESET_BAT 0x01ff #define ATKBD_CMD_SETALL_MB 0x00f8 #define ATKBD_CMD_RESEND 0x00fe #define ATKBD_CMD_EX_ENABLE 0x10ea @@ -147,7 +135,7 @@ #endif /* Interface error. Request that the keyboard resend. */ - if ((flags & (SERIO_FRAME | SERIO_PARITY)) && atkbd->write) { + if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && atkbd->write) { printk("atkbd.c: frame/parity error: %02x\n", flags); serio_write(serio, ATKBD_CMD_RESEND); return; @@ -360,70 +348,60 @@ unsigned char param[2]; /* - * Full reset with selftest can on some keyboards be annoyingly slow, - * so we just do a reset-and-disable on the keyboard, which - * is considerably faster, but doesn't have to reset everything. + * Some systems, where the bit-twiddling when testing the io-lines of the + * controller may confuse the keyboard need a full reset of the keyboard. On + * these systems the BIOS also usually doesn't do it for us. */ - if (atkbd_command(atkbd, NULL, ATKBD_CMD_RESET_DIS)) +#ifdef CONFIG_KEYBOARD_ATKBD_RESET + if (atkbd_command(atkbd, NULL, ATKBD_CMD_RESET_BAT)) printk(KERN_WARNING "atkbd.c: keyboard reset failed\n"); +#endif /* - * Next, we check if it's a keyboard. It should send 0xab83 - * (0xab84 on IBM ThinkPad, and 0xaca1 on a NCD Sun layout keyboard, - * 0xab02 on unxlated i8042 and 0xab03 on unxlated ThinkPad, 0xab7f - * on Fujitsu Lifebook). - * If it's a mouse, it'll only send 0x00 (0x03 if it's MS mouse), - * and we'll time out here, and report an error. + * Next we check we can set LEDs on the keyboard. This should work on every + * keyboard out there. It also turns the LEDs off, which we want anyway. */ - param[0] = param[1] = 0; - - if (atkbd_command(atkbd, param, ATKBD_CMD_GETID)) + param[0] = 0; + if (atkbd_command(atkbd, param, ATKBD_CMD_SETLEDS)) return -1; - atkbd->id = (param[0] << 8) | param[1]; - - if (atkbd->id != 0xab83 && atkbd->id != 0xab84 && atkbd->id != 0xaca1 && - atkbd->id != 0xab7f && atkbd->id != 0xab02 && atkbd->id != 0xab03) - printk(KERN_WARNING "atkbd.c: Unusual keyboard ID: %#x on %s\n", - atkbd->id, atkbd->serio->phys); - - return 0; -} - /* - * atkbd_initialize() sets the keyboard into a sane state. + * Then we check the keyboard ID. We should get 0xab83 under normal conditions. + * Some keyboards report different values, but the first byte is always 0xab or + * 0xac. Some old AT keyboards don't report anything. */ -static void atkbd_initialize(struct atkbd *atkbd) -{ - unsigned char param; + if (atkbd_command(atkbd, param, ATKBD_CMD_GETID)) { + atkbd->id = 0xabba; + return 0; + } + if (param[0] != 0xab && param[0] != 0xac) + return -1; + atkbd->id = param[0] << 8; + if (atkbd_command(atkbd, param, ATKBD_CMD_GETID2)) + return -1; + atkbd->id |= param[0]; /* * Disable autorepeat. We don't need it, as we do it in software anyway, - * because that way can get faster repeat, and have less system load - * (less accesses to the slow ISA hardware). If this fails, we don't care, - * and will just ignore the repeated keys. + * because that way can get faster repeat, and have less system load (less + * accesses to the slow ISA hardware). If this fails, we don't care, and will + * just ignore the repeated keys. */ atkbd_command(atkbd, NULL, ATKBD_CMD_SETALL_MB); /* - * We also shut off all the leds. The console code will turn them back on, - * if needed. - */ - - param = 0; - atkbd_command(atkbd, ¶m, ATKBD_CMD_SETLEDS); - -/* - * Last, we enable the keyboard so that we get keypresses from it. + * Last, we enable the keyboard to make sure that we get keypresses from it. */ if (atkbd_command(atkbd, NULL, ATKBD_CMD_ENABLE)) printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n", atkbd->serio->phys); + + return 0; } /* @@ -524,9 +502,6 @@ input_register_device(&atkbd->dev); printk(KERN_INFO "input: %s on %s\n", atkbd->name, serio->phys); - - if (atkbd->write) - atkbd_initialize(atkbd); } diff -Nru a/drivers/input/mouse/psmouse.c b/drivers/input/mouse/psmouse.c --- a/drivers/input/mouse/psmouse.c Wed Aug 28 19:50:15 2002 +++ b/drivers/input/mouse/psmouse.c Wed Aug 28 19:50:15 2002 @@ -1,27 +1,13 @@ /* - * $Id: psmouse.c,v 1.18 2002/03/13 10:03:43 vojtech Exp $ + * PS/2 mouse driver * - * Copyright (c) 1999-2001 Vojtech Pavlik + * Copyright (c) 1999-2002 Vojtech Pavlik */ /* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so either by - * e-mail - mail your message to , or by paper mail: - * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. */ #include @@ -33,7 +19,7 @@ #include #include -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("PS/2 mouse driver"); MODULE_LICENSE("GPL"); @@ -43,6 +29,7 @@ #define PSMOUSE_CMD_SETSTREAM 0x00ea #define PSMOUSE_CMD_POLL 0x03eb #define PSMOUSE_CMD_GETID 0x01f2 +#define PSMOUSE_CMD_GETID2 0x0100 #define PSMOUSE_CMD_SETRATE 0x10f3 #define PSMOUSE_CMD_ENABLE 0x00f4 #define PSMOUSE_CMD_RESET_DIS 0x00f6 @@ -313,7 +300,7 @@ param[0] = 0; psmouse->vendor = "Generic"; psmouse->name = "Mouse"; - psmouse->model = 2; + psmouse->model = 0; /* * Try Genius NetMouse magic init. @@ -327,13 +314,13 @@ psmouse_command(psmouse, param, PSMOUSE_CMD_GETINFO); if (param[0] == 0x00 && param[1] == 0x33 && param[2] == 0x55) { - psmouse->vendor = "Genius"; - psmouse->name = "Mouse"; set_bit(BTN_EXTRA, psmouse->dev.keybit); set_bit(BTN_SIDE, psmouse->dev.keybit); set_bit(REL_WHEEL, psmouse->dev.relbit); + psmouse->vendor = "Genius"; + psmouse->name = "Wheel Mouse"; return PSMOUSE_GENPS; } @@ -356,7 +343,6 @@ static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75, 76, 80, 81, 83, 88, 96, 97, -1 }; psmouse->vendor = "Logitech"; - psmouse->name = "Mouse"; psmouse->model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); if (param[1] < 3) @@ -367,46 +353,53 @@ psmouse->type = PSMOUSE_PS2; for (i = 0; logitech_ps2pp[i] != -1; i++) - if (logitech_ps2pp[i] == psmouse->model) psmouse->type = PSMOUSE_PS2PP; + if (logitech_ps2pp[i] == psmouse->model) + psmouse->type = PSMOUSE_PS2PP; - if (psmouse->type != PSMOUSE_PS2PP) return PSMOUSE_PS2; + if (psmouse->type == PSMOUSE_PS2PP) { - for (i = 0; logitech_4btn[i] != -1; i++) - if (logitech_4btn[i] == psmouse->model) set_bit(BTN_SIDE, psmouse->dev.keybit); - - for (i = 0; logitech_wheel[i] != -1; i++) - if (logitech_wheel[i] == psmouse->model) set_bit(REL_WHEEL, psmouse->dev.relbit); + for (i = 0; logitech_4btn[i] != -1; i++) + if (logitech_4btn[i] == psmouse->model) + set_bit(BTN_SIDE, psmouse->dev.keybit); + + for (i = 0; logitech_wheel[i] != -1; i++) + if (logitech_wheel[i] == psmouse->model) { + set_bit(REL_WHEEL, psmouse->dev.relbit); + psmouse->name = "Wheel Mouse"; + } /* * Do Logitech PS2++ / PS2T++ magic init. */ - if (psmouse->model == 97) { /* TouchPad 3 */ + if (psmouse->model == 97) { /* TouchPad 3 */ - set_bit(REL_WHEEL, psmouse->dev.relbit); - set_bit(REL_HWHEEL, psmouse->dev.relbit); + set_bit(REL_WHEEL, psmouse->dev.relbit); + set_bit(REL_HWHEEL, psmouse->dev.relbit); - param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ - psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ - psmouse_command(psmouse, param, 0x30d1); - param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ - psmouse_command(psmouse, param, 0x30d1); - - param[0] = 0; - if (!psmouse_command(psmouse, param, 0x13d1) && - param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) - return PSMOUSE_PS2TPP; - - } else { - psmouse_ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ - psmouse_ps2pp_cmd(psmouse, param, 0xDB); - - if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && - (param[2] & 3) == ((param[1] >> 2) & 3)) - return PSMOUSE_PS2PP; + param[0] = 0x11; param[1] = 0x04; param[2] = 0x68; /* Unprotect RAM */ + psmouse_command(psmouse, param, 0x30d1); + param[0] = 0x11; param[1] = 0x05; param[2] = 0x0b; /* Enable features */ + psmouse_command(psmouse, param, 0x30d1); + param[0] = 0x11; param[1] = 0x09; param[2] = 0xc3; /* Enable PS2++ */ + psmouse_command(psmouse, param, 0x30d1); + + param[0] = 0; + if (!psmouse_command(psmouse, param, 0x13d1) && + param[0] == 0x06 && param[1] == 0x00 && param[2] == 0x14) + return PSMOUSE_PS2TPP; + + } else { + param[0] = param[1] = param[2] = 0; + + psmouse_ps2pp_cmd(psmouse, param, 0x39); /* Magic knock */ + psmouse_ps2pp_cmd(psmouse, param, 0xDB); + + if ((param[0] & 0x78) == 0x48 && (param[1] & 0xf3) == 0xc2 && + (param[2] & 3) == ((param[1] >> 2) & 3)) + return PSMOUSE_PS2PP; + } } - } /* @@ -426,7 +419,7 @@ set_bit(REL_WHEEL, psmouse->dev.relbit); /* - * Try IntelliMouse Explorer magic init. + * Try IntelliMouse/Explorer magic init. */ param[0] = 200; @@ -439,29 +432,22 @@ if (param[0] == 4) { - psmouse->vendor = "Microsoft"; - psmouse->name = "IntelliMouse Explorer"; - set_bit(BTN_SIDE, psmouse->dev.keybit); set_bit(BTN_EXTRA, psmouse->dev.keybit); + psmouse->name = "Explorer Mouse"; return PSMOUSE_IMEX; } - psmouse->vendor = "Microsoft"; - psmouse->name = "IntelliMouse"; - + psmouse->name = "Wheel Mouse"; return PSMOUSE_IMPS; } /* - * Okay, all failed, we have a standard mouse here. The number of the buttons is - * still a question, though. + * Okay, all failed, we have a standard mouse here. The number of the buttons + * is still a question, though. We assume 3. */ - psmouse->vendor = "Generic"; - psmouse->name = "Mouse"; - return PSMOUSE_PS2; } @@ -474,14 +460,7 @@ unsigned char param[2]; /* - * First we reset and disable the mouse. - */ - - if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS)) - return -1; - -/* - * Next, we check if it's a mouse. It should send 0x00 or 0x03 + * First, we check if it's a mouse. It should send 0x00 or 0x03 * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. */ @@ -490,10 +469,22 @@ if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETID)) return -1; + if (param[0] == 0xab || param[0] == 0xac) { + psmouse_command(psmouse, param, PSMOUSE_CMD_GETID2); + return -1; + } + if (param[0] != 0x00 && param[0] != 0x03 && param[0] != 0x04) return -1; /* + * Then we reset and disable the mouse so that it doesn't generate events. + */ + + if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS)) + return -1; + +/* * And here we try to determine if it has any extensions over the * basic PS/2 3-button mouse. */ @@ -602,9 +593,9 @@ psmouse->dev.name = psmouse->devname; psmouse->dev.phys = psmouse->phys; psmouse->dev.id.bustype = BUS_I8042; - psmouse->dev.id.vendor = psmouse->type; - psmouse->dev.id.product = psmouse->model; - psmouse->dev.id.version = 0x0100; + psmouse->dev.id.vendor = 0x0002; + psmouse->dev.id.product = psmouse->type; + psmouse->dev.id.version = psmouse->model; input_register_device(&psmouse->dev); diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c --- a/drivers/input/serio/i8042.c Wed Aug 28 19:50:15 2002 +++ b/drivers/input/serio/i8042.c Wed Aug 28 19:50:15 2002 @@ -23,7 +23,7 @@ #include "i8042.h" -MODULE_AUTHOR("Vojtech Pavlik "); +MODULE_AUTHOR("Vojtech Pavlik "); MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver"); MODULE_LICENSE("GPL"); @@ -347,6 +347,11 @@ unsigned long flags; unsigned char str, data; unsigned int dfl; + struct { + int data; + int str; + } buffer[I8042_BUFFER_SIZE]; + int i, j = 0; #ifdef CONFIG_VT kbd_pt_regs = regs; @@ -354,20 +359,31 @@ spin_lock_irqsave(&i8042_lock, flags); - while ((str = i8042_read_status()) & I8042_STR_OBF) { + while (j < I8042_BUFFER_SIZE && + (buffer[j].str = i8042_read_status()) & I8042_STR_OBF) + buffer[j++].data = i8042_read_data(); + + spin_unlock_irqrestore(&i8042_lock, flags); + + for (i = 0; i < j; i++) { + + str = buffer[i].str; + data = buffer[i].data; - data = i8042_read_data(); dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); #ifdef I8042_DEBUG_IO - printk(KERN_DEBUG "i8042.c: %02x <- i8042 (interrupt, %s, %d) [%d]\n", - data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, (int) (jiffies - i8042_start)); + printk(KERN_DEBUG "i8042.c: %02x <- i8042 (interrupt, %s, %d%s%s) [%d]\n", + data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq, + dfl & SERIO_PARITY ? ", bad parity" : "", + dfl & SERIO_TIMEOUT ? ", timeout" : "", + (int) (jiffies - i8042_start)); #endif - if (i8042_aux_values.exists && (str & I8042_STR_AUXDATA)) { - serio_interrupt(&i8042_aux_port, data, dfl); - } else { + if (i8042_aux_values.exists && (buffer[i].str & I8042_STR_AUXDATA)) { + serio_interrupt(&i8042_aux_port, buffer[i].data, dfl); + } else if (i8042_kbd_values.exists) { if (!i8042_direct) { if (data > 0x7f) { @@ -385,10 +401,8 @@ } serio_interrupt(&i8042_kbd_port, data, dfl); } - } } - spin_unlock_irqrestore(&i8042_lock, flags); } /* =================================================================== This BitKeeper patch contains the following changesets: + ## Wrapped with gzip_uu ## begin 664 bkpatch19689 M'XL(`%<-;3T``^U:;7/:2!+^#+]BUJED88-![TAVG(L=<$+%CEU@W]Y=DJ($ M&D"QD%A)^.66W&^_IV>$$-BQG>1R55=UV4T$,ST]SW3/=#\]X@D[3WB\4[J, M/J=\."D_86^C)-TI)?.$UX?_Q/=N%.%[8Q)->2.3:@PN&GXXFZ=E])^ZZ7#" M+GF<[)34NIZWI#\LI- M)T$4UM/8#9,I3]WZ,)HNJKJ&RCU%,VS+ M*'ON)9^^BKDW<=.[%-B:K=AF4S<7AJ[99KG%U+IIZ$S1&HK=T&RF.CN&O:/I MSQ5M1U%8MM!7F1G8R'Z46E6I2#V'$40X,;\]$\@$PTX,P- M/0CX*0FZZ<7`JP]%VRR91F*%&)9&S+V,?(^EL3\><^@>L\%\+)0/>9RZ>%[P MFT'DQEY"]AE9=2;$K/YVPP)_Z*?=H45.:-.%I M8?A1-/;)U&SJ8VE7$Q\?AV[(HC"X85[$.L>D5*`-HQ0S:,^?TW!L6^8"X&C$ M8[%^6S&T>F$9R

O0!<"8\Q%!L>#_J7\68E_D)9@L"P!O%T50` MAC(I`>OR.)[/!-P3PN,F%_GJ:*:8)_`3\T M5DG/D1_.DQKZ(91,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