From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFeoj-0005zu-3s for qemu-devel@nongnu.org; Mon, 07 May 2018 08:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFeod-0005x7-UG for qemu-devel@nongnu.org; Mon, 07 May 2018 08:00:33 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:49496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFeod-0005tL-Jn for qemu-devel@nongnu.org; Mon, 07 May 2018 08:00:27 -0400 Received: from www1.hostfission.com (www1.hostfission.com [139.99.139.52]) by mail1.hostfission.com (Postfix) with ESMTP id E43FD43ED6 for ; Mon, 7 May 2018 22:00:22 +1000 (AEST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 07 May 2018 22:00:22 +1000 From: geoff@hostfission.com Message-ID: Subject: [Qemu-devel] [PATCH 1/2] ps2: Clear the queue on PS/2 mouse reset and obey device disable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This allows guest's to correctly reinitialize and identify the mouse should the guest decide to re-scan or reset during mouse input events. Signed-off-by: Geoffrey McRae --- hw/input/ps2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 06f5d2ac4a..6edf046820 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -673,6 +673,9 @@ static void ps2_mouse_sync(DeviceState *dev) { PS2MouseState *s = (PS2MouseState *)dev; + if (!(s->mouse_status & MOUSE_STATUS_ENABLED)) + return; + if (s->mouse_buttons) { qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); } @@ -776,6 +779,7 @@ void ps2_write_mouse(void *opaque, int val) s->mouse_resolution = 2; s->mouse_status = 0; s->mouse_type = 0; + ps2_reset_queue(&s->common); ps2_queue(&s->common, AUX_ACK); ps2_queue(&s->common, 0xaa); ps2_queue(&s->common, s->mouse_type); -- 2.14.2