From patchwork Mon Apr 11 03:06:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 8796181 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 9817EC0553 for ; Mon, 11 Apr 2016 03:06:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B412320256 for ; Mon, 11 Apr 2016 03:06:18 +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 DC1F7201F5 for ; Mon, 11 Apr 2016 03:06:17 +0000 (UTC) Received: from localhost ([::1]:44628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apSB7-0007tj-8t for patchwork-qemu-devel@patchwork.kernel.org; Sun, 10 Apr 2016 23:06:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apSAz-0007q9-3q for qemu-devel@nongnu.org; Sun, 10 Apr 2016 23:06:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apSAv-0001CU-QU for qemu-devel@nongnu.org; Sun, 10 Apr 2016 23:06:09 -0400 Received: from mail-ig0-x22a.google.com ([2607:f8b0:4001:c05::22a]:33057) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apSAv-0001CP-LL for qemu-devel@nongnu.org; Sun, 10 Apr 2016 23:06:05 -0400 Received: by mail-ig0-x22a.google.com with SMTP id kb1so72209075igb.0 for ; Sun, 10 Apr 2016 20:06:05 -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:cc:to :mime-version; bh=tQ5vI9mwHOD7TEzl/fRe+O5+o4WJNjzFFkCa6QzkSbI=; b=OT8ueUJmsX7x6TJXKlaPUClv5w+tu1i9B7cLEVt5dGVMm4lP0HEw46ew3qzrx7pXB3 Gp74dmdAj9OPr459/bZowcP2F1wjUoHzqCTxDQ2lgwaeUonSW29dYGOETEqhbfxK7cHF GiTab7LAa7c6RedesOLjA0LIFWZ4ogPuyRhyaUAae7lQgeqejcY8avDeLsJMNiIQzw2X R1IXIYCSWeGRLYgAWP/YgP5dNzWK0Pi51lMVdFJK6wOcrpPBokNYJT+/q2tHB064V3Xa 0qfUe9u2ILJv7QOJ9bN2Llk4JA/Q3M4sD2MtRoF1tLVKtHtdG2AODI21W4wGZkbbdNVD jDig== 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:cc:to:mime-version; bh=tQ5vI9mwHOD7TEzl/fRe+O5+o4WJNjzFFkCa6QzkSbI=; b=ACzUnzBOdQUxzGHdb6OGVZJqxJ3anjsYJEsity1sednp+L0F/42ZvNI48+zWL1/7iP HzKB4GxjzDzkDNXRvYw+9Hp90Ot6jLGzomd2g2cl6uSEsvd1YIAy8vKDkA2hBKbnKG3l 8CpCsP5VR1xrjys6zE9jwpO9fn3ppJZqvuzM568YfmmJ3UvCa7Gq1FzbgF91TBHzuvfu L29E6Si5sazuEbmo7qphSeheNrSlabVtK8EcicHI2ecFhIsPTWSYjZvVc0WMsGpwUl16 IyUvL5XJzSjLsHxdaJjJy6vZDrcdOfRydYvBJLBsWfSYsuEWm9JGKxeR6j/KVCKXqOyy qJ7g== X-Gm-Message-State: AD7BkJL2EnBpkLE2LDZofum8tEkmw6MtZHdIjXiNFHvkIF+xS5Q/0GYI869IlXddDxl50A== X-Received: by 10.50.22.65 with SMTP id b1mr15526587igf.39.1460343965172; Sun, 10 Apr 2016 20:06:05 -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 m143sm15886393ioe.43.2016.04.10.20.06.04 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 10 Apr 2016 20:06:04 -0700 (PDT) From: Programmingkid Date: Sun, 10 Apr 2016 23:06:03 -0400 Message-Id: To: Peter Maydell , Gerd Hoffmann , Eric Blake 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:c05::22a Subject: [Qemu-devel] ping [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: qemu-devel qemu-devel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 https://patchwork.ozlabs.org/patch/602037/ 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));