summaryrefslogtreecommitdiffstats
path: root/src/input_common/helpers/joycon_protocol/common_protocol.h
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2023-01-14 06:29:05 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-01-20 07:51:45 +0100
commit340f15d1fa79594dbe12a6e19140ba012751b533 (patch)
tree7a9ef54a17f927e4b8cf98dd32dd6d41c0d75201 /src/input_common/helpers/joycon_protocol/common_protocol.h
parentcore: hid: Only set the polling mode to the correct side (diff)
downloadyuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.gz
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.bz2
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.lz
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.xz
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.tar.zst
yuzu-340f15d1fa79594dbe12a6e19140ba012751b533.zip
Diffstat (limited to 'src/input_common/helpers/joycon_protocol/common_protocol.h')
-rw-r--r--src/input_common/helpers/joycon_protocol/common_protocol.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.h b/src/input_common/helpers/joycon_protocol/common_protocol.h
index 2a3feaf59..903bcf402 100644
--- a/src/input_common/helpers/joycon_protocol/common_protocol.h
+++ b/src/input_common/helpers/joycon_protocol/common_protocol.h
@@ -75,11 +75,18 @@ public:
DriverResult SendSubCommand(SubCommand sc, std::span<const u8> buffer, std::vector<u8>& output);
/**
+ * Sends a sub command to the device and waits for it's reply and ignores the output
+ * @param sc sub command to be send
+ * @param buffer data to be send
+ */
+ DriverResult SendSubCommand(SubCommand sc, std::span<const u8> buffer);
+
+ /**
* Sends a mcu command to the device
* @param sc sub command to be send
* @param buffer data to be send
*/
- DriverResult SendMcuCommand(SubCommand sc, std::span<const u8> buffer);
+ DriverResult SendMCUCommand(SubCommand sc, std::span<const u8> buffer);
/**
* Sends vibration data to the joycon
@@ -150,4 +157,17 @@ private:
std::shared_ptr<JoyconHandle> hidapi_handle;
};
+class ScopedSetBlocking {
+public:
+ explicit ScopedSetBlocking(JoyconCommonProtocol* self) : m_self{self} {
+ m_self->SetBlocking();
+ }
+
+ ~ScopedSetBlocking() {
+ m_self->SetNonBlocking();
+ }
+
+private:
+ JoyconCommonProtocol* m_self{};
+};
} // namespace InputCommon::Joycon