aboutsummaryrefslogtreecommitdiff
path: root/hw/input/hid.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2017-03-30 16:22:55 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-05-03 14:20:12 +0200
commit2222e0a633070f7f3eafcc9d0e95e7f1a4e6fe36 (patch)
treee62c1786a56a538634df34d725c09b4c50a884a5 /hw/input/hid.c
parent05c6638b203fd7d8bbfa88ac6e6198e32ed0506f (diff)
downloadqemu-2222e0a633070f7f3eafcc9d0e95e7f1a4e6fe36.zip
qemu-2222e0a633070f7f3eafcc9d0e95e7f1a4e6fe36.tar.gz
qemu-2222e0a633070f7f3eafcc9d0e95e7f1a4e6fe36.tar.bz2
input: Add trace event for empty keyboard queue
When driving QEMU from the outside, we have basically no chance to determine how quickly the guest OS picks up key events, so we usually have to limit ourselves to very slow keyboard presses to make sure the guest always has enough chance to pick them up. This patch adds a trace events when the keyboarde queue is drained. An external driver can use that as hint that new keys can be pressed. Signed-off-by: Alexander Graf <agraf@suse.de> Message-id: 1490883775-94658-1-git-send-email-agraf@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/input/hid.c')
-rw-r--r--hw/input/hid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/input/hid.c b/hw/input/hid.c
index fa9cc4c..93887ec 100644
--- a/hw/input/hid.c
+++ b/hw/input/hid.c
@@ -256,6 +256,10 @@ static void hid_keyboard_process_keycode(HIDState *hs)
slot = hs->head & QUEUE_MASK; QUEUE_INCR(hs->head); hs->n--;
keycode = hs->kbd.keycodes[slot];
+ if (!hs->n) {
+ trace_hid_kbd_queue_empty();
+ }
+
key = keycode & 0x7f;
index = key | ((hs->kbd.modifiers & (1 << 8)) >> 1);
hid_code = hid_usage_keys[index];