From patchwork Wed Jan 11 15:09:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 135429 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B0BFBB6EF7 for ; Thu, 12 Jan 2012 03:55:10 +1100 (EST) Received: from localhost ([::1]:45292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkzo6-000346-OJ for incoming@patchwork.ozlabs.org; Wed, 11 Jan 2012 10:09:42 -0500 Received: from eggs.gnu.org ([140.186.70.92]:43209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkznz-00033q-Sj for qemu-devel@nongnu.org; Wed, 11 Jan 2012 10:09:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkznu-00077w-4J for qemu-devel@nongnu.org; Wed, 11 Jan 2012 10:09:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkznt-00074X-Jf for qemu-devel@nongnu.org; Wed, 11 Jan 2012 10:09:29 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0BF98P5022693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 11 Jan 2012 10:09:08 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0BF97Ie003317; Wed, 11 Jan 2012 10:09:07 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 27BD940E51; Wed, 11 Jan 2012 16:09:05 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 11 Jan 2012 16:09:00 +0100 Message-Id: <1326294541-15080-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1326294541-15080-1-git-send-email-kraxel@redhat.com> References: <1326294541-15080-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [RFC PATCH 4/5] suspend: make ps/2 devices wakeup the guest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch adds wakeup support to ps/2 emulation. Any key press on the ps/2 keyboard will wakeup the guest. Likewise any mouse button press will wakeup the guest. Mouse moves are ignored, so the guest will not wakeup in case your mouse crosses the vnc window of a suspended guest by accident. Signed-off-by: Gerd Hoffmann --- hw/ps2.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/ps2.c b/hw/ps2.c index 1d9057b..d1b2505 100644 --- a/hw/ps2.c +++ b/hw/ps2.c @@ -24,6 +24,7 @@ #include "hw.h" #include "ps2.h" #include "console.h" +#include "sysemu.h" /* debug PC keyboard */ //#define DEBUG_KBD @@ -154,6 +155,7 @@ static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s = opaque; + qemu_system_wakeup_request(); /* XXX: add support for scancode set 1 */ if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) { if (keycode & 0x80) { @@ -368,6 +370,10 @@ static void ps2_mouse_event(void *opaque, return; s->mouse_buttons = buttons_state; + if (buttons_state) { + qemu_system_wakeup_request(); + } + if (!(s->mouse_status & MOUSE_STATUS_REMOTE) && (s->common.queue.count < (PS2_QUEUE_SIZE - 16))) { for(;;) {