lkml.org 
[lkml]   [2004]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSomething 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
--
934a471f20d6580d5aad759bf0d97ddc
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.044 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site