Something wrong with mouse timeouts
Hi!
Code is at least *very* confusing in psmouse_command; I think its buggy:
if (command == PSMOUSE_CMD_RESET_BAT)
B => 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;
for (i = 0; i < send; i++)
if (psmouse_sendbyte(psmouse, param[i]))
return (psmouse->cmdcnt = 0) - 1;
while (psmouse->cmdcnt && timeout--) {C => if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_RESET_BAT &&
timeout > 100000) /* do not run in a endless loop */
A => timeout = 100000; /* 1 sec */
if (psmouse->cmdcnt == 1 && command == PSMOUSE_CMD_GETID &&
psmouse->cmdbuf[1] != 0xab && psmouse->cmdbuf[1] != 0xac) {
psmouse->cmdcnt = 0;
break;
}
udelay(1);
}In A), it says that it sets timeout to 1 sec, when it in fact sets it to 100msec. Whats more, for CMD_RESET_BAT, timeout is explicitely set to 4sec B); but in C), there is extra code to reset it to 100msec? Why? Is it trying to set shorter timeout for last byte of reply or something similar?
It speaks about endless loops, but 4 sec is certainly not endless if you ask me.
Pavel
Signature · 1 line
934a471f20d6580d5aad759bf0d97ddc