ref: 3329b228e210943e68dc8dcce79c3a2f1a87af4d
parent: f4e7db8080c78e41d659538a86a43d59fc9eaddd
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 2 06:07:06 EST 2014
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}
--- a/sys/src/9/pc/mouse.c
+++ b/sys/src/9/pc/mouse.c
@@ -260,9 +260,19 @@
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;
}
}
--
⑨