PS2 mouse issues
Posted: Tue Mar 15, 2005 5:16 pm
Hi all...
i can remember of people on this forum talking about a "buggy" mouse that was getting out of synch after a few times ... it happen to occur to me while integrating SANiK&Whyme's mouse driver in clicker video server 0.1 ... on bochs and real hardware, everything was fine, but on qemu, it occured to have buttons info read as byte 1 instead of byte 0.
The trick i found to fix this is to use the fact that byte 0 is supposed to have bit 3 always set. So when i receive a byte that is supposed to be #0 with bit 3 cleared, i simply discard it and assume byte 0 will come next. As long as you're on synch, this is completely transparent, and when the mouse comes out of synch, only a few events are sufficient to restore synchronization (especially fast with steady clicks)
i can remember of people on this forum talking about a "buggy" mouse that was getting out of synch after a few times ... it happen to occur to me while integrating SANiK&Whyme's mouse driver in clicker video server 0.1 ... on bochs and real hardware, everything was fine, but on qemu, it occured to have buttons info read as byte 1 instead of byte 0.
The trick i found to fix this is to use the fact that byte 0 is supposed to have bit 3 always set. So when i receive a byte that is supposed to be #0 with bit 3 cleared, i simply discard it and assume byte 0 will come next. As long as you're on synch, this is completely transparent, and when the mouse comes out of synch, only a few events are sufficient to restore synchronization (especially fast with steady clicks)