summaryrefslogtreecommitdiff
path: root/src/input_common/helpers/joycon_protocol/ringcon.cpp
diff options
context:
space:
mode:
authorGravatar german772022-12-23 08:32:02 -0600
committerGravatar Narr the Reg2023-01-19 18:05:22 -0600
commite1a3bda4d9881cb99c36b64733b814a3bb437f13 (patch)
treea9c0d864b023a810f48c129bb8bd6e84afb2ed2b /src/input_common/helpers/joycon_protocol/ringcon.cpp
parentcore: hid: Fix input regressions (diff)
downloadyuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.gz
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.tar.xz
yuzu-e1a3bda4d9881cb99c36b64733b814a3bb437f13.zip
Address review comments
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/ringcon.cpp')
-rw-r--r--src/input_common/helpers/joycon_protocol/ringcon.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/input_common/helpers/joycon_protocol/ringcon.cpp b/src/input_common/helpers/joycon_protocol/ringcon.cpp
index 47769f344..8adad57dd 100644
--- a/src/input_common/helpers/joycon_protocol/ringcon.cpp
+++ b/src/input_common/helpers/joycon_protocol/ringcon.cpp
@@ -7,7 +7,7 @@
7namespace InputCommon::Joycon { 7namespace InputCommon::Joycon {
8 8
9RingConProtocol::RingConProtocol(std::shared_ptr<JoyconHandle> handle) 9RingConProtocol::RingConProtocol(std::shared_ptr<JoyconHandle> handle)
10 : JoyconCommonProtocol(handle) {} 10 : JoyconCommonProtocol(std::move(handle)) {}
11 11
12DriverResult RingConProtocol::EnableRingCon() { 12DriverResult RingConProtocol::EnableRingCon() {
13 LOG_DEBUG(Input, "Enable Ringcon"); 13 LOG_DEBUG(Input, "Enable Ringcon");
@@ -78,7 +78,7 @@ DriverResult RingConProtocol::IsRingConnected(bool& is_connected) {
78 is_connected = false; 78 is_connected = false;
79 79
80 do { 80 do {
81 std::vector<u8> empty_data(0); 81 std::array<u8, 1> empty_data{};
82 const auto result = SendSubCommand(SubCommand::UNKNOWN_RINGCON, empty_data, output); 82 const auto result = SendSubCommand(SubCommand::UNKNOWN_RINGCON, empty_data, output);
83 83
84 if (result != DriverResult::Success) { 84 if (result != DriverResult::Success) {
@@ -101,11 +101,11 @@ DriverResult RingConProtocol::ConfigureRing() {
101 std::vector<u8> output; 101 std::vector<u8> output;
102 std::size_t tries = 0; 102 std::size_t tries = 0;
103 103
104 static constexpr std::array<u8, 37> ring_config{
105 0x06, 0x03, 0x25, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x16, 0xED, 0x34, 0x36,
106 0x00, 0x00, 0x00, 0x0A, 0x64, 0x0B, 0xE6, 0xA9, 0x22, 0x00, 0x00, 0x04, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0xA8, 0xE1, 0x34, 0x36};
104 do { 108 do {
105 std::vector<u8> ring_config{0x06, 0x03, 0x25, 0x06, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x16,
106 0xED, 0x34, 0x36, 0x00, 0x00, 0x00, 0x0A, 0x64, 0x0B, 0xE6,
107 0xA9, 0x22, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x00, 0x00, 0x90, 0xA8, 0xE1, 0x34, 0x36};
109 result = SendSubCommand(SubCommand::UNKNOWN_RINGCON3, ring_config, output); 109 result = SendSubCommand(SubCommand::UNKNOWN_RINGCON3, ring_config, output);
110 110
111 if (result != DriverResult::Success) { 111 if (result != DriverResult::Success) {
@@ -116,13 +116,13 @@ DriverResult RingConProtocol::ConfigureRing() {
116 } 116 }
117 } while (output[14] != 0x5C); 117 } while (output[14] != 0x5C);
118 118
119 std::vector<u8> ringcon_data{0x04, 0x01, 0x01, 0x02}; 119 static constexpr std::array<u8, 4> ringcon_data{0x04, 0x01, 0x01, 0x02};
120 result = SendSubCommand(SubCommand::UNKNOWN_RINGCON2, ringcon_data, output); 120 result = SendSubCommand(SubCommand::UNKNOWN_RINGCON2, ringcon_data, output);
121 121
122 return result; 122 return result;
123} 123}
124 124
125bool RingConProtocol::IsEnabled() { 125bool RingConProtocol::IsEnabled() const {
126 return is_enabled; 126 return is_enabled;
127} 127}
128 128