summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-01-02 11:07:06 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-01-02 11:07:06 +0100
commitd1be5e163c98c99b3b610dc5f4715455d506ba22 (patch)
treef2dc76d29698dc339b7aecc670a17f1f6792bf2b
parente56affb840a369ccca365ce6f0c83a55b99224bc (diff)
downloadplan9front-d1be5e163c98c99b3b610dc5f4715455d506ba22.tar.xz
ps2mouse: retry disable packet streaming command 0xf5
disabling mouse packet streaming command 0xf5 can fail when a packet is currently transmitted. this can be seen when one moves the mouse while running: while(){echo accelerated >/dev/mousectl; sleep 0.5}
-rw-r--r--sys/src/9/pc/mouse.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/src/9/pc/mouse.c b/sys/src/9/pc/mouse.c
index 5113f8899..0519e5e76 100644
--- a/sys/src/9/pc/mouse.c
+++ b/sys/src/9/pc/mouse.c
@@ -260,9 +260,19 @@ resetmouse(void)
static void
setstream(int on)
{
+ int i;
+
switch(mousetype){
case MousePS2:
- i8042auxcmd(on ? 0xF4 : 0xF5);
+ /*
+ * disabling streaming can fail when
+ * a packet is currently transmitted.
+ */
+ for(i=0; i<4; i++){
+ if(i8042auxcmd(on ? 0xF4 : 0xF5) != -1)
+ break;
+ delay(50);
+ }
break;
}
}