Sync more Steam Controller header definitions for the Steam Deck

main
Vicki Pfau 2023-12-19 17:53:01 -08:00 committed by Sam Lantinga
parent e6e54b22c8
commit a8f4f40d08
5 changed files with 239 additions and 87 deletions

View File

@ -727,7 +727,7 @@ static const char *s_GamepadMappings[] = {
"05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
"05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
"03000000de2800000512000011010000,Steam Deck,a:b3,b:b4,back:b11,dpdown:b17,dpleft:b18,dpright:b19,dpup:b16,guide:b13,leftshoulder:b7,leftstick:b14,lefttrigger:a9,leftx:a0,lefty:a1,misc1:b2,paddle1:b21,paddle2:b20,paddle3:b23,paddle4:b22,rightshoulder:b8,rightstick:b15,righttrigger:a8,rightx:a2,righty:a3,start:b12,x:b5,y:b6,",
"03000000de2800000512000000016800,Steam Deck,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b17,paddle2:b16,paddle3:b19,paddle4:b18,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
"03000000de2800000512000000016800,Steam Deck,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,",
"03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
"0500000011010000311400001b010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b32,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
"05000000110100001914000009010000,SteelSeries Stratus XL,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,leftshoulder:b6,leftstick:b13,lefttrigger:+a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:+a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",

View File

@ -1064,9 +1064,9 @@ static int HIDAPI_DriverSteam_SetSensorsEnabled(SDL_HIDAPI_Device *device, SDL_J
SDL_memset(buf, 0, 65);
buf[1] = ID_SET_SETTINGS_VALUES;
if (enabled) {
ADD_SETTING(SETTING_GYRO_MODE, 0x18 /* SETTING_GYRO_SEND_RAW_ACCEL | SETTING_GYRO_MODE_SEND_RAW_GYRO */);
ADD_SETTING(SETTING_IMU_MODE, SETTING_GYRO_MODE_SEND_RAW_ACCEL | SETTING_GYRO_MODE_SEND_RAW_GYRO);
} else {
ADD_SETTING(SETTING_GYRO_MODE, 0x00 /* SETTING_GYRO_MODE_OFF */);
ADD_SETTING(SETTING_IMU_MODE, SETTING_GYRO_MODE_OFF);
}
buf[2] = (unsigned char)(nSettings * 3);
if (SetFeatureReport(device->dev, buf, 3 + nSettings * 3) < 0) {

View File

@ -32,6 +32,35 @@
#include "steam/controller_constants.h"
#include "steam/controller_structs.h"
typedef enum
{
STEAMDECK_LBUTTON_R2 = 0x00000001,
STEAMDECK_LBUTTON_L2 = 0x00000002,
STEAMDECK_LBUTTON_R = 0x00000004,
STEAMDECK_LBUTTON_L = 0x00000008,
STEAMDECK_LBUTTON_Y = 0x00000010,
STEAMDECK_LBUTTON_B = 0x00000020,
STEAMDECK_LBUTTON_X = 0x00000040,
STEAMDECK_LBUTTON_A = 0x00000080,
STEAMDECK_LBUTTON_DPAD_UP = 0x00000100,
STEAMDECK_LBUTTON_DPAD_RIGHT = 0x00000200,
STEAMDECK_LBUTTON_DPAD_LEFT = 0x00000400,
STEAMDECK_LBUTTON_DPAD_DOWN = 0x00000800,
STEAMDECK_LBUTTON_VIEW = 0x00001000,
STEAMDECK_LBUTTON_STEAM = 0x00002000,
STEAMDECK_LBUTTON_MENU = 0x00004000,
STEAMDECK_LBUTTON_L5 = 0x00008000,
STEAMDECK_LBUTTON_R5 = 0x00010000,
STEAMDECK_LBUTTON_LEFT_PAD = 0x00020000,
STEAMDECK_LBUTTON_RIGHT_PAD = 0x00040000,
STEAMDECK_LBUTTON_L3 = 0x00400000,
STEAMDECK_LBUTTON_R3 = 0x04000000,
STEAMDECK_HBUTTON_L4 = 0x00000200,
STEAMDECK_HBUTTON_R4 = 0x00000400,
STEAMDECK_HBUTTON_QAM = 0x00040000,
} SteamDeckButtons;
typedef struct
{
Uint32 update_rate_us;
@ -53,17 +82,17 @@ static SDL_bool DisableDeckLizardMode(SDL_hid_device *dev)
return SDL_FALSE;
msg->header.type = ID_SET_SETTINGS_VALUES;
msg->header.length = 5 * sizeof(WriteDeckRegister);
msg->payload.wrDeckRegister.reg[0].addr = SETTING_DECK_RPAD_MARGIN; // disable margin
msg->payload.wrDeckRegister.reg[0].val = 0;
msg->payload.wrDeckRegister.reg[1].addr = SETTING_DECK_LPAD_MODE; // disable mouse
msg->payload.wrDeckRegister.reg[1].val = 7;
msg->payload.wrDeckRegister.reg[2].addr = SETTING_DECK_RPAD_MODE; // disable mouse
msg->payload.wrDeckRegister.reg[2].val = 7;
msg->payload.wrDeckRegister.reg[3].addr = SETTING_DECK_LPAD_CLICK_PRESSURE; // disable clicky pad
msg->payload.wrDeckRegister.reg[3].val = 0xFFFF;
msg->payload.wrDeckRegister.reg[4].addr = SETTING_DECK_RPAD_CLICK_PRESSURE; // disable clicky pad
msg->payload.wrDeckRegister.reg[4].val = 0xFFFF;
msg->header.length = 5 * sizeof(ControllerSetting);
msg->payload.setSettingsValues.settings[0].settingNum = SETTING_SMOOTH_ABSOLUTE_MOUSE;
msg->payload.setSettingsValues.settings[0].settingValue = 0;
msg->payload.setSettingsValues.settings[1].settingNum = SETTING_LEFT_TRACKPAD_MODE;
msg->payload.setSettingsValues.settings[1].settingValue = TRACKPAD_NONE;
msg->payload.setSettingsValues.settings[2].settingNum = SETTING_RIGHT_TRACKPAD_MODE; // disable mouse
msg->payload.setSettingsValues.settings[2].settingValue = TRACKPAD_NONE;
msg->payload.setSettingsValues.settings[3].settingNum = SETTING_LEFT_TRACKPAD_CLICK_PRESSURE; // disable clicky pad
msg->payload.setSettingsValues.settings[3].settingValue = 0xFFFF;
msg->payload.setSettingsValues.settings[4].settingNum = SETTING_RIGHT_TRACKPAD_CLICK_PRESSURE; // disable clicky pad
msg->payload.setSettingsValues.settings[4].settingValue = 0xFFFF;
rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer));
if (rc != sizeof(buffer))
@ -89,9 +118,9 @@ static SDL_bool FeedDeckLizardWatchdog(SDL_hid_device *dev)
return SDL_FALSE;
msg->header.type = ID_SET_SETTINGS_VALUES;
msg->header.length = 1 * sizeof(WriteDeckRegister);
msg->payload.wrDeckRegister.reg[0].addr = SETTING_DECK_RPAD_MODE; // disable mouse
msg->payload.wrDeckRegister.reg[0].val = 7;
msg->header.length = 1 * sizeof(ControllerSetting);
msg->payload.setSettingsValues.settings[0].settingNum = SETTING_RIGHT_TRACKPAD_MODE;
msg->payload.setSettingsValues.settings[0].settingValue = TRACKPAD_NONE;
rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer));
if (rc != sizeof(buffer))
@ -229,32 +258,32 @@ static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device)
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_Y) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_LT) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_RT) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_BACK,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_SELECT) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_VIEW) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_START,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_START) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_MENU) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_GUIDE,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_MODE) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_STEAM) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_MISC1,
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_BASE) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_QAM) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_STICKL) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L3) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_STICKR) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R3) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1,
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_PADDLE1) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_R4) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_PADDLE1,
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_PADDLE2) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_L4) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_PADDLE3) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R5) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_PADDLE2,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_PADDLE4) ? SDL_PRESSED : SDL_RELEASED);
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L5) ? SDL_PRESSED : SDL_RELEASED);
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_DPAD_UP,
(pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_DPAD_UP) ? SDL_PRESSED : SDL_RELEASED);
@ -268,9 +297,9 @@ static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device)
}
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER,
(int)pInReport->payload.deckState.sLeftTrigger * 2 - 32768);
(int)pInReport->payload.deckState.sTriggerRawL * 2 - 32768);
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER,
(int)pInReport->payload.deckState.sRightTrigger * 2 - 32768);
(int)pInReport->payload.deckState.sTriggerRawR * 2 - 32768);
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFTX,
pInReport->payload.deckState.sLeftStickX);

