From b069d3488f327da97fb0da1939518a00637f01a3 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 15 Jul 2011 15:52:33 +0200 Subject: hid: move idle+protocol from usb-hid to hid too. Signed-off-by: Gerd Hoffmann --- hw/hid.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hw/hid.c') diff --git a/hw/hid.c b/hw/hid.c index 1893ae5..7b5ef5f 100644 --- a/hw/hid.c +++ b/hw/hid.c @@ -24,6 +24,7 @@ */ #include "hw.h" #include "console.h" +#include "qemu-timer.h" #include "hid.h" #define HID_USAGE_ERROR_ROLLOVER 0x01 @@ -73,6 +74,11 @@ bool hid_has_events(HIDState *hs) return hs->n > 0; } +void hid_set_next_idle(HIDState *hs, int64_t curtime) +{ + hs->next_idle_clock = curtime + (get_ticks_per_sec() * hs->idle * 4) / 1000; +} + static void hid_pointer_event_clear(HIDPointerEvent *e, int buttons) { e->xdx = e->ydy = e->dz = 0; @@ -365,6 +371,8 @@ void hid_reset(HIDState *hs) } hs->head = 0; hs->n = 0; + hs->protocol = 1; + hs->idle = 0; } void hid_free(HIDState *hs) -- cgit v1.1