diff options
| author | 2020-06-25 19:31:51 -0400 | |
|---|---|---|
| committer | 2020-06-25 19:31:51 -0400 | |
| commit | 3f739514e3fa5f3e5c64fa8172c796bd686f6e7d (patch) | |
| tree | 2f17eff571c07555cf23e5fb6b68449873ed1666 | |
| parent | padbutton enum class and struct initiailization (diff) | |
| download | yuzu-3f739514e3fa5f3e5c64fa8172c796bd686f6e7d.tar.gz yuzu-3f739514e3fa5f3e5c64fa8172c796bd686f6e7d.tar.xz yuzu-3f739514e3fa5f3e5c64fa8172c796bd686f6e7d.zip | |
Stop reading loop if error is encountered
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index bba9bcc69..173b5c325 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp | |||
| @@ -95,7 +95,7 @@ void Adapter::Read() { | |||
| 95 | 95 | ||
| 96 | while (adapter_thread_running) { | 96 | while (adapter_thread_running) { |
| 97 | libusb_interrupt_transfer(usb_adapter_handle, input_endpoint, adapter_payload.data(), | 97 | libusb_interrupt_transfer(usb_adapter_handle, input_endpoint, adapter_payload.data(), |
| 98 | sizeof(adapter_payload), &payload_size_in, 32); | 98 | sizeof(adapter_payload), &payload_size_in, 16); |
| 99 | payload_size_copy = 0; | 99 | payload_size_copy = 0; |
| 100 | { | 100 | { |
| 101 | std::lock_guard<std::mutex> lk(s_mutex); | 101 | std::lock_guard<std::mutex> lk(s_mutex); |
| @@ -106,9 +106,9 @@ void Adapter::Read() { | |||
| 106 | 106 | ||
| 107 | if (payload_size_copy != sizeof(adapter_payload_copy) || | 107 | if (payload_size_copy != sizeof(adapter_payload_copy) || |
| 108 | adapter_payload_copy[0] != LIBUSB_DT_HID) { | 108 | adapter_payload_copy[0] != LIBUSB_DT_HID) { |
| 109 | // TODO: It might be worthwhile to Shutdown GC Adapter if we encounter errors here | ||
| 110 | LOG_ERROR(Input, "error reading payload (size: %d, type: %02x)", payload_size_copy, | 109 | LOG_ERROR(Input, "error reading payload (size: %d, type: %02x)", payload_size_copy, |
| 111 | adapter_payload_copy[0]); | 110 | adapter_payload_copy[0]); |
| 111 | adapter_thread_running = false; // error reading from adapter, stop reading. | ||
| 112 | } else { | 112 | } else { |
| 113 | for (int port = 0; port < pads.size(); port++) { | 113 | for (int port = 0; port < pads.size(); port++) { |
| 114 | pads[port] = GetPadStatus(port, adapter_payload_copy); | 114 | pads[port] = GetPadStatus(port, adapter_payload_copy); |
| @@ -291,14 +291,14 @@ void Adapter::Reset() { | |||
| 291 | 291 | ||
| 292 | if (adapter_thread_running) { | 292 | if (adapter_thread_running) { |
| 293 | adapter_thread_running = false; | 293 | adapter_thread_running = false; |
| 294 | adapter_input_thread.join(); | ||
| 295 | } | 294 | } |
| 295 | adapter_input_thread.join(); | ||
| 296 | 296 | ||
| 297 | adapter_controllers_status.fill(ControllerTypes::None); | 297 | adapter_controllers_status.fill(ControllerTypes::None); |
| 298 | current_status = NO_ADAPTER_DETECTED; | 298 | current_status = NO_ADAPTER_DETECTED; |
| 299 | 299 | ||
| 300 | if (usb_adapter_handle) { | 300 | if (usb_adapter_handle) { |
| 301 | libusb_release_interface(usb_adapter_handle, 0); | 301 | libusb_release_interface(usb_adapter_handle, 1); |
| 302 | libusb_close(usb_adapter_handle); | 302 | libusb_close(usb_adapter_handle); |
| 303 | usb_adapter_handle = nullptr; | 303 | usb_adapter_handle = nullptr; |
| 304 | } | 304 | } |