From patchwork Fri Mar 25 16:10:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 8672441 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0513DC0553 for ; Fri, 25 Mar 2016 16:10:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6160E202F0 for ; Fri, 25 Mar 2016 16:10:30 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id BBA72202A1 for ; Fri, 25 Mar 2016 16:10:29 +0000 (UTC) Received: from localhost ([::1]:56940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajUJh-0002Lb-3H for patchwork-qemu-devel@patchwork.kernel.org; Fri, 25 Mar 2016 12:10:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajUJY-0002IX-08 for qemu-devel@nongnu.org; Fri, 25 Mar 2016 12:10:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajUJT-00029J-1J for qemu-devel@nongnu.org; Fri, 25 Mar 2016 12:10:19 -0400 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]:33664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajUJS-00029C-Sq for qemu-devel@nongnu.org; Fri, 25 Mar 2016 12:10:14 -0400 Received: by mail-io0-x243.google.com with SMTP id v187so12952438ioe.0 for ; Fri, 25 Mar 2016 09:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:subject:date:message-id:to :mime-version; bh=LJLz3lg8I0fVyegAZfz59SPz5UEg0tRqbKj7Wh7V1U4=; b=d06CuqeF0Bxe4J/OKLMztRNHzITYVDOmkuiVLB/fQZ1QpADa/HgYFqdcn0YdLQHX4n yI2QafN6dCbGKkwMjOMXOJkwQVr/IjVFEHGJAcCEF4WoZInVoctYdi/ycaSb3M1C2qdZ 7WQc1sPaFEHziZj7T7D9Pg8cOth9QkeEnGOqX2uOY6rW+XdOGu988ZE1S9wwK4HYrGzh PZq5K8BEKl8Sq/+cwokyRdg98FCFohzbJ5h6TlKCwqo5hvCeaVDe6LwIj5S7aaGy5380 x7U3JbkDzGmvip01X4silzTLuOjIQR/gPIeq9R6BSjbiLKFz7BRtoBJYHY72T+kIFuzh dHlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:subject:date :message-id:to:mime-version; bh=LJLz3lg8I0fVyegAZfz59SPz5UEg0tRqbKj7Wh7V1U4=; b=gybY+m7dxoQF1aJeKWEPVN/MddmIOyOOZO49oye5gKYx64+XlW0wL0OoBvY32Vp3qM Vg6UTLdQ2Jd3xsOta9r0l6q77xqxCym52sowqyLIiQ2BtC8u3bpbXF13pQhgWq/2c+nQ OCEaDIdQ+eVmSnvmSiUWT4epUBrYuoT58xRLpPw3ktwpYYjG38KjCvjqDOtTG09po8oL 82K+d3ZMuO9btYwULxYrzy6eZK3Xqks0QQxjelhsZR20hi0usEZkZC0NnFCNuAGaj+RO oIeXxEVK8QqmXTdkkLMc1azLSweisv3vNjW593GafGzmD+MwbgURIPSeSkGCJvsXzvnf 5PNg== X-Gm-Message-State: AD7BkJIP/f+08u5xZK2QBw3xUtben5MpKRnFCDIqBJGpRQ4VfltHpwupBXjcLGTC7q9ABw== X-Received: by 10.107.10.103 with SMTP id u100mr15191508ioi.50.1458922214506; Fri, 25 Mar 2016 09:10:14 -0700 (PDT) Received: from [192.168.0.5] (d199-74-164-53.col.wideopenwest.com. [74.199.53.164]) by smtp.gmail.com with ESMTPSA id y190sm5218310iod.14.2016.03.25.09.10.13 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Mar 2016 09:10:13 -0700 (PDT) From: Programmingkid Date: Fri, 25 Mar 2016 12:10:13 -0400 Message-Id: <7A168ABF-EB8A-43E5-9821-F4D8AD9B6E53@gmail.com> To: Peter Maydell , Gerd Hoffmann , qemu-devel qemu-devel Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c06::243 Subject: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 329a27b..42ca592 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));