dualsense-ts
Version:
The natural interface for your DualSense Classic and DualSense Access controllers, with Typescript
191 lines • 7.8 kB
TypeScript
/**
* DualSense Access Controller HID Report Maps
*
* Byte-level layout for USB and Bluetooth input/output reports.
* Cross-referenced with titania C library (access_input_msg, access_output_msg)
* and confirmed by physical testing.
*/
/**
* USB Input Report 0x01 (64 bytes) / BT Input Report 0x31 (78 bytes)
*
* The Access input report has two regions:
* - Shared header (bytes 0–15): DualSense-compatible mapped output
* - Access-specific (bytes 16–55): raw buttons, raw stick, expansion ports, battery, profile
*
* BT offset: USB byte N → BT byte N+1 (one header byte, NOT +2 like DualSense)
*/
export declare const AccessInput: {
/** BT 0x31 has 1 header byte after report ID (DualSense has 2) */
readonly BT_OFFSET: 1;
readonly REPORT_ID: 0;
/** Profile-mapped left stick X (0x80 center). May be unused depending on profile. */
readonly MAPPED_STICK_LX: 1;
/** Profile-mapped left stick Y (0x80 center). May be unused depending on profile. */
readonly MAPPED_STICK_LY: 2;
/** Profile-mapped right stick X (0x80 center). May be unused depending on profile. */
readonly MAPPED_STICK_RX: 3;
/** Profile-mapped right stick Y (0x80 center). May be unused depending on profile. */
readonly MAPPED_STICK_RY: 4;
/** Mapped L2 trigger (0x00–0xFF) */
readonly MAPPED_L2: 5;
/** Mapped R2 trigger (0x00–0xFF) */
readonly MAPPED_R2: 6;
/** Sequence counter (increments each report) */
readonly SEQ_COUNTER: 7;
/** Lower nibble: hat direction (0-7 = N/NE/E/SE/S/SW/W/NW, 8 = null). Upper nibble: buttons. */
readonly HAT_BUTTONS: 8;
/** Mapped buttons byte 2 */
readonly BUTTONS_2: 9;
/** Mapped buttons byte 3 + vendor bits */
readonly BUTTONS_3: 10;
/** Vendor byte (static) */
readonly VENDOR: 11;
/** Firmware timestamp (uint32 LE, bytes 12–15) */
readonly TIMESTAMP: 12;
/** Raw button byte 1: bits 0–7 = b1–b8 (physical buttons, profile-independent) */
readonly RAW_BUTTONS_1: 16;
/** Raw button byte 2: bit 0 = center, bit 1 = stick click, bit 2 = PS, bit 3 = profile */
readonly RAW_BUTTONS_2: 17;
/** Raw stick Y before profile mapping (0x80 center, 0xFF = up) */
readonly RAW_STICK_Y: 18;
/** Raw stick X before profile mapping (0x80 center, 0xFF = right) */
readonly RAW_STICK_X: 19;
/** Expansion port 1 X axis */
readonly E1_X: 20;
/** Expansion port 1 Y axis */
readonly E1_Y: 21;
/** Expansion port 2 X axis */
readonly E2_X: 22;
/** Expansion port 2 Y axis */
readonly E2_Y: 23;
/** Expansion port 3 X axis */
readonly E3_X: 24;
/** Expansion port 3 Y axis */
readonly E3_Y: 25;
/** Expansion port 4 X axis */
readonly E4_X: 26;
/** Expansion port 4 Y axis */
readonly E4_Y: 27;
/** Battery: lower nibble = level (0–10), upper nibble = charge status */
readonly BATTERY: 37;
/** Profile ID (bits 0–2, values 1–3) + profile switching disabled (bit 3) */
readonly PROFILE: 40;
/** Expansion port types: E3 (lower nibble), E4 (upper nibble) */
readonly PORT_TYPES_E3_E4: 41;
/** Post-profile virtual left stick X (0x80 center) */
readonly VIRTUAL_STICK_1_X: 43;
/** Post-profile virtual left stick Y (0x80 center) */
readonly VIRTUAL_STICK_1_Y: 44;
/** Post-profile virtual right stick X (0x80 center) */
readonly VIRTUAL_STICK_2_X: 47;
/** Post-profile virtual right stick Y (0x80 center) */
readonly VIRTUAL_STICK_2_Y: 48;
/** Expansion port types: E1 (lower nibble), E2 (upper nibble) */
readonly PORT_TYPES_E1_E2: 49;
};
/** Raw button bit masks for AccessInput.RAW_BUTTONS_1 */
export declare const AccessButton1: {
readonly B1: 1;
readonly B2: 2;
readonly B3: 4;
readonly B4: 8;
readonly B5: 16;
readonly B6: 32;
readonly B7: 64;
readonly B8: 128;
};
/** Raw button bit masks for AccessInput.RAW_BUTTONS_2 */
export declare const AccessButton2: {
readonly CENTER: 1;
readonly STICK: 2;
readonly PS: 4;
readonly PROFILE: 8;
};
/** Expansion port device types (4-bit nibble values) */
export declare enum AccessPortType {
Disconnected = 0,
Button = 1,
Trigger = 2,
Stick = 3
}
/**
* USB Output Report 0x02 (32 bytes) / BT Output Report 0x31 (78 bytes)
*
* BT offset: USB byte N → BT byte N+1
* BT requires: report ID 0x31 at byte 0, constant 0x02 at byte 1, CRC32 at bytes 74–77
*/
export declare const AccessOutput: {
/** BT output constant byte value at BT[1] */
readonly BT_CONSTANT: 2;
/** Report ID: 0x02 for USB, 0x31 for BT */
readonly REPORT_ID_USB: 2;
readonly REPORT_ID_BT: 49;
/** Mutator flags (scope A). Controls which subsystems are updated. */
readonly MUTATOR: 1;
/** Scope B flags. Required for lightbar over BT (bit 2). */
readonly SCOPE_B: 2;
/** LED effect mode. Not required in normal reports (animation dismiss handles init). */
readonly LED_EFFECT: 3;
/** LED brightness (0x00 = high, 0x01 = medium, 0x02 = low). Affects status/profile LED brightness over BT. */
readonly LED_BRIGHTNESS: 4;
/** Player indicator pattern (0–4). Requires mutator bit 4. */
readonly PLAYER_INDICATOR: 5;
/** Lightbar Red (0x00–0xFF). Requires mutator bit 2 + scope B bit 2 over BT. */
readonly LIGHTBAR_R: 6;
/** Lightbar Green (0x00–0xFF) */
readonly LIGHTBAR_G: 7;
/** Lightbar Blue (0x00–0xFF) */
readonly LIGHTBAR_B: 8;
/** Control field. Requires mutator bit 5. */
readonly CONTROL: 9;
/** Control2 field (2 bytes). Requires mutator bit 6. */
readonly CONTROL2: 10;
/** LED flags 1: bit 0 = profile enable, bit 1 = profile mute, bit 4 = status LED command enable */
readonly LED_FLAGS_1: 12;
/** LED flags 2 / Profile LED mode: 0=off, 1=on, 2=fade, 3=sweep */
readonly LED_FLAGS_2: 13;
/** Status LED value: 0=off, 1=on. Also requires LED_FLAGS_1 bit 4. */
readonly STATUS_LED: 23;
/** USB output report size (including report ID) */
readonly USB_SIZE: 32;
/** BT output report size (including report ID and CRC) */
readonly BT_SIZE: 78;
/** BT CRC position (bytes 74–77, little-endian) */
readonly BT_CRC_OFFSET: 74;
};
/** Output mutator flag bits (AccessOutput.MUTATOR byte) */
export declare const AccessMutator: {
/** Profile LEDs + Status LED (LED flags bytes 12–13, status LED byte 23) */
readonly STATUS_LED: 1;
/** Profile indicator LED (titania naming, overlaps with STATUS_LED) */
readonly PROFILE_LED: 2;
/** Lightbar RGB (bytes 6–8) + Player indicator (byte 5). Over BT, also needs SCOPE_B_LED. */
readonly LED: 4;
/** Reset all LEDs to default */
readonly RESET_LED: 8;
/** Player indicator LED (byte 5) */
readonly PLAYER_INDICATOR_LED: 16;
/** Control field (byte 9) */
readonly CONTROL: 32;
/** Control2 field (bytes 10–11) */
readonly CONTROL2: 64;
/** Combined: all LED subsystems */
readonly ALL_LEDS: 21;
};
/** Scope B flag bits (AccessOutput.SCOPE_B byte) — needed for BT output */
export declare const AccessScopeB: {
/** Required for lightbar RGB over BT (both this AND AccessMutator.LED must be set) */
readonly LED: 4;
};
/** LED flags 1 bit definitions (AccessOutput.LED_FLAGS_1 byte) */
export declare const AccessLedFlags1: {
/** Enable profile LEDs */
readonly PROFILE_ENABLE: 1;
/** Mute/disable profile LEDs (overrides PROFILE_ENABLE) */
readonly PROFILE_MUTE: 2;
/** Enable status LED command (must be set for status LED on OR off) */
readonly STATUS_LED_ENABLE: 16;
/** Common: profile on + status LED command enabled */
readonly PROFILE_AND_STATUS: 17;
};
//# sourceMappingURL=access_hid.d.ts.map