From bf9706395db9e5b4208f3846acd827b0b3435dcd Mon Sep 17 00:00:00 2001 From: gblues Date: Sat, 4 Dec 2021 03:43:58 -0800 Subject: [PATCH] Fix gamepad disconnect on unrecognized HID device (#13321) == DETAILS So, the reason the gamepad was getting deregistered was because adapter free code wasn't properly handling null-interface adapters, causing the gamepad to match erroneously and get deregistered. This doesn't fix the weird "Generic SNES USB" detection issue, but it should make it non-fatal. Co-authored-by: Nathan Strong --- input/drivers_hid/wiiu_hid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/input/drivers_hid/wiiu_hid.c b/input/drivers_hid/wiiu_hid.c index 3a91612f8a..b86dcf7bbb 100644 --- a/input/drivers_hid/wiiu_hid.c +++ b/input/drivers_hid/wiiu_hid.c @@ -469,7 +469,10 @@ static void synchronized_process_adapters(wiiu_hid_t *hid) else prev->next = adapter->next; - pad_connection_pad_deregister(joypad_state.pads, adapter->pad_driver, adapter->pad_driver_data); + if(adapter->pad_driver && adapter->pad_driver_data) + { + pad_connection_pad_deregister(joypad_state.pads, adapter->pad_driver, adapter->pad_driver_data); + } /* adapter is no longer valid after this point */ delete_adapter(adapter); /* signal not to update prev ptr since adapter is now invalid */