From nobody Tue Feb 10 01:32:39 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1620242879; cv=none; d=zohomail.com; s=zohoarc; b=kfKRPVC1vSuZUMiGRsqp2uE1Wln+g/UfsStAeoI4xU9sKfj3xRNnmqEx4VggnAOg69znkxBp+l+erSnPQBpGJt3nwusJL3V40khtHV2c6MZaHVeYyMMQTpTDKJMAk0GMhisI+CXm5HEKOB8LqjeywSE/N7KXj8W5uyEeDqcQ5sM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620242879; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ScpQNdK7sFbciAROLkqi6LkApNRGW7iea1Pq5LLz7wk=; b=maKiiK/rfu0UhNikk/UNhj5CW8gMFL+J/rTLWDGSlid/E8yYodUrhEVmeqfxVuNUX4pbG5N7INe9iHGx+6hLZZ4YGPklGYVxJCFtehGZEcfxoLuNgxnaH0VfwOjE0E1+8nCI+9KUKz5tnntQpHorY/cUdcroFE4Rw6EW9T5bBMo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1620242879421522.4985803412362; Wed, 5 May 2021 12:27:59 -0700 (PDT) Received: from localhost ([::1]:33652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leNBe-0006VF-Cp for importer@patchew.org; Wed, 05 May 2021 15:27:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leN73-0002Fb-LV for qemu-devel@nongnu.org; Wed, 05 May 2021 15:23:15 -0400 Received: from mailout05.t-online.de ([194.25.134.82]:35714) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leN6x-0007ob-IM for qemu-devel@nongnu.org; Wed, 05 May 2021 15:23:13 -0400 Received: from fwd33.aul.t-online.de (fwd33.aul.t-online.de [172.20.27.144]) by mailout05.t-online.de (Postfix) with SMTP id 8A05851FB0; Wed, 5 May 2021 21:21:37 +0200 (CEST) Received: from linpower.localnet (STiHxOZ1Yh4vhV4eklg09pmglcqt5zbQTSKLzVpU+0ePoKrhcV02Jg9zlEbbn8xgNT@[46.86.52.8]) by fwd33.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1leN5S-0FzrPM0; Wed, 5 May 2021 21:21:34 +0200 Received: by linpower.localnet (Postfix, from userid 1000) id E8210200469; Wed, 5 May 2021 21:21:33 +0200 (CEST) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: "Michael S. Tsirkin" , Paolo Bonzini Subject: [PATCH 01/10] ps2: fix mouse stream corruption Date: Wed, 5 May 2021 21:21:24 +0200 Message-Id: <20210505192133.7480-1-vr_qemu@t-online.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ID: STiHxOZ1Yh4vhV4eklg09pmglcqt5zbQTSKLzVpU+0ePoKrhcV02Jg9zlEbbn8xgNT X-TOI-EXPURGATEID: 150726::1620242494-00013209-BAB7E192/0/0 CLEAN NORMAL X-TOI-MSGID: 4e81bb8b-aadd-4358-8943-a2c07cd79fee Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=194.25.134.82; envelope-from=volker.ruemelin@t-online.de; helo=mailout05.t-online.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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=C3=BCmelin --- 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 72cdb80ae1..d9f79e8260 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -645,7 +645,8 @@ void ps2_keyboard_set_translation(void *opaque, int mod= e) =20 static int ps2_mouse_send_packet(PS2MouseState *s) { - const int needed =3D 3 + (s->mouse_type - 2); + /* IMPS/2 and IMEX send 4 bytes, PS2 sends 3 bytes */ + const int needed =3D s->mouse_type ? 4 : 3; unsigned int b; int dx1, dy1, dz1; =20 --=20 2.26.2