DualSense haptics over Bluetooth (output report 0x32) #2056

Closed
opened 2026-10-09 06:05:42 +00:00 by beecrepaldi-afk · 6 comments
beecrepaldi-afk commented 2026-10-09 06:05:42 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by beecrepaldi-afk on 2026-10-09T06:05:42Z.


Problem

Vibration ports (AudioOut2 type 0x6) reach the controller only through the USB DualSense sound card (#180), and only on Linux. Over Bluetooth there is no sound card, so the haptics are lost; #2032 drops these ports from the main mix in that case. Rumble and adaptive triggers already work over Bluetooth through SDL.

Proposal

Over Bluetooth, the DualSense takes haptics audio in HID output report 0x32. Send the vibration port's two channels there when the controller is connected over Bluetooth and no pad audio device is open.

  • Report 0x32 is 142 bytes. One report carries one block: 32 stereo frames, 8-bit signed, at 3 kHz (64 bytes, 10.67 ms).
  • Layout: byte 0 0x32; byte 1 high nibble a 4-bit sequence number; bytes 2-4 0x91 0x07 0xFE (audio control packet); bytes 5-9 the controller's internal queue depth in frames (16); byte 10 a counter; bytes 11-12 0x92 0x40 (haptics packet, 64 bytes); bytes 13-76 the samples; last 4 bytes a CRC32 (little-endian) over 0xA2 followed by bytes 0-137.
  • Before streaming, one report 0x31 sets motor power reduction to 0 and the haptics low-pass filter on (valid_flag1 bits 0x02 | 0x20 | 0x40, valid_flag0 left at 0, since its rumble bits take the actuators out of audio mode). Otherwise the controller keeps what the last host set; we saw actuators at 12.5% of the level sent.
  • The 48 kHz port is low-pass filtered and resampled to 3 kHz. One report is due every 10.67 ms (~94 per second) while the port plays; during silence nothing is sent.
  • Sending: SDL_hid_open on the controller and SDL_hid_write. SDL_GameControllerSendEffect only fills report 0x31, which has no haptics block.

Measurements from a working implementation

This already runs in P5M for Mac (PS5 Remote Play, gui/src/macDualSenseBluetooth.mm), on macOS with IOKit:

  • On macOS the Bluetooth link carries about 10 KB/s of output reports (50-65 reports of 0x32 per second). Dense haptics arrive ~50 ms late and ~15% of the blocks are dropped. Linux and Windows are not measured.
  • Sending without waiting for completion, with up to 4 reports in flight, was about 3x faster than blocking writes.
  • Report 0x39 (547 bytes, two haptics blocks) took 100-175 ms per report on macOS, so 0x32 is used. 0x39 may keep finer detail where the link allows it.
  • After 20 failed writes in a row the device is reopened, which brings haptics back after the controller reconnects.

I wrote that Bluetooth haptics code, and I can contribute it here under GPL-2.0. It uses IOKit, so it would be ported to SDL2 for Linux and Windows. The report layouts are also documented by DS5Dongle, which our code followed for report 0x39 and for the queue depth.

Questions

  • Is this wanted, and in which module: libSceAudioOut next to AudioOut2PadMix, or the pad code that owns the SDL controller?
  • I only have a Mac, so I can't run titles here. Can someone test on Linux or Windows with a title that uses vibration ports (e.g. PPSA21564) and a Bluetooth DualSense?

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5773615961 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056). Originally posted by [beecrepaldi-afk](https://github.com/beecrepaldi-afk) on 2026-10-09T06:05:42Z. --- ### Problem Vibration ports (AudioOut2 type 0x6) reach the controller only through the USB DualSense sound card (#180), and only on Linux. Over Bluetooth there is no sound card, so the haptics are lost; #2032 drops these ports from the main mix in that case. Rumble and adaptive triggers already work over Bluetooth through SDL. ### Proposal Over Bluetooth, the DualSense takes haptics audio in HID output report 0x32. Send the vibration port's two channels there when the controller is connected over Bluetooth and no pad audio device is open. - Report 0x32 is 142 bytes. One report carries one block: 32 stereo frames, 8-bit signed, at 3 kHz (64 bytes, 10.67 ms). - Layout: byte 0 `0x32`; byte 1 high nibble a 4-bit sequence number; bytes 2-4 `0x91 0x07 0xFE` (audio control packet); bytes 5-9 the controller's internal queue depth in frames (16); byte 10 a counter; bytes 11-12 `0x92 0x40` (haptics packet, 64 bytes); bytes 13-76 the samples; last 4 bytes a CRC32 (little-endian) over `0xA2` followed by bytes 0-137. - Before streaming, one report 0x31 sets motor power reduction to 0 and the haptics low-pass filter on (valid_flag1 bits `0x02 | 0x20 | 0x40`, valid_flag0 left at 0, since its rumble bits take the actuators out of audio mode). Otherwise the controller keeps what the last host set; we saw actuators at 12.5% of the level sent. - The 48 kHz port is low-pass filtered and resampled to 3 kHz. One report is due every 10.67 ms (~94 per second) while the port plays; during silence nothing is sent. - Sending: `SDL_hid_open` on the controller and `SDL_hid_write`. `SDL_GameControllerSendEffect` only fills report 0x31, which has no haptics block. ### Measurements from a working implementation This already runs in [P5M for Mac](https://github.com/beecrepaldi-afk/P5M-mac) (PS5 Remote Play, `gui/src/macDualSenseBluetooth.mm`), on macOS with IOKit: - On macOS the Bluetooth link carries about 10 KB/s of output reports (50-65 reports of 0x32 per second). Dense haptics arrive ~50 ms late and ~15% of the blocks are dropped. Linux and Windows are not measured. - Sending without waiting for completion, with up to 4 reports in flight, was about 3x faster than blocking writes. - Report 0x39 (547 bytes, two haptics blocks) took 100-175 ms per report on macOS, so 0x32 is used. 0x39 may keep finer detail where the link allows it. - After 20 failed writes in a row the device is reopened, which brings haptics back after the controller reconnects. I wrote that Bluetooth haptics code, and I can contribute it here under GPL-2.0. It uses IOKit, so it would be ported to SDL2 for Linux and Windows. The report layouts are also documented by [DS5Dongle](https://github.com/awalol/DS5Dongle), which our code followed for report 0x39 and for the queue depth. ### Questions - Is this wanted, and in which module: libSceAudioOut next to `AudioOut2PadMix`, or the pad code that owns the SDL controller? - I only have a Mac, so I can't run titles here. Can someone test on Linux or Windows with a title that uses vibration ports (e.g. PPSA21564) and a Bluetooth DualSense? AI-assisted: yes.
MarcZX10 commented 2026-10-09 06:10:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T06:10:06Z.


I traced the current ownership in the tree. AudioOut2Context classifies, mixes, and queues the PCM pad ports; PadInput owns the SDL controller and sends the current rumble/adaptive-trigger effects; PadState carries only the existing latest-value output state. That suggests keeping controller discovery, HID handle lifetime, report 0x31 configuration, reconnects, and 0x32 writes with the pad/controller output owner, while AudioOut2 hands it a bounded stream of mixed vibration frames. ContextPush holds the audio context mutex while rendering, so HID writes or 10.67 ms pacing should not run inline there. A single owner should also serialize 0x31/0x32 with SDL rumble and trigger reports to avoid output-report races. This is an ownership recommendation from the current architecture; whether to accept the feature and its cross-platform API still needs a maintainer decision and Linux/Windows hardware validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6075400181 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6075400181). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T06:10:06Z. --- I traced the current ownership in the tree. `AudioOut2Context` classifies, mixes, and queues the PCM pad ports; `PadInput` owns the SDL controller and sends the current rumble/adaptive-trigger effects; `PadState` carries only the existing latest-value output state. That suggests keeping controller discovery, HID handle lifetime, report 0x31 configuration, reconnects, and 0x32 writes with the pad/controller output owner, while AudioOut2 hands it a bounded stream of mixed vibration frames. `ContextPush` holds the audio context mutex while rendering, so HID writes or 10.67 ms pacing should not run inline there. A single owner should also serialize 0x31/0x32 with SDL rumble and trigger reports to avoid output-report races. This is an ownership recommendation from the current architecture; whether to accept the feature and its cross-platform API still needs a maintainer decision and Linux/Windows hardware validation.
beecrepaldi-afk commented 2026-10-09 06:16:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by beecrepaldi-afk on 2026-10-09T06:16:31Z.


