ps2mouse: disable packet streaming during reprogramming

sometimes, ps2 mouse setup failed on thinkpads during boot. disabling
packet streaming while we program the mouse seems to fix the issue.
This commit is contained in:
cinap_lenrek 2014-01-02 07:44:17 +01:00
parent 0e242236ba
commit e56affb840
2 changed files with 22 additions and 8 deletions

View file

@ -164,10 +164,7 @@ i8042auxcmd(int cmd)
{ {
unsigned int c; unsigned int c;
int tries; int tries;
static int badkbd;
if(badkbd)
return -1;
c = 0; c = 0;
tries = 0; tries = 0;
@ -191,7 +188,6 @@ i8042auxcmd(int cmd)
if(c != 0xFA){ if(c != 0xFA){
print("i8042: %2.2ux returned to the %2.2ux command\n", c, cmd); print("i8042: %2.2ux returned to the %2.2ux command\n", c, cmd);
badkbd = 1; /* don't keep trying; there might not be one */
return -1; return -1;
} }
return 0; return 0;

View file

@ -165,9 +165,7 @@ ps2mouse(void)
return; return;
i8042auxenable(ps2mouseputc); i8042auxenable(ps2mouseputc);
/* make mouse streaming, enabled */ i8042auxcmd(0xEA); /* set stream mode */
i8042auxcmd(0xEA);
i8042auxcmd(0xF4);
mousetype = MousePS2; mousetype = MousePS2;
packetsize = 3; packetsize = 3;
@ -255,7 +253,16 @@ resetmouse(void)
i8042auxcmd(0xEA); /* streaming */ i8042auxcmd(0xEA); /* streaming */
i8042auxcmd(0xE8); /* set resolution */ i8042auxcmd(0xE8); /* set resolution */
i8042auxcmd(3); i8042auxcmd(3);
i8042auxcmd(0xF4); /* enabled */ break;
}
}
static void
setstream(int on)
{
switch(mousetype){
case MousePS2:
i8042auxcmd(on ? 0xF4 : 0xF5);
break; break;
} }
} }
@ -274,27 +281,37 @@ mousectl(Cmdbuf *cb)
ct = lookupcmd(cb, mousectlmsg, nelem(mousectlmsg)); ct = lookupcmd(cb, mousectlmsg, nelem(mousectlmsg));
switch(ct->index){ switch(ct->index){
case CMaccelerated: case CMaccelerated:
setstream(0);
setaccelerated(cb->nf == 1 ? 1 : atoi(cb->f[1])); setaccelerated(cb->nf == 1 ? 1 : atoi(cb->f[1]));
setstream(1);
break; break;
case CMintellimouse: case CMintellimouse:
setstream(0);
setintellimouse(); setintellimouse();
setstream(1);
break; break;
case CMlinear: case CMlinear:
setstream(0);
setlinear(); setlinear();
setstream(1);
break; break;
case CMps2: case CMps2:
intellimouse = 0; intellimouse = 0;
ps2mouse(); ps2mouse();
setstream(1);
break; break;
case CMps2intellimouse: case CMps2intellimouse:
ps2mouse(); ps2mouse();
setintellimouse(); setintellimouse();
setstream(1);
break; break;
case CMres: case CMres:
setstream(0);
if(cb->nf >= 2) if(cb->nf >= 2)
setres(atoi(cb->f[1])); setres(atoi(cb->f[1]));
else else
setres(1); setres(1);
setstream(1);
break; break;
case CMreset: case CMreset:
resetmouse(); resetmouse();
@ -304,6 +321,7 @@ mousectl(Cmdbuf *cb)
setres(resolution); setres(resolution);
if(intellimouse) if(intellimouse)
setintellimouse(); setintellimouse();
setstream(1);
break; break;
case CMserial: case CMserial:
if(mousetype == Mouseserial) if(mousetype == Mouseserial)