diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-01-02 07:44:17 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-01-02 07:44:17 +0100 |
commit | e56affb840a369ccca365ce6f0c83a55b99224bc (patch) | |
tree | 4703da40e3cfbdb932b96ea9b3d3ce91e1fe7ce4 | |
parent | 0e242236bada9266fb4d71912edad87c099ba96f (diff) |
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.
-rw-r--r-- | sys/src/9/pc/devkbd.c | 4 | ||||
-rw-r--r-- | sys/src/9/pc/mouse.c | 26 |
2 files changed, 22 insertions, 8 deletions
diff --git a/sys/src/9/pc/devkbd.c b/sys/src/9/pc/devkbd.c index 361dde7b0..db8e477e4 100644 --- a/sys/src/9/pc/devkbd.c +++ b/sys/src/9/pc/devkbd.c @@ -164,10 +164,7 @@ i8042auxcmd(int cmd) { unsigned int c; int tries; - static int badkbd; - if(badkbd) - return -1; c = 0; tries = 0; @@ -191,7 +188,6 @@ i8042auxcmd(int cmd) 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; diff --git a/sys/src/9/pc/mouse.c b/sys/src/9/pc/mouse.c index d5e6386bd..5113f8899 100644 --- a/sys/src/9/pc/mouse.c +++ b/sys/src/9/pc/mouse.c @@ -165,9 +165,7 @@ ps2mouse(void) return; i8042auxenable(ps2mouseputc); - /* make mouse streaming, enabled */ - i8042auxcmd(0xEA); - i8042auxcmd(0xF4); + i8042auxcmd(0xEA); /* set stream mode */ mousetype = MousePS2; packetsize = 3; @@ -255,7 +253,16 @@ resetmouse(void) 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; } } @@ -274,27 +281,37 @@ mousectl(Cmdbuf *cb) 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 @@ mousectl(Cmdbuf *cb) setres(resolution); if(intellimouse) setintellimouse(); + setstream(1); break; case CMserial: if(mousetype == Mouseserial) |