From patchwork Thu Aug 11 07:03:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 109566 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 BB995B6F85 for ; Thu, 11 Aug 2011 17:53:10 +1000 (EST) Received: from localhost ([::1]:57905 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrQ4c-0007AT-RM for incoming@patchwork.ozlabs.org; Thu, 11 Aug 2011 03:53:02 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrQ4Y-0007AO-FR for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrQ4X-00089m-Hm for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:52:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21781) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrQ4X-00089c-97 for qemu-devel@nongnu.org; Thu, 11 Aug 2011 03:52:57 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7B7qu8h026085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Aug 2011 03:52:56 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7B73kjX014824; Thu, 11 Aug 2011 03:03:52 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 2A07740408; Thu, 11 Aug 2011 09:03:46 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 11 Aug 2011 09:03:41 +0200 Message-Id: <1313046225-1064-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1313046225-1064-1-git-send-email-kraxel@redhat.com> References: <1313046225-1064-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Michael Walle , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/6] hid: register kbd hander in init() 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 From: Michael Walle Register the keyboard event handler in hid's init() instead of its reset() function. Signed-off-by: Michael Walle Signed-off-by: Gerd Hoffmann --- hw/hid.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/hid.c b/hw/hid.c index 77339f7..3dc4246 100644 --- a/hw/hid.c +++ b/hw/hid.c @@ -364,7 +364,6 @@ void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: - qemu_add_kbd_event_handler(hid_keyboard_event, hs); memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; @@ -398,7 +397,9 @@ void hid_init(HIDState *hs, int kind, HIDEventFunc event) hs->kind = kind; hs->event = event; - if (hs->kind == HID_MOUSE) { + if (hs->kind == HID_KEYBOARD) { + qemu_add_kbd_event_handler(hid_keyboard_event, hs); + } else if (hs->kind == HID_MOUSE) { hs->ptr.eh_entry = qemu_add_mouse_event_handler(hid_pointer_event, hs, 0, "QEMU HID Mouse"); } else if (hs->kind == HID_TABLET) {