Thanks, that split matches how it runs in P5M: the audio side only fills a ring buffer, and a separate thread paces the 0x32 writes every 10.67 ms, so nothing blocks the audio path. In P5M, SDL keeps its own handle for 0x31 (rumble, triggers, light bar) while a second handle writes 0x32, and we have not seen conflicts on macOS. Still, a single owner in PadInput is cleaner, and I'd follow that here.

@boykopovar, would you take this feature? If yes, I'll open a PR with that structure, and it will need someone with Linux or Windows and a Bluetooth DualSense to test it on a title.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6075494959 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6075494959). Originally posted by [beecrepaldi-afk](https://github.com/beecrepaldi-afk) on 2026-10-09T06:16:31Z. --- Thanks, that split matches how it runs in P5M: the audio side only fills a ring buffer, and a separate thread paces the 0x32 writes every 10.67 ms, so nothing blocks the audio path. In P5M, SDL keeps its own handle for 0x31 (rumble, triggers, light bar) while a second handle writes 0x32, and we have not seen conflicts on macOS. Still, a single owner in PadInput is cleaner, and I'd follow that here. @boykopovar, would you take this feature? If yes, I'll open a PR with that structure, and it will need someone with Linux or Windows and a Bluetooth DualSense to test it on a title.
oneandonlydean commented 2026-10-09 21:04:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T21:04:16Z.


