From nobody Sun Nov 24 09:47:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=quarantine dis=none) header.from=pullman.com ARC-Seal: i=1; a=rsa-sha256; t=1724109556; cv=none; d=zohomail.com; s=zohoarc; b=mlLcgBlgaDB8drSkG4j27ylXqfk+ksyGeMm980W9LQTqJGfTXI4kihLoWgenTxkMIqnSAUz/qacncUYJHUAzk4+M42voj3ntmN/XFc6SDOwamZSZ+2QEk52MX70+tXnseB+jXWo1mhtjm2HuUi29elUKDMeXkrsV7EeUNwJFTxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724109556; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=4nK1yXULlVUlPzlUmNI6v169jmuG0uyg1zsAs5CH1Xc=; b=DkxcGDONjkDp1X3/1MwF92KiPTVjnvum0hdbAZwfK1nIUgp6seCposUOsy0TWLpGGCwCy5rtl7EZzka4lMfP3pgMyesqCPDlrLTuoH9xQ0fZex+bQg7YeXfx9ZK92B6fGphy264Nm6pRDM7TYyWmyWvmq16QI3FyRm9TuwRDJRI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1724109555555133.06278269057077; Mon, 19 Aug 2024 16:19:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgBdr-0005g3-AL; Mon, 19 Aug 2024 19:18:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgBdm-0005fP-Pf for qemu-devel@nongnu.org; Mon, 19 Aug 2024 19:18:23 -0400 Received: from secure.fsr.com ([64.126.132.23]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgBdk-0003ww-Py for qemu-devel@nongnu.org; Mon, 19 Aug 2024 19:18:22 -0400 Received: from [192.168.254.26] (syn-098-146-201-045.res.spectrum.com [98.146.201.45]) (Authenticated sender: chauser) by secure.fsr.com (Postfix) with ESMTPSA id 8F9DE345EA; Mon, 19 Aug 2024 16:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pullman.com; s=mail1; t=1724109487; bh=4nK1yXULlVUlPzlUmNI6v169jmuG0uyg1zsAs5CH1Xc=; h=Date:From:Subject:To; b=InTZUFT6XLCmoCzl8rV2oDI6X2TJB0Bk1i+LQpJJAB6ZOMmU+xr4XqlCEtp9bfdob tnGaN9cs4qGLZoQlqDAOTdav0pSBi5wepmubR/YdLFTLLA+YHVFPK836ivVOKek6id POtDCYD4DKsJinf1phg4Sa7Ug4t8Ac+jNoGDkKlc= Message-ID: Date: Mon, 19 Aug 2024 16:18:06 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB From: Carl Hauser Subject: [PATCH] hw/char: suppress sunmouse events with no changes To: =?UTF-8?Q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , qemu-devel@nongnu.org Content-Transfer-Encoding: quoted-printable 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: pass client-ip=64.126.132.23; envelope-from=chauser@pullman.com; helo=secure.fsr.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @pullman.com) X-ZM-MESSAGEID: 1724109559068116600 Content-Type: text/plain; charset="utf-8"; format="flowed" From f155cbd57b37fa600c580ed30d593f47383ecd38 Mon Sep 17 00:00:00 2001 From: Carl Hauser Date: Fri, 16 Aug 2024 09:20:36 -0700 Subject: [PATCH] hw/char: suppress sunmouse events with no changes Sun optical mice circa 1993 were based on the Mouse Systems Corp. optical mice. The technical manual for those mice states that mice only send events when there is motion or the button state changes. The Solaris 2.5.6 mouse driver seems to be confused by updates that don't follow this specification. This patch adds a field to the ESCCChannelState to contain the button state sent in the last event and uses that in sunmouse_event to avoid sending unnecessary updates. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2518 Signed-off-by: Carl Hauser --- hw/char/escc.c | 10 ++++++++++ include/hw/char/escc.h | 1 + 2 files changed, 11 insertions(+) diff --git a/hw/char/escc.c b/hw/char/escc.c index d450d70eda..7732141cf5 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -287,6 +287,7 @@ static void escc_reset_chn(ESCCChannelState *s) s->rxint =3D s->txint =3D 0; s->rxint_under_svc =3D s->txint_under_svc =3D 0; s->e0_mode =3D s->led_mode =3D s->caps_lock_mode =3D s->num_lock_mode= =3D 0; + s->sunmouse_prev_state =3D 0; clear_queue(s); } @@ -959,6 +960,15 @@ static void sunmouse_event(void *opaque, int ch; trace_escc_sunmouse_event(dx, dy, buttons_state); + + /* Don't send duplicate events without motion */ + if (dx =3D=3D 0 && + dy =3D=3D 0 && + (s->sunmouse_prev_state ^ buttons_state) =3D=3D 0) { + return; + } + s->sunmouse_prev_state =3D buttons_state; + ch =3D 0x80 | 0x7; /* protocol start byte, no buttons pressed */ if (buttons_state & MOUSE_EVENT_LBUTTON) { diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h index 5669a5b811..bc5ba4f564 100644 --- a/include/hw/char/escc.h +++ b/include/hw/char/escc.h @@ -46,6 +46,7 @@ typedef struct ESCCChannelState { uint8_t rx, tx; QemuInputHandlerState *hs; char *sunkbd_layout; + int sunmouse_prev_state; } ESCCChannelState; struct ESCCState { --=20 2.34.1