From patchwork Thu Jun 30 21:32:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 9208983 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 E75606075A for ; Thu, 30 Jun 2016 21:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD12128564 for ; Thu, 30 Jun 2016 21:35:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1E0D2868C; Thu, 30 Jun 2016 21:35:30 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 3556928564 for ; Thu, 30 Jun 2016 21:35:27 +0000 (UTC) Received: from localhost ([::1]:52692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIjcK-0007mO-Ht for patchwork-qemu-devel@patchwork.kernel.org; Thu, 30 Jun 2016 17:35:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIjbn-0007lt-KE for qemu-devel@nongnu.org; Thu, 30 Jun 2016 17:34:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIjbm-0001Ty-JF for qemu-devel@nongnu.org; Thu, 30 Jun 2016 17:34:51 -0400 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]:33264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIjbm-0001Tu-EZ for qemu-devel@nongnu.org; Thu, 30 Jun 2016 17:34:50 -0400 Received: by mail-it0-x241.google.com with SMTP id y93so312013ita.0 for ; Thu, 30 Jun 2016 14:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nHNJl/NS+eZJB6D6TwgQXGDTkekqSToNnBa3Mj0FmpI=; b=on8lfxQKrBQO4HBVG/5dp6Eo4DgSBAlCIgC9Qk5jf0+EED5RWS+deAJTWS63ZS4aOd TR7nozQC7/gRu32qR55kbuvimI0/F5Yb/umqbspMBelPFj9SFvFPz7BAuOycs6Co6tcc KaGJi0xcFGNEKSZ6iJpCudVQXAyrGswWryymKRlNrdeitlpGS38tolg4fOG1VexyuDaz mxP0pHLUcMj2K8hBskSAfsQckIUsR1PkP9rh0LrH3tHI5UJ20rNv2jcieODcMUkX2lju /bYV/3hY+gJ4DIVCO6cZk4khaOmQVnZFju6uFrsx3fwGTrmN4gGWgTMKPSRK2+EK9UXB 5fQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nHNJl/NS+eZJB6D6TwgQXGDTkekqSToNnBa3Mj0FmpI=; b=b84dLFr55D1fMpayjYRCbnrX5Z0T2ctpCT8TGcfsviWFa/2pj4zMA1O7kqNGTpCbeM Yq8ic9UoYI/Ifi73qJmF5aAcHiub3URBYHDIri1zC4/Ex0cKjXc0Fsjy9nUvB4HssC2K WSi5z5i0pLBifreb8t2ehuiN2zAI2hykQy/tQW59mBBSeBXkEWEZEJZcXHS52M74C5JN Q698RgslO2e1c3/NZoy/Esq4B2e1D8F9RAJcj/ni9lj8K8axBy1Y7NMKKdJQMlx6H48U NRMFsbD4ZPVg74se8a578wzmWlD/DRUqVj28fSm3K53Mzytx8LgfEbud/zVOaIdx4TK8 TrMw== X-Gm-Message-State: ALyK8tJAEpL8SMX+7NNoaQRHY8wTvt1WpqNu6s7NBUPkrTTjx0oMSs50lGo27xm4b1c4TA== X-Received: by 10.36.41.16 with SMTP id p16mr18235488itp.60.1467322490102; Thu, 30 Jun 2016 14:34:50 -0700 (PDT) Received: from localhost.localdomain (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id w78sm802610ita.3.2016.06.30.14.34.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Jun 2016 14:34:49 -0700 (PDT) From: John Arbuckle To: eblake@redhat.com, qemu-devel@nongnu.org Date: Thu, 30 Jun 2016 17:32:20 -0400 Message-Id: <1467322340-25602-4-git-send-email-programmingkidx@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1467322340-25602-1-git-send-email-programmingkidx@gmail.com> References: <1467322340-25602-1-git-send-email-programmingkidx@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::241 Subject: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support 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: , Cc: John Arbuckle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add debug macros to the code for easier debugging. Signed-off-by: John Arbuckle --- hw/input/hid.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/input/hid.c b/hw/input/hid.c index 3e1b46e..efe703e 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -37,6 +37,13 @@ #define RELEASED -1 #define PUSHED -2 +/* #define DEBUG_HID_CODE */ +#ifdef DEBUG_HID_CODE + #define DEBUG_HID(fmt, ...) printf(fmt, __VA_ARGS__) +#else + #define DEBUG_HID(fmt, ...) (void)0 +#endif + /* Translates a QKeyCode to USB HID value */ static const uint8_t qcode_to_usb_hid[] = { [Q_KEY_CODE_SHIFT] = USB_HID_LEFT_SHIFT, @@ -331,6 +338,7 @@ static void hid_keyboard_event(DeviceState *dev, QemuConsole *src, return; } keycode = qcode_to_usb_hid[qcode]; + DEBUG_HID("keycode = 0x%x qcode:%d\n", keycode, qcode); count = 2; if (evt->u.key.data->down == false) { /* if key up event */ @@ -381,6 +389,9 @@ static void hid_keyboard_process_keycode(HIDState *hs) slot = hs->head & QUEUE_MASK; QUEUE_INCR(hs->head); hs->n--; keycode = hs->kbd.keycodes[slot]; + DEBUG_HID("keycode:0x%x status:%s\n", keycode, (status == PUSHED ? "Pushed" + : "Released")); + /* handle Control, Option, GUI/Windows/Command, and Shift keys */ if (keycode >= 0xe0) { process_modifier_key(status, keycode, &(hs->kbd.modifiers));