Yes, go ahead. A few things for the PR:

  • Keep it to report 0x32 streaming only, on its own pacing thread, with the audio side just filling the buffer as you described. No env switch, and no fallback when the report write fails: throw or log once and stop the stream.
  • Add a test that builds a 0x32 report from known samples and checks the layout and CRC32 byte for byte.
  • Mark "Depends on #2032", since that's what drops the vibration ports from the main mix over Bluetooth.
  • Say in Tested which title you heard it on, and the controller firmware.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6089229484 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6089229484). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T21:04:16Z. --- Yes, go ahead. A few things for the PR: - Keep it to report 0x32 streaming only, on its own pacing thread, with the audio side just filling the buffer as you described. No env switch, and no fallback when the report write fails: throw or log once and stop the stream. - Add a test that builds a 0x32 report from known samples and checks the layout and CRC32 byte for byte. - Mark "Depends on #2032", since that's what drops the vibration ports from the main mix over Bluetooth. - Say in Tested which title you heard it on, and the controller firmware.
LeandroLP23 commented 2026-10-21 13:17:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T13:17:47Z.


@beecrepaldi-afk are you still working on this? I have a DualSense I can run over Bluetooth and over USB, on Windows 11 (Radeon 860M), so I can do the Windows hardware testing you asked for above.

Either way works for me:

  • If you have a branch, I'll build it and test it on Windows over Bluetooth, and report what I measure (reports per second, dropped writes, latency).
  • If you'd rather not pick it up again, I can port your P5M code to SDL's SDL_hid_*, owned by PadInput as MarcZX10 and oneandonlydean described, with your authorship on the commit.

One limitation: I don't have a commercial title that uses the vibration ports (PPSA21564 or similar). I can drive the type 0x6 port with a known signal and feel or measure it on the controller. A title run would have to come from someone who has one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6317049170 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6317049170). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-21T13:17:47Z. --- @beecrepaldi-afk are you still working on this? I have a DualSense I can run over Bluetooth and over USB, on Windows 11 (Radeon 860M), so I can do the Windows hardware testing you asked for above. Either way works for me: - If you have a branch, I'll build it and test it on Windows over Bluetooth, and report what I measure (reports per second, dropped writes, latency). - If you'd rather not pick it up again, I can port your P5M code to SDL's `SDL_hid_*`, owned by `PadInput` as MarcZX10 and oneandonlydean described, with your authorship on the commit. One limitation: I don't have a commercial title that uses the vibration ports (PPSA21564 or similar). I can drive the type 0x6 port with a known signal and feel or measure it on the controller. A title run would have to come from someone who has one.
LeandroLP23 commented 2026-10-21 13:27:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T13:27:53Z.


Windows data point, measured with a standalone probe built against this repo's SDL2 (3rdparty/SDL2, static, HIDAPI on). The probe is outside the tree.

Setup: DualSense over Bluetooth, Windows 11 26300. Feature report 0x20 reports firmware 0x010d0002, update version 0x0633, hardware 0x00000917, build Sep 18 2025.

