Page 1 of 1

Having keyboard+mouse problems in QEMU? It's finally fixed!

Posted: Thu May 27, 2021 6:04 pm
by klange
QEMU has had a bug for quite some time now that caused reliable stream corruption for PS/2 devices due to a race in setting flags and delivering interrupts. It's finally been fixed in git. Coincidentally, the day I posted a bug report detailing it, but not in response to that bug report.

For us hobby OS devs, this was an easy one to suffer from as the combination of a scancode set 1 keyboard driver and the regular PS/2 mouse resulted in all sorts of horrible corruption - move the mouse while typing and the both will suffer in painfully obvious ways; but for OSes with more advanced drivers it was more difficult to observe - especially the combination of the "vmmouse" and scancode set 2 completely masked the issue.

Finally, I can play Quake in QEMU again!

As an aside, just before filing the report - and before the fix was committed - I found a viable guest-side workaround, so if you want a functioning driver even with QEMU's former broken implementation, take a look at misaka's shared ps2 interrupt handler (but do note it relies on functionality you may not find on real devices or other VMs, so best to make it optional or detect QEMU before using it).