UNPKG

dualsense-ts

Version:

The natural interface for your DualSense and DualSense Access controllers, with Typescript

136 lines 6.79 kB
"use strict"; /** * DualSense DSP test command definitions (Feature Report 0x80 / 0x81). * * The controller contains a MediaTek Spider DSP and Realtek ALC5524 audio * codec paired with an ALC1016 Class-D speaker amplifier. Factory test * commands are sent via Feature Report 0x80 and responses read from 0x81. * The report format is: * * 0x80: [deviceId, actionId, ...params] * 0x81: [0x81, deviceId, actionId, status, ...resultData] * * For Bluetooth, the HID provider appends a CRC-32 checksum automatically. * * ## Probing results (firmware 0001_0006, codec built 2020-08-18) * * Only three Audio actions return data: * - ReadCodecFwInfo (3): returns version + build timestamp * - ReadSpeakerFixedGain (10): returns current gain (all zeros if unset) * - CodecRegRead (129): returns 0xDEADBEEF for all addresses (bridge not exposed) * * All other Audio actions are write-only or unimplemented (return Idle/no response). * * Device ID sweep (action 0, IDs 0–31): * - BtPatch (14): responds with empty data * - DspFirmware (15): responds with 0x80 (version/status) * - SpiderDspFirmware (16): responds with 0x80 (version/status) * - All other devices: no response to action 0 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DspStatus = exports.AudioAction = exports.DspDevice = void 0; /** DSP device IDs for Feature Report 0x80 commands */ var DspDevice; (function (DspDevice) { DspDevice[DspDevice["System"] = 1] = "System"; DspDevice[DspDevice["Power"] = 2] = "Power"; DspDevice[DspDevice["Memory"] = 3] = "Memory"; DspDevice[DspDevice["AnalogData"] = 4] = "AnalogData"; DspDevice[DspDevice["Touch"] = 5] = "Touch"; /** Audio DSP — test tone, codec, mic calibration */ DspDevice[DspDevice["Audio"] = 6] = "Audio"; DspDevice[DspDevice["AdaptiveTrigger"] = 7] = "AdaptiveTrigger"; DspDevice[DspDevice["Bullet"] = 8] = "Bullet"; DspDevice[DspDevice["Bluetooth"] = 9] = "Bluetooth"; DspDevice[DspDevice["Motion"] = 10] = "Motion"; DspDevice[DspDevice["Trigger"] = 11] = "Trigger"; DspDevice[DspDevice["Stick"] = 12] = "Stick"; DspDevice[DspDevice["Led"] = 13] = "Led"; /** Responds to action 0 with empty data */ DspDevice[DspDevice["BtPatch"] = 14] = "BtPatch"; /** Responds to action 0 with 0x80 (version/status byte) */ DspDevice[DspDevice["DspFirmware"] = 15] = "DspFirmware"; /** Responds to action 0 with 0x80 (version/status byte) */ DspDevice[DspDevice["SpiderDspFirmware"] = 16] = "SpiderDspFirmware"; DspDevice[DspDevice["Finger"] = 17] = "Finger"; DspDevice[DspDevice["PositionTracking"] = 19] = "PositionTracking"; DspDevice[DspDevice["BuiltinMicCalibData"] = 20] = "BuiltinMicCalibData"; })(DspDevice || (exports.DspDevice = DspDevice = {})); /** Action IDs for Audio device (DspDevice.Audio = 6) */ var AudioAction; (function (AudioAction) { /** * Start or stop DSP waveform. Params: [start(0|1), tone1, tone2] * * byte[0]: 1 = start, 0 = stop * byte[1]: 1 = enable ~1kHz sine wave, 0 = disable * byte[2]: 1 = enable lower-frequency sine wave, 0 = disable * * Both tones can play simultaneously ([1, 1, 1]). * No other byte values (0–255) produce additional tones. * Write-only — returns no response data. */ AudioAction[AudioAction["WaveoutCtrl"] = 2] = "WaveoutCtrl"; /** * Read codec (ALC5524) firmware info. * Returns 60 bytes: version fields + ASCII build timestamp (e.g. "20200818152054"). */ AudioAction[AudioAction["ReadCodecFwInfo"] = 3] = "ReadCodecFwInfo"; /** * Configure output routing before waveout. 20-byte params: * * Speaker: params[2] = 8 * Headphone: params[4] = 4, params[6] = 6 * All other bytes: zero in reference impl, no effect found in sweep (0–10). * * Write-only — returns no response data. */ AudioAction[AudioAction["SetPathSelector"] = 4] = "SetPathSelector"; /** Speaker compensation (EQ/filter). Write-only. */ AudioAction[AudioAction["SpeakerComp"] = 5] = "SpeakerComp"; /** Configure noise cancellation algorithm. Write-only. */ AudioAction[AudioAction["SetNoiseCancellerType"] = 6] = "SetNoiseCancellerType"; /** Set microphone gain level. Write-only. */ AudioAction[AudioAction["SetMicGain"] = 7] = "SetMicGain"; /** Set a fixed speaker gain value. Write-only. */ AudioAction[AudioAction["SetSpeakerFixedGain"] = 8] = "SetSpeakerFixedGain"; /** Write/persist speaker gain to NVS. Write-only. */ AudioAction[AudioAction["WriteSpeakerFixedGain"] = 9] = "WriteSpeakerFixedGain"; /** Read current speaker fixed gain. Returns gain value (all zeros if unset). */ AudioAction[AudioAction["ReadSpeakerFixedGain"] = 10] = "ReadSpeakerFixedGain"; /** Trial mic calibration gain. Write-only. */ AudioAction[AudioAction["TryMicCalibGain"] = 11] = "TryMicCalibGain"; /** Set compensation status. Write-only. */ AudioAction[AudioAction["SetCompStatus"] = 12] = "SetCompStatus"; /** Get compensation status. No response observed — may require prior SetCompStatus. */ AudioAction[AudioAction["GetCompStatus"] = 13] = "GetCompStatus"; /** Execute forced compensation. Write-only. */ AudioAction[AudioAction["ExecForceComp"] = 14] = "ExecForceComp"; /** Set auto-calibration status. Write-only. */ AudioAction[AudioAction["SetAutoCalibStatus"] = 15] = "SetAutoCalibStatus"; /** Get auto-calibration status. No response observed — may require prior SetAutoCalibStatus. */ AudioAction[AudioAction["GetAutoCalibStatus"] = 16] = "GetAutoCalibStatus"; /** * Direct register write to ALC5524 codec. Write-only. * Params: [addrHi, addrLo, ...data] */ AudioAction[AudioAction["CodecRegWrite"] = 128] = "CodecRegWrite"; /** * Direct register read from ALC5524 codec. * Params: [addrHi, addrLo] * Returns 0xDEADBEEF for all tested addresses (0x0000–0x03FF, 0xFA00–0xFAFF). * The register bridge appears to be disabled in production firmware. */ AudioAction[AudioAction["CodecRegRead"] = 129] = "CodecRegRead"; })(AudioAction || (exports.AudioAction = AudioAction = {})); /** DSP test response status codes (byte 3 of Feature Report 0x81) */ var DspStatus; (function (DspStatus) { DspStatus[DspStatus["Idle"] = 0] = "Idle"; DspStatus[DspStatus["Running"] = 1] = "Running"; DspStatus[DspStatus["Complete"] = 2] = "Complete"; /** Multi-part response — more data follows */ DspStatus[DspStatus["CompleteMulti"] = 3] = "CompleteMulti"; DspStatus[DspStatus["Timeout"] = 255] = "Timeout"; })(DspStatus || (exports.DspStatus = DspStatus = {})); //# sourceMappingURL=dsp.js.map