From patchwork Mon May 7 11:42:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cameron Esfahani via X-Patchwork-Id: 909727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nongnu.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=hostfission.com header.i=@hostfission.com header.b="jXQpr9ov"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fhmV3hDlz9s34 for ; Mon, 7 May 2018 22:30:49 +1000 (AEST) Received: from localhost ([::1]:45951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFfHz-0005w8-12 for incoming@patchwork.ozlabs.org; Mon, 07 May 2018 08:30:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFfHa-0005vq-5n for qemu-devel@nongnu.org; Mon, 07 May 2018 08:30:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFfHU-0003sg-DE for qemu-devel@nongnu.org; Mon, 07 May 2018 08:30:22 -0400 Received: from mail1.hostfission.com ([139.99.139.48]:49812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFfHU-0003s2-3t for qemu-devel@nongnu.org; Mon, 07 May 2018 08:30:16 -0400 Received: from moya.office.hostfission.com (office.hostfission.com [158.140.217.90]) by mail1.hostfission.com (Postfix) with ESMTP id D594741ED8; Mon, 7 May 2018 22:30:14 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1525696214; bh=E293WIvQgpDMS/yUdi2o+LFeS7Bksx/HiSty2kVVj1Q=; h=From:Date:Subject:To:From; b=jXQpr9ovpIIaQYX189b6mKUJtFlUysHGXBcztiBtYdJLqUuhwBSVqtAoCK3ytKR/z I1zrTfsjMdi8c3sV2NpyblKx0PWAu2Bq2NKi9TrUQtLKTU0+qbdMGxedGdkZhLFst4 8r+O9OJ85WtoHITrOWFXQ0T4W0lSY9c7eMnbbfgY= Received: by moya.office.hostfission.com (Postfix, from userid 0) id C67BE3818FB; Mon, 7 May 2018 22:30:14 +1000 (AEST) Date: Mon, 7 May 2018 21:42:10 +1000 To: qemu-devel@nongnu.org Message-Id: <20180507123014.C67BE3818FB@moya.office.hostfission.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 139.99.139.48 Subject: [Qemu-devel] (resend)[PATCH 1/2] ps2: Clear the queue on PS/2 mouse reset and obey device disable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Geoffrey McRae via Qemu-devel From: Cameron Esfahani via Reply-To: Geoffrey McRae Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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);