USB: Remove unused HID data

This commit is contained in:
Florin9doi 2024-07-27 11:38:02 +03:00 committed by lightningterror
parent 3a55653c3e
commit 15dfc0496e
3 changed files with 12 additions and 55 deletions

View File

@ -302,42 +302,11 @@ static const uint8_t hid_usage_keys[0x100] = {
bool hid_has_events(HIDState* hs)
{
return hs->n > 0 || hs->idle_pending;
}
#if 0
// Unused
static void hid_idle_timer(void* opaque)
{
HIDState* hs = (HIDState*)opaque;
hs->idle_pending = true;
hs->event(hs);
}
#endif
static void hid_del_idle_timer(HIDState* hs)
{
/*if (hs->idle_timer) {
timer_del(hs->idle_timer);
timer_free(hs->idle_timer);
hs->idle_timer = NULL;
}*/
return hs->n > 0;
}
void hid_set_next_idle(HIDState* hs)
{
/*if (hs->idle) {
uint64_t expire_time = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
NANOSECONDS_PER_SECOND * hs->idle * 4 / 1000;
if (!hs->idle_timer) {
hs->idle_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, hid_idle_timer, hs);
}
timer_mod_ns(hs->idle_timer, expire_time);
}
else {
hid_del_idle_timer(hs);
}*/
}
static void hid_pointer_event(HIDState* hs, InputEvent* evt)
@ -641,7 +610,6 @@ void hid_pointer_activate(HIDState* hs)
{
if (!hs->ptr.mouse_grabbed)
{
//qemu_input_handler_activate(hs->s);
hs->ptr.mouse_grabbed = 1;
}
}
@ -652,8 +620,6 @@ int hid_pointer_poll(HIDState* hs, uint8_t* buf, int len)
int index;
HIDPointerEvent* e;
hs->idle_pending = false;
hid_pointer_activate(hs);
/* When the buffer is empty, return the last event. Relative
@ -745,8 +711,6 @@ int hid_pointer_poll(HIDState* hs, uint8_t* buf, int len)
int hid_keyboard_poll(HIDState* hs, uint8_t* buf, int len)
{
hs->idle_pending = false;
if (len < 2)
{
return 0;
@ -817,14 +781,10 @@ void hid_reset(HIDState* hs)
hs->n = 0;
hs->protocol = 1;
hs->idle = 0;
hs->idle_pending = false;
hid_del_idle_timer(hs);
}
void hid_free(HIDState* hs)
{
//qemu_input_handler_unregister(hs->s);
hid_del_idle_timer(hs);
}
void hid_init(HIDState* hs, int kind, HIDEventFunc event)

View File

@ -312,7 +312,6 @@ struct HIDState
int kind;
int32_t protocol;
uint8_t idle;
bool idle_pending;
HIDEventFunc event;
};

View File

@ -851,7 +851,6 @@ namespace usb_hid
sw.Do(&s->hid.n);
sw.Do(&s->hid.protocol);
sw.Do(&s->hid.idle);
sw.Do(&s->hid.idle_pending);
return !sw.HasError();
}
@ -914,7 +913,6 @@ namespace usb_hid
sw.Do(&s->hid.n);
sw.Do(&s->hid.protocol);
sw.Do(&s->hid.idle);
sw.Do(&s->hid.idle_pending);
return !sw.HasError();
}