diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index 8580b80d65..6c9d4a4ee8 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -44,6 +44,7 @@ typedef struct wiiu_input { bool blocked; const input_device_driver_t *joypad; + const hid_driver_t *hid_joypad; } wiiu_input_t; void kb_connection_callback(KBDKeyEvent *key) @@ -120,8 +121,13 @@ static void wiiu_input_poll(void *data) { wiiu_input_t *wiiu = (wiiu_input_t*)data; - if (wiiu && wiiu->joypad) - wiiu->joypad->poll(); + if(!wiiu) + return; + + if(wiiu->joypad) + wiiu->joypad->poll(); + if(wiiu->hid_joypad) + wiiu->hid_joypad->poll(); } static bool wiiu_key_pressed(int key) @@ -175,6 +181,12 @@ static void wiiu_input_free_input(void *data) if (wiiu && wiiu->joypad) wiiu->joypad->destroy(); + if (wiiu && wiiu->hid_joypad) + { + wiiu->hid_joypad->free(hid_driver_get_data()); + hid_driver_reset_data(); + } + KBDTeardown(); free(data); @@ -188,6 +200,7 @@ static void* wiiu_input_init(const char *joypad_driver) DEBUG_STR(joypad_driver); wiiu->joypad = input_joypad_init_driver(joypad_driver, wiiu); + wiiu->hid_joypad = input_hid_init_first(); KBDSetup(&kb_connection_callback, &kb_disconnection_callback,&kb_key_callback); diff --git a/input/drivers_joypad/wiiu_joypad.c b/input/drivers_joypad/wiiu_joypad.c index 3a08305c37..4fb667c34d 100644 --- a/input/drivers_joypad/wiiu_joypad.c +++ b/input/drivers_joypad/wiiu_joypad.c @@ -43,8 +43,6 @@ #define GAMEPAD_OFFSET 0 -static const hid_driver_t *hid_driver = NULL; - static uint64_t pad_state[MAX_PADS]; static uint8_t pad_type[MAX_PADS-1] = {WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE, WIIUINPUT_TYPE_NONE}; @@ -301,7 +299,6 @@ static void wiiu_joypad_poll(void) static bool wiiu_joypad_init(void* data) { - hid_driver = input_hid_init_first(); wiiu_joypad_autodetect_add(0); wiiu_joypad_poll(); @@ -318,11 +315,6 @@ static bool wiiu_joypad_query_pad(unsigned pad) static void wiiu_joypad_destroy(void) { - if(hid_driver) { - hid_driver->free(hid_driver_get_data()); - hid_driver_reset_data(); - hid_driver = NULL; - } wiiu_pad_inited = false; } diff --git a/input/input_driver.h b/input/input_driver.h index bffc934816..b30436410f 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -192,8 +192,11 @@ struct hid_driver void (*poll)(void *); bool (*set_rumble)(void *, unsigned, enum retro_rumble_effect, uint16_t); const char *(*name)(void *, unsigned); - const char *ident; + int32_t (*set_report)(void *, uint8_t, uint8_t, void *, uint32_t); + int32_t (*set_idle)(void *, uint8_t, uint8_t); + int32_t (*set_protocol)(void *, uint8_t, uint8_t); + }; /**