I've had trouble with the serial mouse driver on a k6/400/linux-2.4.16
box, the patch below fixes this.
The problem is that the second read() would always fail silently
with EAGAIN when there is no new data on /dev/ttyS0 yet.
Instead of waiting for the packet to complete, I chose to return to
the select loop, like the other mouse drivers do.
Tested on one machine with both MS and logitech compatible
mouses.
Arnd <><
--- input/serialmouse.c.orig Tue Jan 8 14:30:41 2002
+++ input/serialmouse.c Tue Jan 8 14:50:46 2002
@@ -89,22 +89,26 @@
int serialmouse_fd_activate(int fd) {
u8 buttons;
s8 dx,dy;
- u8 packet[3];
+ static u8 packet[3];
+ static int pos;
s16 cursorx,cursory;
if (fd != mouse_fd)
return 0;
/* Read a correctly-aligned mouse packet. If the first byte isn't 0x40,
- * it isn't correctly aligned. The mouse packet is 4 bytes long.
+ * it isn't correctly aligned. The mouse packet is 3 or 4 bytes long.
+ * On fast machines, we can't read a whole packet at once, so we have
+ * to maintain the state in a static variable.
*/
- if (!read(mouse_fd,packet,1))
+ if (read(mouse_fd,packet+pos,1) != 1)
return 1;
if (!(packet[0] & 0x40))
return 1;
- if (!read(mouse_fd,packet+1,2))
+ if (pos++ < 2)
return 1;
+ pos = 0;
/* Get the cursor position in physical coordinates */
cursorx = cursor->x;
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel