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) From: Programmingkid Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 25 Mar 2016 12:10:13 -0400 Message-Id: <7A168ABF-EB8A-43E5-9821-F4D8AD9B6E53@gmail.com> Mime-Version: 1.0 (Apple Message framework v1084) Subject: [Qemu-devel] [PATCH 3/3] hid.c: Add debug support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Gerd Hoffmann , qemu-devel qemu-devel 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 =20 +/* #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[] =3D { [Q_KEY_CODE_SHIFT] =3D USB_HID_LEFT_SHIFT, @@ -331,6 +338,7 @@ static void hid_keyboard_event(DeviceState *dev, = QemuConsole *src, return; } keycode =3D qcode_to_usb_hid[qcode]; + DEBUG_HID("keycode =3D 0x%x qcode:%d\n", keycode, qcode); =20 count =3D 2; if (evt->u.key.data->down =3D=3D false) { /* if key up event */ @@ -381,6 +389,9 @@ static void hid_keyboard_process_keycode(HIDState = *hs) slot =3D hs->head & QUEUE_MASK; QUEUE_INCR(hs->head); hs->n--; keycode =3D hs->kbd.keycodes[slot]; =20 + DEBUG_HID("keycode:0x%x status:%s\n", keycode, (status =3D=3D = PUSHED ? "Pushed" + : "Released")); + /* handle Control, Option, GUI/Windows/Command, and Shift keys */ if (keycode >=3D 0xe0) { process_modifier_key(status, keycode, &(hs->kbd.modifiers)); --=20 2.7.2