summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorR <rqou@berkeley.edu>2023-09-07 00:37:01 +0100
committerR <rqou@berkeley.edu>2023-09-07 19:56:58 +0100
commit860acfb15dbdf7d3589c0d687af543dc7d70b2fc (patch)
tree82f7b8c568d36f9e79b4e009fa1843ca027bc5c0 /Source/Core/InputCommon/ControllerInterface
parentc0440df2882e09e87efae199cdef28669d7c85ef (diff)
Steam Deck: Periodically reenable gyro
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp b/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp
index cfdf3e9649..0a0dc88387 100644
--- a/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp
@@ -118,6 +118,7 @@ public:
private:
hid_device* m_device;
DeckInputReport m_latest_input;
+ int m_gyro_reenable = 0;
};
class InputBackend final : public ciface::InputBackend
@@ -280,6 +281,24 @@ std::string Device::GetSource() const
void Device::UpdateInput()
{
+ // As of a certain mid-2023 update to the Steam client,
+ // Steam will disable gyro data if gyro is not mapped in Steam Input.
+ // This disabling will happen every time the Steam overlay is closed.
+ // This command turns gyro data back on periodically.
+ if (++m_gyro_reenable == 250)
+ {
+ m_gyro_reenable = 0;
+ // Using names from Valve's contribution to SDL for the Steam Controller
+ // (and assuming this has not changed for the Deck), this packet decodes as:
+ // 0x00 = report ID
+ // 0x87 = ID_SET_SETTINGS_VALUES
+ // 0x03 = payload length
+ // 0x30 = SETTING_GYRO_MODE
+ // 0x18 0x00 = SETTING_GYRO_MODE_SEND_RAW_ACCEL | SETTING_GYRO_MODE_SEND_RAW_GYRO
+ const unsigned char pkt[] = {0x00, 0x87, 0x03, 0x30, 0x18, 0x00};
+ hid_send_feature_report(m_device, pkt, sizeof(pkt));
+ }
+
DeckInputReport rpt;
bool got_anything = false;
// Read all available input reports (processing only the most recent one).