qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Volker Rümelin" <vr_qemu@t-online.de>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PULL 02/14] ps2: fix mouse stream corruption
Date: Wed, 26 May 2021 16:06:15 +0200	[thread overview]
Message-ID: <20210526140627.381857-3-kraxel@redhat.com> (raw)
In-Reply-To: <20210526140627.381857-1-kraxel@redhat.com>

From: Volker Rümelin <vr_qemu@t-online.de>

Commit 7abe7eb294 "ps2: Fix mouse stream corruption due to lost data"
added code to avoid mouse stream corruptions but the calculation of
the needed free queue size was wrong. Fix this.

To reproduce, open a text file with the vim 7.3 32 bit for DOS exe-
cutable in a FreeDOS client started with -display sdl and move the
mouse around for a few seconds. You will quickly see erratic mouse
movements and unexpected mouse clicks. CuteMouse (ctmouse.exe) in
FreeDOS doesn't try to re-sync the mouse stream.

Fixes: 7abe7eb294 ("ps2: Fix mouse stream corruption due to lost data")
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20210525181441.27768-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/input/ps2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 5352e417a408..7a3fb2b9f639 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;
 
-- 
2.31.1



  parent reply	other threads:[~2021-05-26 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 14:06 [PULL 00/14] Input 20210526 patches Gerd Hoffmann
2021-05-26 14:06 ` [PULL 01/14] hw/input: expand trace info reported for ps2 device Gerd Hoffmann
2021-05-26 14:06 ` Gerd Hoffmann [this message]
2021-05-26 14:06 ` [PULL 03/14] ps2: don't raise an interrupt if queue is full Gerd Hoffmann
2021-05-26 14:06 ` [PULL 04/14] ps2: don't deassert irq twice if queue is empty Gerd Hoffmann
2021-05-26 14:06 ` [PULL 05/14] pckbd: split out interrupt line changing code Gerd Hoffmann
2021-05-26 14:06 ` [PULL 06/14] pckbd: don't update OBF flags if KBD_STAT_OBF is set Gerd Hoffmann
2021-05-26 14:06 ` [PULL 07/14] pckbd: PS/2 keyboard throttle Gerd Hoffmann
2021-05-26 14:06 ` [PULL 08/14] pckbd: add state variable for interrupt source Gerd Hoffmann
2021-05-26 14:06 ` [PULL 09/14] pckbd: add controller response queue Gerd Hoffmann
2021-05-26 14:06 ` [PULL 10/14] pckbd: add function kbd_pending() Gerd Hoffmann
2021-05-26 14:06 ` [PULL 11/14] pckbd: correctly disable PS/2 communication Gerd Hoffmann
2021-05-26 14:06 ` [PULL 12/14] pckbd: remove duplicated keyboard and mouse defines Gerd Hoffmann
2021-05-26 14:06 ` [PULL 13/14] pckbd: clear outport_present in outer pre_load() Gerd Hoffmann
2021-05-26 14:06 ` [PULL 14/14] hw/input/ps2: Use ps2_raise_irq() instead of open coding it Gerd Hoffmann
2021-05-26 20:04 ` [PULL 00/14] Input 20210526 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210526140627.381857-3-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vr_qemu@t-online.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).