summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/sdl_driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
-rw-r--r--src/input_common/drivers/sdl_driver.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 4818bb744..c9496a0d8 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -318,6 +318,14 @@ void SDLDriver::InitJoystick(int joystick_index) {
318 318
319 const auto guid = GetGUID(sdl_joystick); 319 const auto guid = GetGUID(sdl_joystick);
320 320
321 if (Settings::values.enable_joycon_driver) {
322 if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e) {
323 LOG_ERROR(Input, "Device black listed {}", joystick_index);
324 SDL_JoystickClose(sdl_joystick);
325 return;
326 }
327 }
328
321 std::scoped_lock lock{joystick_map_mutex}; 329 std::scoped_lock lock{joystick_map_mutex};
322 if (joystick_map.find(guid) == joystick_map.end()) { 330 if (joystick_map.find(guid) == joystick_map.end()) {
323 auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller); 331 auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller);
@@ -440,9 +448,14 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
440 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); 448 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
441 SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); 449 SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
442 450
443 // Use hidapi driver for joycons. This will allow joycons to be detected as a GameController and 451 // Disable hidapi drivers for switch controllers when the custom joycon driver is enabled
444 // not a generic one 452 if (Settings::values.enable_joycon_driver) {
445 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); 453 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0");
454 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0");
455 } else {
456 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
457 SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1");
458 }
446 459
447 // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native 460 // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native
448 // driver on Linux. 461 // driver on Linux.