View File

@ -47,6 +47,8 @@ enum ValveControllerPID
D0G_BLE_PID = 0x1105,
D0G_BLE2_PID = 0x1106,
D0GGLE_PID = 0x1142,
JUPITER_PID = 0x1205,
};
// This enum contains all of the messages exchanged between the host and the target (only add to this enum and never change the order)
@ -68,10 +70,11 @@ enum FeatureReportMessageIDs
ID_SET_CONTROLLER_MODE = 0x8D,
ID_LOAD_DEFAULT_SETTINGS = 0x8E,
ID_TRIGGER_HAPTIC_PULSE = 0x8F,
ID_TURN_OFF_CONTROLLER = 0x9F,
ID_GET_DEVICE_INFO = 0xA1,
ID_CALIBRATE_TRACKPADS = 0xA7,
ID_RESERVED_0 = 0xA8,
ID_SET_SERIAL_NUMBER = 0xA9,
@ -99,6 +102,12 @@ enum FeatureReportMessageIDs
ID_CHECK_GYRO_FW_LOAD = 0xC2,
ID_CALIBRATE_ANALOG = 0xC3,
ID_DONGLE_GET_CONNECTED_SLOTS = 0xC4,
ID_RESET_IMU = 0xCE,
// Deck only
ID_TRIGGER_HAPTIC_CMD = 0xEA,
ID_TRIGGER_RUMBLE_CMD = 0xEB,
};
@ -215,6 +224,32 @@ typedef enum
IO_RAW_JOYSTICK_X,
IO_RAW_JOYSTICK_Y,
IO_GYRO_TILT_VEC,
IO_PRESSURE_LEFT_PAD,
IO_PRESSURE_RIGHT_PAD,
IO_PRESSURE_LEFT_BUMPER,
IO_PRESSURE_RIGHT_BUMPER,
IO_PRESSURE_LEFT_GRIP,
IO_PRESSURE_RIGHT_GRIP,
IO_ANALOG_LEFT_TRIGGER_THRESHOLD,
IO_ANALOG_RIGHT_TRIGGER_THRESHOLD,
IO_PRESSURE_RIGHT_PAD_THRESHOLD,
IO_PRESSURE_LEFT_PAD_THRESHOLD,
IO_PRESSURE_RIGHT_BUMPER_THRESHOLD,
IO_PRESSURE_LEFT_BUMPER_THRESHOLD,
IO_PRESSURE_RIGHT_GRIP_THRESHOLD,
IO_PRESSURE_LEFT_GRIP_THRESHOLD,
IO_PRESSURE_RIGHT_PAD_RAW,
IO_PRESSURE_LEFT_PAD_RAW,
IO_PRESSURE_RIGHT_BUMPER_RAW,
IO_PRESSURE_LEFT_BUMPER_RAW,
IO_PRESSURE_RIGHT_GRIP_RAW,
IO_PRESSURE_LEFT_GRIP_RAW,
IO_PRESSURE_RIGHT_GRIP2_THRESHOLD,
IO_PRESSURE_LEFT_GRIP2_THRESHOLD,
IO_PRESSURE_LEFT_GRIP2,
IO_PRESSURE_RIGHT_GRIP2,
IO_PRESSURE_RIGHT_GRIP2_RAW,
IO_PRESSURE_LEFT_GRIP2_RAW,
IO_ANALOG_COUNT
} AnalogIO;
@ -315,37 +350,6 @@ enum GamepadButtons
GAMEPAD_BTN_COUNT
};
typedef enum
{
// Low word button bits
STEAMDECK_LBUTTON_RT2 = (1 << 0),
STEAMDECK_LBUTTON_LT2 = (1 << 1),
STEAMDECK_LBUTTON_RT = (1 << 2),
STEAMDECK_LBUTTON_LT = (1 << 3),
STEAMDECK_LBUTTON_Y = (1 << 4),
STEAMDECK_LBUTTON_B = (1 << 5),
STEAMDECK_LBUTTON_X = (1 << 6),
STEAMDECK_LBUTTON_A = (1 << 7),
STEAMDECK_LBUTTON_DPAD_UP = (1 << 8),
STEAMDECK_LBUTTON_DPAD_RIGHT = (1 << 9),
STEAMDECK_LBUTTON_DPAD_LEFT = (1 << 10),
STEAMDECK_LBUTTON_DPAD_DOWN = (1 << 11),
STEAMDECK_LBUTTON_SELECT = (1 << 12),
STEAMDECK_LBUTTON_MODE = (1 << 13),
STEAMDECK_LBUTTON_START = (1 << 14),
STEAMDECK_LBUTTON_PADDLE3 = (1 << 15),
STEAMDECK_LBUTTON_PADDLE4 = (1 << 16),
STEAMDECK_LBUTTON_PADL = (1 << 17),
STEAMDECK_LBUTTON_PADR = (1 << 18),
STEAMDECK_LBUTTON_STICKL = (1 << 22),
STEAMDECK_LBUTTON_STICKR = (1 << 26),
// High word button bits
STEAMDECK_HBUTTON_PADDLE1 = (1 << 9),
STEAMDECK_HBUTTON_PADDLE2 = (1 << 10),
STEAMDECK_HBUTTON_BASE = (1 << 18)
} DeckButtons;
// Mode adjust
enum ModeAdjustModes
{
@ -413,13 +417,15 @@ typedef enum
SETTING_MOUSE_SENSITIVITY,
SETTING_MOUSE_ACCELERATION,
SETTING_TRACKBALL_ROTATION_ANGLE,
SETTING_HAPTIC_INTENSITY,
SETTING_HAPTIC_INTENSITY_UNUSED,
SETTING_LEFT_GAMEPAD_STICK_ENABLED,
SETTING_RIGHT_GAMEPAD_STICK_ENABLED,
SETTING_USB_DEBUG_MODE,
SETTING_LEFT_TRACKPAD_MODE,
SETTING_RIGHT_TRACKPAD_MODE,
SETTING_MOUSE_POINTER_ENABLED,
// 10
SETTING_DPAD_DEADZONE,
SETTING_MINIMUM_MOMENTUM_VEL,
SETTING_MOMENTUM_DECAY_AMMOUNT,
@ -430,6 +436,8 @@ typedef enum
SETTING_MOMENTUM_VERTICAL_DIVISOR,
SETTING_MOMENTUM_MAXIMUM_VELOCITY,
SETTING_TRACKPAD_Z_ON,
// 20
SETTING_TRACKPAD_Z_OFF,
SETTING_SENSITIVY_SCALE_AMMOUNT,
SETTING_LEFT_TRACKPAD_SECONDARY_MODE,
@ -440,6 +448,8 @@ typedef enum
SETTING_TRACKPAD_OUTER_RADIUS,
SETTING_TRACKPAD_Z_ON_LEFT,
SETTING_TRACKPAD_Z_OFF_LEFT,
// 30
SETTING_TRACKPAD_OUTER_SPIN_VEL,
SETTING_TRACKPAD_OUTER_SPIN_RADIUS,
SETTING_TRACKPAD_OUTER_SPIN_HORIZONTAL_ONLY,
@ -450,6 +460,8 @@ typedef enum
SETTING_TRACKPAD_DOUBLE_TAP_BEEP_PERIOD,
SETTING_TRACKPAD_DOUBLE_TAP_BEEP_COUNT,
SETTING_TRACKPAD_OUTER_RADIUS_RELEASE_ON_TRANSITION,
// 40
SETTING_RADIAL_MODE_ANGLE,
SETTING_HAPTIC_INTENSITY_MOUSE_MODE,
SETTING_LEFT_DPAD_REQUIRES_CLICK,
@ -458,24 +470,54 @@ typedef enum
SETTING_LED_USER_BRIGHTNESS,
SETTING_ENABLE_RAW_JOYSTICK,
SETTING_ENABLE_FAST_SCAN,
SETTING_GYRO_MODE,
SETTING_IMU_MODE,
SETTING_WIRELESS_PACKET_VERSION,
// 50
SETTING_SLEEP_INACTIVITY_TIMEOUT,
SETTING_TRACKPAD_NOISE_THRESHOLD,
SETTING_LEFT_TRACKPAD_CLICK_PRESSURE,
SETTING_RIGHT_TRACKPAD_CLICK_PRESSURE,
SETTING_LEFT_BUMPER_CLICK_PRESSURE,
SETTING_RIGHT_BUMPER_CLICK_PRESSURE,
SETTING_LEFT_GRIP_CLICK_PRESSURE,
SETTING_RIGHT_GRIP_CLICK_PRESSURE,
SETTING_LEFT_GRIP2_CLICK_PRESSURE,
SETTING_RIGHT_GRIP2_CLICK_PRESSURE,
// 60
SETTING_PRESSURE_MODE,
SETTING_CONTROLLER_TEST_MODE,
SETTING_TRIGGER_MODE,
SETTING_TRACKPAD_Z_THRESHOLD,
SETTING_FRAME_RATE,
SETTING_TRACKPAD_FILT_CTRL,
SETTING_TRACKPAD_CLIP,
SETTING_DEBUG_OUTPUT_SELECT,
SETTING_TRIGGER_THRESHOLD_PERCENT,
SETTING_TRACKPAD_FREQUENCY_HOPPING,
// 70
SETTING_HAPTICS_ENABLED,
SETTING_STEAM_WATCHDOG_ENABLE,
SETTING_TIMP_TOUCH_THRESHOLD_ON,
SETTING_TIMP_TOUCH_THRESHOLD_OFF,
SETTING_FREQ_HOPPING,
SETTING_TEST_CONTROL,
SETTING_HAPTIC_MASTER_GAIN_DB,
SETTING_THUMB_TOUCH_THRESH,
SETTING_DEVICE_POWER_STATUS,
SETTING_HAPTIC_INTENSITY,
// 80
SETTING_STABILIZER_ENABLED,
SETTING_TIMP_MODE_MTE,
SETTING_COUNT,
// This is a special setting value use for callbacks and should not be set/get explicitly.
SETTING_ALL=0xFF
} ControllerSettings;
typedef enum
{
SETTING_DECK_LPAD_MODE = 0x07,
SETTING_DECK_RPAD_MODE = 0x08,
SETTING_DECK_RPAD_MARGIN = 0x18,
SETTING_DECK_LPAD_CLICK_PRESSURE = 0x34,
SETTING_DECK_RPAD_CLICK_PRESSURE = 0x35
} DeckSettings;
typedef enum
{
SETTING_DEFAULT,
@ -501,6 +543,7 @@ typedef enum
HAPTIC_PULSE_NORMAL = 0x0000,
HAPTIC_PULSE_HIGH_PRIORITY = 0x0001,
HAPTIC_PULSE_VERY_HIGH_PRIORITY = 0x0002,
HAPTIC_PULSE_IGNORE_USER_PREFS = 0x0003,
} SettingHapticPulseFlags;
typedef struct

