ref: e56affb840a369ccca365ce6f0c83a55b99224bc
parent: 0e242236bada9266fb4d71912edad87c099ba96f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 2 02:44:17 EST 2014
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.
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -164,10 +164,7 @@
{
unsigned int c;
int tries;
- static int badkbd;
- if(badkbd)
- return -1;
c = 0;
tries = 0;
@@ -191,7 +188,6 @@
if(c != 0xFA){
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 0;
--- a/sys/src/9/pc/mouse.c
+++ b/sys/src/9/pc/mouse.c
@@ -165,9 +165,7 @@
return;
i8042auxenable(ps2mouseputc);
- /* make mouse streaming, enabled */
- i8042auxcmd(0xEA);
- i8042auxcmd(0xF4);
+ i8042auxcmd(0xEA); /* set stream mode */
mousetype = MousePS2;
packetsize = 3;
@@ -255,11 +253,20 @@
i8042auxcmd(0xEA); /* streaming */
i8042auxcmd(0xE8); /* set resolution */
i8042auxcmd(3);
- i8042auxcmd(0xF4); /* enabled */
break;
}
}
+static void
+setstream(int on)
+{
+ switch(mousetype){
+ case MousePS2:
+ i8042auxcmd(on ? 0xF4 : 0xF5);
+ break;
+ }
+}
+
void
mousectl(Cmdbuf *cb)
{
@@ -274,27 +281,37 @@
ct = lookupcmd(cb, mousectlmsg, nelem(mousectlmsg));
switch(ct->index){
case CMaccelerated:
+ setstream(0);
setaccelerated(cb->nf == 1 ? 1 : atoi(cb->f[1]));
+ setstream(1);
break;
case CMintellimouse:
+ setstream(0);
setintellimouse();
+ setstream(1);
break;
case CMlinear:
+ setstream(0);
setlinear();
+ setstream(1);
break;
case CMps2:
intellimouse = 0;
ps2mouse();
+ setstream(1);
break;
case CMps2intellimouse:
ps2mouse();
setintellimouse();
+ setstream(1);
break;
case CMres:
+ setstream(0);
if(cb->nf >= 2)
setres(atoi(cb->f[1]));
else
setres(1);
+ setstream(1);
break;
case CMreset:
resetmouse();
@@ -304,6 +321,7 @@
setres(resolution);
if(intellimouse)
setintellimouse();
+ setstream(1);
break;
case CMserial:
if(mousetype == Mouseserial)
--
⑨