mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-27 03:12:02 +00:00
@@ -83,20 +83,21 @@ void Joycons::ScanThread(std::stop_token stop_token) {
|
|||||||
constexpr u16 nintendo_vendor_id = 0x057e;
|
constexpr u16 nintendo_vendor_id = 0x057e;
|
||||||
Common::SetCurrentThreadName("JoyconScanThread");
|
Common::SetCurrentThreadName("JoyconScanThread");
|
||||||
|
|
||||||
|
auto last_ret = 0u;
|
||||||
do {
|
do {
|
||||||
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
|
auto ret = SDL_hid_device_change_count();
|
||||||
SDL_hid_device_info* cur_dev = devs;
|
if (last_ret == 0u || last_ret != ret) {
|
||||||
|
last_ret = ret;
|
||||||
while (cur_dev) {
|
SDL_hid_device_info* devs = SDL_hid_enumerate(nintendo_vendor_id, 0x0);
|
||||||
if (IsDeviceNew(cur_dev)) {
|
for (auto* cur_dev = devs; cur_dev; cur_dev = cur_dev->next) {
|
||||||
LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id,
|
if (IsDeviceNew(cur_dev)) {
|
||||||
cur_dev->product_id);
|
LOG_DEBUG(Input, "Device Found,type : {:04X} {:04X}", cur_dev->vendor_id, cur_dev->product_id);
|
||||||
RegisterNewDevice(cur_dev);
|
RegisterNewDevice(cur_dev);
|
||||||
|
}
|
||||||
|
cur_dev = cur_dev->next;
|
||||||
}
|
}
|
||||||
cur_dev = cur_dev->next;
|
SDL_hid_free_enumeration(devs);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_hid_free_enumeration(devs);
|
|
||||||
} while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5}));
|
} while (Common::StoppableTimedWait(stop_token, std::chrono::seconds{5}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user