summaryrefslogtreecommitdiff
path: root/src/input_common/helpers/joycon_driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/helpers/joycon_driver.cpp')
-rw-r--r--src/input_common/helpers/joycon_driver.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp
index 040832a4b..e8aef028a 100644
--- a/src/input_common/helpers/joycon_driver.cpp
+++ b/src/input_common/helpers/joycon_driver.cpp
@@ -262,6 +262,16 @@ DriverResult JoyconDriver::SetPollingMode() {
262 irs_protocol->DisableIrs(); 262 irs_protocol->DisableIrs();
263 } 263 }
264 264
265 if (nfc_protocol->IsEnabled()) {
266 amiibo_detected = false;
267 nfc_protocol->DisableNfc();
268 }
269
270 if (ring_protocol->IsEnabled()) {
271 ring_connected = false;
272 ring_protocol->DisableRingCon();
273 }
274
265 if (irs_enabled && supported_features.irs) { 275 if (irs_enabled && supported_features.irs) {
266 auto result = irs_protocol->EnableIrs(); 276 auto result = irs_protocol->EnableIrs();
267 if (result == DriverResult::Success) { 277 if (result == DriverResult::Success) {
@@ -272,11 +282,6 @@ DriverResult JoyconDriver::SetPollingMode() {
272 LOG_ERROR(Input, "Error enabling IRS"); 282 LOG_ERROR(Input, "Error enabling IRS");
273 } 283 }
274 284
275 if (nfc_protocol->IsEnabled()) {
276 amiibo_detected = false;
277 nfc_protocol->DisableNfc();
278 }
279
280 if (nfc_enabled && supported_features.nfc) { 285 if (nfc_enabled && supported_features.nfc) {
281 auto result = nfc_protocol->EnableNfc(); 286 auto result = nfc_protocol->EnableNfc();
282 if (result == DriverResult::Success) { 287 if (result == DriverResult::Success) {
@@ -290,11 +295,6 @@ DriverResult JoyconDriver::SetPollingMode() {
290 LOG_ERROR(Input, "Error enabling NFC"); 295 LOG_ERROR(Input, "Error enabling NFC");
291 } 296 }
292 297
293 if (ring_protocol->IsEnabled()) {
294 ring_connected = false;
295 ring_protocol->DisableRingCon();
296 }
297
298 if (hidbus_enabled && supported_features.hidbus) { 298 if (hidbus_enabled && supported_features.hidbus) {
299 auto result = ring_protocol->EnableRingCon(); 299 auto result = ring_protocol->EnableRingCon();
300 if (result == DriverResult::Success) { 300 if (result == DriverResult::Success) {
@@ -418,6 +418,12 @@ DriverResult JoyconDriver::SetPasiveMode() {
418} 418}
419 419
420DriverResult JoyconDriver::SetActiveMode() { 420DriverResult JoyconDriver::SetActiveMode() {
421 if (is_ring_disabled_by_irs) {
422 is_ring_disabled_by_irs = false;
423 SetActiveMode();
424 return SetRingConMode();
425 }
426
421 std::scoped_lock lock{mutex}; 427 std::scoped_lock lock{mutex};
422 motion_enabled = true; 428 motion_enabled = true;
423 hidbus_enabled = false; 429 hidbus_enabled = false;
@@ -434,6 +440,10 @@ DriverResult JoyconDriver::SetIrMode() {
434 return DriverResult::NotSupported; 440 return DriverResult::NotSupported;
435 } 441 }
436 442
443 if (ring_connected) {
444 is_ring_disabled_by_irs = true;
445 }
446
437 motion_enabled = false; 447 motion_enabled = false;
438 hidbus_enabled = false; 448 hidbus_enabled = false;
439 nfc_enabled = false; 449 nfc_enabled = false;