diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/drivers/joycon.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index 40cda400d..cedc94e63 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/param_package.h" | 6 | #include "common/param_package.h" |
| 7 | #include "common/polyfill_ranges.h" | 7 | #include "common/polyfill_ranges.h" |
| 8 | #include "common/polyfill_thread.h" | ||
| 8 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| 9 | #include "common/thread.h" | 10 | #include "common/thread.h" |
| 10 | #include "input_common/drivers/joycon.h" | 11 | #include "input_common/drivers/joycon.h" |
| @@ -67,7 +68,8 @@ void Joycons::Setup() { | |||
| 67 | void Joycons::ScanThread(std::stop_token stop_token) { | 68 | void Joycons::ScanThread(std::stop_token stop_token) { |
| 68 | constexpr u16 nintendo_vendor_id = 0x057e; | 69 | constexpr u16 nintendo_vendor_id = 0x057e; |
| 69 | Common::SetCurrentThreadName("JoyconScanThread"); | 70 | Common::SetCurrentThreadName("JoyconScanThread"); |
| 70 | while (!stop_token.stop_requested()) { | 71 | |
| 72 | do { | ||
| 71 | SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); | 73 | SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0); |
| 72 | SDL_hid_device_info* cur_dev = devs; | 74 | SDL_hid_device_info* cur_dev = devs; |
| 73 | 75 | ||
| @@ -81,8 +83,7 @@ void Joycons::ScanThread(std::stop_token stop_token) { | |||
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | SDL_hid_free_enumeration(devs); | 85 | SDL_hid_free_enumeration(devs); |
| 84 | std::this_thread::sleep_for(std::chrono::seconds(5)); | 86 | } while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5})); |
| 85 | } | ||
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const { | 89 | bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const { |