From patchwork Mon May 7 12:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10383939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B7BF560236 for ; Mon, 7 May 2018 12:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC42528AF6 for ; Mon, 7 May 2018 12:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FA2D28AF9; Mon, 7 May 2018 12:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1272E28AF6 for ; Mon, 7 May 2018 12:01:22 +0000 (UTC) Received: from localhost ([::1]:45836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFepV-0006PO-BD for patchwork-qemu-devel@patchwork.kernel.org; Mon, 07 May 2018 08:01:21 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hostfission.com; s=mail; t=1525694422; bh=6F16zVqC84IWS2MVZT3LaKV5v/FX4LGVLg3cEcOA5sA=; h=To:Subject:Date:From:From; b=JhHcvyY4DFCBm4yFSKsecD9Q5bKQmadKJ5z+hZ9MBG57TJoRuvwPm09nNvhQzbq+T o06OBEqpkwqpY9W62VF8ZOmJTQiqQmeUJftv48j5873dDM9aXGiycWJ/pjEuJxWmE6 67cN5o0HIsM5BEsfWYch34MpQxLreKWK8Kg2MBig= Received: by www1.hostfission.com (Postfix, from userid 1000) id DFFC480EE8; Mon, 7 May 2018 22:00:22 +1000 (AEST) To: qemu-devel@nongnu.org X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 Date: Mon, 07 May 2018 22:00:22 +1000 Message-ID: X-Sender: geoff@hostfission.com User-Agent: Roundcube Webmail/1.2.3 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] [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: geoff--- via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: geoff@hostfission.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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);