aboutsummaryrefslogtreecommitdiff
path: root/hw/hid.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-12-14 14:35:38 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-01-07 12:57:24 +0100
commit027c03f7327faa696e1d876954a18b5214c18583 (patch)
treee3cf765c7fddf3304ec994ab0dead4e5fc665289 /hw/hid.h
parent9fdf70272702095f57efc51a80c79493fd0829b8 (diff)
hid: Change idle handling to use a timer
This leads to cleaner code in usb-hid, and removes up to a 1000 calls / sec to qemu_get_clock_ns(vm_clock) if idle-time is set to its default value of 0. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/hid.h')
-rw-r--r--hw/hid.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/hid.h b/hw/hid.h
index 100b121663..56c71ed5ae 100644
--- a/hw/hid.h
+++ b/hw/hid.h
@@ -43,7 +43,8 @@ struct HIDState {
int kind;
int32_t protocol;
uint8_t idle;
- int64_t next_idle_clock;
+ bool idle_pending;
+ QEMUTimer *idle_timer;
HIDEventFunc event;
};
@@ -52,7 +53,7 @@ void hid_reset(HIDState *hs);
void hid_free(HIDState *hs);
bool hid_has_events(HIDState *hs);
-void hid_set_next_idle(HIDState *hs, int64_t curtime);
+void hid_set_next_idle(HIDState *hs);
void hid_pointer_activate(HIDState *hs);
int hid_pointer_poll(HIDState *hs, uint8_t *buf, int len);
int hid_keyboard_poll(HIDState *hs, uint8_t *buf, int len);