diff options
| author | Helge Deller <deller@gmx.de> | 2004-01-18 20:27:53 +0100 |
|---|---|---|
| committer | Vojtech Pavlik <vojtech@suse.cz> | 2004-01-18 20:27:53 +0100 |
| commit | 70144f785bea7791848ecdbdc473ea1e10dd4540 (patch) | |
| tree | 85596fff69f493b9800284eed30bf5ad609409db /drivers/input/mouse | |
| parent | d18c41fa5a75905256f041cd9ba4b051bb8031dd (diff) | |
input: Bugfixes in atkbd and psmouse-base probing. (use unsigned char param[]
in atkbd_event, like everywhere else, use param[0] instead of *param
at the same place, properly set serio->private to NULL if probe fails
in both atkbd and psmouse, and fix preinitializing of the return buffer
in *_command() funcitons.)
Diffstat (limited to 'drivers/input/mouse')
| -rw-r--r-- | drivers/input/mouse/psmouse-base.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 89e1c47a1b8a..19e0c3cc0e01 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -235,6 +235,11 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) if (command == PSMOUSE_CMD_RESET_BAT) timeout = 4000000; /* 4 sec */ + /* initialize cmdbuf with preset values from param */ + if (receive) + for (i = 0; i < receive; i++) + psmouse->cmdbuf[(receive - 1) - i] = param[i]; + if (command & 0xff) if (psmouse_sendbyte(psmouse, command & 0xff)) return (psmouse->cmdcnt = 0) - 1; @@ -245,8 +250,9 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) while (psmouse->cmdcnt && timeout--) { - if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT) - timeout = 100000; + if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT && + timeout > 100000) /* do not run in a endless loop */ + timeout = 100000; /* 1 sec */ if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID && psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) { @@ -414,7 +420,7 @@ static int psmouse_probe(struct psmouse *psmouse) * in case of an IntelliMouse in 4-byte mode or 0x04 for IM Explorer. */ - param[0] = param[1] = 0xa5; + param[0] = 0xa5; if (psmouse_command(psmouse, param, PSMOUSE_CMD_GETID)) return -1; @@ -578,12 +584,14 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev) serio->private = psmouse; if (serio_open(serio, dev)) { kfree(psmouse); + serio->private = NULL; return; } if (psmouse_probe(psmouse) <= 0) { serio_close(serio); kfree(psmouse); + serio->private = NULL; return; } |