What the probe does: SDL_GameControllerOpen, then SDL_hid_open_path(SDL_GameControllerPath(controller), 0). The path is \?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002054c_pid&0ce6#..., and its Bluetooth HID service GUID is how the link shows on Windows; interface_number is -1. It sends one 0x31 configuration report, then 0x32 reports every 10.672 ms. The layout and CRC are exactly as in P5M's build(), fullPower() and sign(). The content is 6 s of a 150 Hz sine at amplitude 100: the first 3 s on channel 0 only, the last 3 s on channel 1 only. Every 100 blocks it also calls SDL_GameControllerSetLED on SDL's own handle.

Windows 11, Bluetooth
0x31 configuration write accepted, 0.08–0.09 ms
0x32 writes 562 of 562 accepted, two runs
write time mean 0.10–0.11 ms, worst 0.45–0.83 ms
SDL_GameControllerSetLED on SDL's handle in between rc 0 every time, light bar changed
  • The haptics play. They were felt on the controller, channel 0 toward the left and channel 1 toward the right, at medium strength for amplitude 100.
  • The second, shared handle didn't conflict with SDL's own writes.
  • SDL_hid_write returns 547 for a 142-byte 0x32. Windows hidapi pads every write to the device's largest output report (0x39's 547 bytes). The controller still plays them, so the padding is harmless here.
  • Writes return in about 0.1 ms because Windows queues them, so the blocking-write cost measured on macOS doesn't apply. Whether reports drop on the air isn't visible from the host side. The 10.67 ms pacing held with plain blocking writes, without the in-flight queue P5M needed.

So on Windows the plain SDL route the issue proposes works as-is.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6317270308 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6317270308). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-21T13:27:53Z. --- Windows data point, measured with a standalone probe built against this repo's SDL2 (`3rdparty/SDL2`, static, HIDAPI on). The probe is outside the tree. Setup: DualSense over Bluetooth, Windows 11 26300. Feature report 0x20 reports firmware 0x010d0002, update version 0x0633, hardware 0x00000917, build Sep 18 2025. What the probe does: `SDL_GameControllerOpen`, then `SDL_hid_open_path(SDL_GameControllerPath(controller), 0)`. The path is `\?\hid#{00001124-0000-1000-8000-00805f9b34fb}_vid&0002054c_pid&0ce6#...`, and its Bluetooth HID service GUID is how the link shows on Windows; `interface_number` is -1. It sends one 0x31 configuration report, then 0x32 reports every 10.672 ms. The layout and CRC are exactly as in P5M's `build()`, `fullPower()` and `sign()`. The content is 6 s of a 150 Hz sine at amplitude 100: the first 3 s on channel 0 only, the last 3 s on channel 1 only. Every 100 blocks it also calls `SDL_GameControllerSetLED` on SDL's own handle. | | Windows 11, Bluetooth | |---|---| | 0x31 configuration write | accepted, 0.08–0.09 ms | | 0x32 writes | 562 of 562 accepted, two runs | | write time | mean 0.10–0.11 ms, worst 0.45–0.83 ms | | `SDL_GameControllerSetLED` on SDL's handle in between | rc 0 every time, light bar changed | - The haptics play. They were felt on the controller, channel 0 toward the left and channel 1 toward the right, at medium strength for amplitude 100. - The second, shared handle didn't conflict with SDL's own writes. - `SDL_hid_write` returns 547 for a 142-byte 0x32. Windows hidapi pads every write to the device's largest output report (0x39's 547 bytes). The controller still plays them, so the padding is harmless here. - Writes return in about 0.1 ms because Windows queues them, so the blocking-write cost measured on macOS doesn't apply. Whether reports drop on the air isn't visible from the host side. The 10.67 ms pacing held with plain blocking writes, without the in-flight queue P5M needed. So on Windows the plain SDL route the issue proposes works as-is.
LeandroLP23 commented 2026-10-21 13:55:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-21T13:55:15Z.


@beecrepaldi-afk I went ahead with the port in #9154, with your authorship on the commit. It's your report layout, CRC and configuration report from P5M, driven by PadInput over SDL's SDL_hid_*, and tested end to end on Windows over Bluetooth. If you'd rather it go differently, or want to take it over, say so there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6317845925 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/2056#issuecomment-6317845925). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-21T13:55:15Z. --- @beecrepaldi-afk I went ahead with the port in #9154, with your authorship on the commit. It's your report layout, CRC and configuration report from P5M, driven by `PadInput` over SDL's `SDL_hid_*`, and tested end to end on Windows over Bluetooth. If you'd rather it go differently, or want to take it over, say so there.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#2056
No description provided.