View File

@ -32,6 +32,13 @@ typedef struct
unsigned char length;
} FeatureReportHeader;
// Generic controller settings structure
typedef struct
{
unsigned char settingNum;
unsigned short settingValue;
} ControllerSetting;
// Generic controller attribute structure
typedef struct
{
@ -39,25 +46,89 @@ typedef struct
uint32_t attributeValue;
} ControllerAttribute;
// Generic controller settings structure
typedef struct
{
ControllerSetting settings[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerSetting ) ];
} MsgSetSettingsValues, MsgGetSettingsValues, MsgGetSettingsDefaults, MsgGetSettingsMaxs;
// Generic controller settings structure
typedef struct
{
ControllerAttribute attributes[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerAttribute ) ];
} MsgGetAttributes;
// 16bit Steam Deck register with address
typedef struct
{
uint8_t addr;
uint16_t val;
} WriteDeckRegister;
unsigned char attributeTag;
char attributeValue[20];
} MsgGetStringAttribute;
// Generic Steam Deck write register message
typedef struct
{
WriteDeckRegister reg[ (HID_FEATURE_REPORT_BYTES - sizeof ( FeatureReportHeader ) ) / sizeof (WriteDeckRegister ) ];
} MsgWriteDeckRegister;
unsigned char mode;
} MsgSetControllerMode;
// Trigger a haptic pulse
typedef struct {
unsigned char which_pad;
unsigned short pulse_duration;
unsigned short pulse_interval;
unsigned short pulse_count;
short dBgain;
unsigned char priority;
} MsgFireHapticPulse;
typedef struct {
uint8_t mode;
} MsgHapticSetMode;
typedef enum {
HAPTIC_TYPE_OFF,
HAPTIC_TYPE_TICK,
HAPTIC_TYPE_CLICK,
HAPTIC_TYPE_TONE,
HAPTIC_TYPE_RUMBLE,
HAPTIC_TYPE_NOISE,
HAPTIC_TYPE_SCRIPT,
HAPTIC_TYPE_LOG_SWEEP,
} haptic_type_t;
typedef enum {
HAPTIC_INTENSITY_SYSTEM,
HAPTIC_INTENSITY_SHORT,
HAPTIC_INTENSITY_MEDIUM,
HAPTIC_INTENSITY_LONG,
HAPTIC_INTENSITY_INSANE,
} haptic_intensity_t;
typedef struct {
uint8_t side; // 0x01 = L, 0x02 = R, 0x03 = Both
uint8_t cmd; // 0 = Off, 1 = tick, 2 = click, 3 = tone, 4 = rumble, 5 =
// rumble_noise, 6 = script, 7 = sweep,
uint8_t ui_intensity; // 0-4 (0 = default)
int8_t dBgain; // dB Can be positive (reasonable clipping / limiting will apply)
uint16_t freq; // Frequency of tone (if applicable)
int16_t dur_ms; // Duration of tone / rumble (if applicable) (neg = infinite)
uint16_t noise_intensity;
uint16_t lfo_freq; // Drives both tone and rumble geneators
uint8_t lfo_depth; // percentage, typically 100
uint8_t rand_tone_gain; // Randomize each LFO cycle's gain
uint8_t script_id; // Used w/ dBgain for scripted haptics
uint16_t lss_start_freq; // Used w/ Log Sine Sweep
uint16_t lss_end_freq; // Ditto
} MsgTriggerHaptic;
typedef struct {
uint8_t unRumbleType;
uint16_t unIntensity;
uint16_t unLeftMotorSpeed;
uint16_t unRightMotorSpeed;
int8_t nLeftGain;
int8_t nRightGain;
} MsgSimpleRumbleCmd;
// This is the only message struct that application code should use to interact with feature request messages. Any new
// messages should be added to the union. The structures defined here should correspond to the ones defined in
@ -68,8 +139,17 @@ typedef struct
FeatureReportHeader header;
union
{
MsgGetAttributes getAttributes;
MsgWriteDeckRegister wrDeckRegister;
MsgSetSettingsValues setSettingsValues;
MsgGetSettingsValues getSettingsValues;
MsgGetSettingsMaxs getSettingsMaxs;
MsgGetSettingsDefaults getSettingsDefaults;
MsgGetAttributes getAttributes;
MsgSetControllerMode controllerMode;
MsgFireHapticPulse fireHapticPulse;
MsgGetStringAttribute getStringAttribute;
MsgHapticSetMode hapticMode;
MsgTriggerHaptic triggerHaptic;
MsgSimpleRumbleCmd simpleRumble;
} payload;
} FeatureReportMsg;
@ -317,8 +397,8 @@ typedef struct
short sGyroQuatZ;
// Uncalibrated trigger values
short sLeftTrigger;
short sRightTrigger;
unsigned short sTriggerRawL;
unsigned short sTriggerRawR;
// Left stick values
short sLeftStickX;
@ -329,8 +409,8 @@ typedef struct
short sRightStickY;
// Touchpad pressures
short sLeftPadPressure;
short sRightPadPressure;
unsigned short sPressurePadLeft;
unsigned short sPressurePadRight;
} SteamDeckStatePacket_t;
typedef struct