summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/GCAdapter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
-rw-r--r--Source/Core/InputCommon/GCAdapter.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp
index cacb73bc79..6088256a55 100644
--- a/Source/Core/InputCommon/GCAdapter.cpp
+++ b/Source/Core/InputCommon/GCAdapter.cpp
@@ -203,9 +203,8 @@ static void ReadThreadFunc()
std::array<u8, CONTROLER_INPUT_PAYLOAD_EXPECTED_SIZE> input_buffer;
int payload_size = 0;
- const int error =
- libusb_interrupt_transfer(s_handle, s_endpoint_in, input_buffer.data(),
- int(input_buffer.size()), &payload_size, USB_TIMEOUT_MS);
+ int error = libusb_interrupt_transfer(s_handle, s_endpoint_in, input_buffer.data(),
+ int(input_buffer.size()), &payload_size, USB_TIMEOUT_MS);
if (error != LIBUSB_SUCCESS)
{
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Read: libusb_interrupt_transfer failed: {}",
@@ -213,7 +212,16 @@ static void ReadThreadFunc()
}
if (error == LIBUSB_ERROR_IO)
{
- break;
+ // s_read_adapter_thread_running is cleared by the joiner, not the stopper.
+
+ // Reset the device, which may trigger a replug.
+ error = libusb_reset_device(s_handle);
+ ERROR_LOG_FMT(CONTROLLERINTERFACE, "Read: libusb_reset_device: {}",
+ LibusbUtils::ErrorWrap(error));
+ if (error != 0)
+ {
+ break;
+ }
}
ProcessInputPayload(input_buffer.data(), payload_size);