diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 5352e417a4..7a3fb2b9f6 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -646,7 +646,8 @@ void ps2_keyboard_set_translation(void *opaque, int mode) static int ps2_mouse_send_packet(PS2MouseState *s) { - const int needed = 3 + (s->mouse_type - 2); + /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ + const int needed = s->mouse_type ? 4 : 3; unsigned int b; int dx1, dy1, dz1;