mirror of https://github.com/PCSX2/pcsx2.git
USB: Remove unused HID data
This commit is contained in:
parent
3a55653c3e
commit
15dfc0496e
|
@ -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)
|
||||
|
@ -532,10 +501,10 @@ static void hid_keyboard_process_keycode(HIDState* hs)
|
|||
if (hs->kbd.modifiers & (1 << 9))
|
||||
{
|
||||
/* The hid_codes for the 0xe1/0x1d scancode sequence are 0xe9/0xe0.
|
||||
* Here we're processing the second hid_code. By dropping bit 9
|
||||
* and setting bit 8, the scancode after 0x1d will access the
|
||||
* second half of the table.
|
||||
*/
|
||||
* Here we're processing the second hid_code. By dropping bit 9
|
||||
* and setting bit 8, the scancode after 0x1d will access the
|
||||
* second half of the table.
|
||||
*/
|
||||
hs->kbd.modifiers ^= (1 << 8) | (1 << 9);
|
||||
return;
|
||||
}
|
||||
|
@ -550,8 +519,8 @@ static void hid_keyboard_process_keycode(HIDState* hs)
|
|||
case 0xe6:
|
||||
case 0xe7:
|
||||
/* Ctrl_L/Ctrl_R, Shift_L/Shift_R, Alt_L/Alt_R, Win_L/Win_R.
|
||||
* Handle releases here, or fall through to process presses.
|
||||
*/
|
||||
* Handle releases here, or fall through to process presses.
|
||||
*/
|
||||
if (keycode & (1 << 7))
|
||||
{
|
||||
hs->kbd.modifiers &= ~(1 << (hid_code & 0x0f));
|
||||
|
@ -561,11 +530,11 @@ static void hid_keyboard_process_keycode(HIDState* hs)
|
|||
case 0xe8:
|
||||
case 0xe9:
|
||||
/* USB modifiers are just 1 byte long. Bits 8 and 9 of
|
||||
* hs->kbd.modifiers implement a state machine that detects the
|
||||
* 0xe0 and 0xe1/0x1d sequences. These bits do not follow the
|
||||
* usual rules where bit 7 marks released keys; they are cleared
|
||||
* elsewhere in the function as the state machine dictates.
|
||||
*/
|
||||
* hs->kbd.modifiers implement a state machine that detects the
|
||||
* 0xe0 and 0xe1/0x1d sequences. These bits do not follow the
|
||||
* usual rules where bit 7 marks released keys; they are cleared
|
||||
* elsewhere in the function as the state machine dictates.
|
||||
*/
|
||||
hs->kbd.modifiers |= 1 << (hid_code & 0x0f);
|
||||
return;
|
||||
|
||||
|
@ -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)
|
||||
|
|
|
@ -312,7 +312,6 @@ struct HIDState
|
|||
int kind;
|
||||
int32_t protocol;
|
||||
uint8_t idle;
|
||||
bool idle_pending;
|
||||
HIDEventFunc event;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue