diff options
Diffstat (limited to 'src')
4 files changed, 21 insertions, 0 deletions
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index 4159e5717..3775e2d35 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp | |||
| @@ -86,6 +86,7 @@ DriverResult JoyconDriver::InitializeDevice() { | |||
| 86 | 86 | ||
| 87 | // Get fixed joycon info | 87 | // Get fixed joycon info |
| 88 | generic_protocol->GetVersionNumber(version); | 88 | generic_protocol->GetVersionNumber(version); |
| 89 | generic_protocol->SetLowPowerMode(false); | ||
| 89 | generic_protocol->GetColor(color); | 90 | generic_protocol->GetColor(color); |
| 90 | if (handle_device_type == ControllerType::Pro) { | 91 | if (handle_device_type == ControllerType::Pro) { |
| 91 | // Some 3rd party controllers aren't pro controllers | 92 | // Some 3rd party controllers aren't pro controllers |
| @@ -324,6 +325,8 @@ DriverResult JoyconDriver::SetPollingMode() { | |||
| 324 | if (result != DriverResult::Success) { | 325 | if (result != DriverResult::Success) { |
| 325 | LOG_ERROR(Input, "Error enabling active mode"); | 326 | LOG_ERROR(Input, "Error enabling active mode"); |
| 326 | } | 327 | } |
| 328 | // Switch calls this function after enabling active mode | ||
| 329 | generic_protocol->TriggersElapsed(); | ||
| 327 | 330 | ||
| 328 | disable_input_thread = false; | 331 | disable_input_thread = false; |
| 329 | return result; | 332 | return result; |
diff --git a/src/input_common/helpers/joycon_protocol/generic_functions.cpp b/src/input_common/helpers/joycon_protocol/generic_functions.cpp index 52bb8b61a..63cfb1369 100644 --- a/src/input_common/helpers/joycon_protocol/generic_functions.cpp +++ b/src/input_common/helpers/joycon_protocol/generic_functions.cpp | |||
| @@ -19,6 +19,17 @@ DriverResult GenericProtocol::EnableActiveMode() { | |||
| 19 | return SetReportMode(ReportMode::STANDARD_FULL_60HZ); | 19 | return SetReportMode(ReportMode::STANDARD_FULL_60HZ); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | DriverResult GenericProtocol::SetLowPowerMode(bool enable) { | ||
| 23 | ScopedSetBlocking sb(this); | ||
| 24 | const std::array<u8, 1> buffer{static_cast<u8>(enable ? 1 : 0)}; | ||
| 25 | return SendSubCommand(SubCommand::LOW_POWER_MODE, buffer); | ||
| 26 | } | ||
| 27 | |||
| 28 | DriverResult GenericProtocol::TriggersElapsed() { | ||
| 29 | ScopedSetBlocking sb(this); | ||
| 30 | return SendSubCommand(SubCommand::TRIGGERS_ELAPSED, {}); | ||
| 31 | } | ||
| 32 | |||
| 22 | DriverResult GenericProtocol::GetDeviceInfo(DeviceInfo& device_info) { | 33 | DriverResult GenericProtocol::GetDeviceInfo(DeviceInfo& device_info) { |
| 23 | ScopedSetBlocking sb(this); | 34 | ScopedSetBlocking sb(this); |
| 24 | std::vector<u8> output; | 35 | std::vector<u8> output; |
diff --git a/src/input_common/helpers/joycon_protocol/generic_functions.h b/src/input_common/helpers/joycon_protocol/generic_functions.h index 239bb7dbf..424831e81 100644 --- a/src/input_common/helpers/joycon_protocol/generic_functions.h +++ b/src/input_common/helpers/joycon_protocol/generic_functions.h | |||
| @@ -25,6 +25,12 @@ public: | |||
| 25 | /// Enables active mode. This mode will return the current status every 5-15ms | 25 | /// Enables active mode. This mode will return the current status every 5-15ms |
| 26 | DriverResult EnableActiveMode(); | 26 | DriverResult EnableActiveMode(); |
| 27 | 27 | ||
| 28 | /// Enables or disables the low power mode | ||
| 29 | DriverResult SetLowPowerMode(bool enable); | ||
| 30 | |||
| 31 | /// Unknown function used by the switch | ||
| 32 | DriverResult TriggersElapsed(); | ||
| 33 | |||
| 28 | /** | 34 | /** |
| 29 | * Sends a request to obtain the joycon firmware and mac from handle | 35 | * Sends a request to obtain the joycon firmware and mac from handle |
| 30 | * @returns controller device info | 36 | * @returns controller device info |
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h index e2d47349f..182d2c15b 100644 --- a/src/input_common/helpers/joycon_protocol/joycon_types.h +++ b/src/input_common/helpers/joycon_protocol/joycon_types.h | |||
| @@ -129,6 +129,7 @@ enum class SubCommand : u8 { | |||
| 129 | LOW_POWER_MODE = 0x08, | 129 | LOW_POWER_MODE = 0x08, |
| 130 | SPI_FLASH_READ = 0x10, | 130 | SPI_FLASH_READ = 0x10, |
| 131 | SPI_FLASH_WRITE = 0x11, | 131 | SPI_FLASH_WRITE = 0x11, |
| 132 | SPI_SECTOR_ERASE = 0x12, | ||
| 132 | RESET_MCU = 0x20, | 133 | RESET_MCU = 0x20, |
| 133 | SET_MCU_CONFIG = 0x21, | 134 | SET_MCU_CONFIG = 0x21, |
| 134 | SET_MCU_STATE = 0x22, | 135 | SET_MCU_STATE = 0x22, |