summary refs log tree commit diff stats
path: root/hw/hid.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/hid.c')
-rw-r--r--hw/hid.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/hid.c b/hw/hid.c
index 1893ae59f0..7b5ef5fc92 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)