feat(native-usb): add 32-frame HD gameplay rumble and USB flight diagnostics

Preserve native frequency/amplitude timelines for DualSense PCM output,
remove the unsupported 64-frame path, and retain compatibility rumble for
other controllers. Use the validated 300 MHz sampling phase and restrict
non-bondable Classic discovery autoconnect to previously paired peers.

Buffer native-hub UART stdout and release USB IRQs around port-reset
callbacks. Add observer liveness and pre-SETUP root-response observations
without changing recovery behavior. Cover transport and haptics boundaries.

Record the user-accepted 0.108 trial: controls remained responsive and
rumble felt fine. Instrumentation changes timing; the disconnect root
cause and long-term reliability remain unqualified.

Validation: 624 tests, 11 affected firmware/probe builds, and on-device
concurrent USB and HD-auto-start checks. Private captures, generated
images, and unrelated working-tree files are intentionally excluded.
This commit is contained in:
Joey Yakimowich-Payne 2026-09-19 17:03:46 -06:00
commit 80b788099b
46 changed files with 2873 additions and 412 deletions

View file

@ -52,11 +52,9 @@ endif()
if(SWITCH_PICO_INPUT_BACKEND STREQUAL "BLUEPAD32")
set(SWITCH_PICO_NATIVE_DEFAULT ON)
set(SWITCH_PICO_CLOCK_DEFAULT 300)
set(SWITCH_PICO_PACKET_FRAMES_DEFAULT 32)
else()
set(SWITCH_PICO_NATIVE_DEFAULT OFF)
set(SWITCH_PICO_CLOCK_DEFAULT 150)
set(SWITCH_PICO_PACKET_FRAMES_DEFAULT 64)
endif()
option(SWITCH_PICO_HAPTICS_EXPERIMENT
"Enable native DualSense haptics and transport diagnostics" ${SWITCH_PICO_NATIVE_DEFAULT})
@ -64,8 +62,15 @@ option(SWITCH_PICO_HAPTICS_EXPERIMENT_RAM
"Execute the native haptics hot path from SRAM" ON)
option(SWITCH_PICO_HD_RUMBLE
"Auto-arm the first eligible DualSense native haptics stream" ${SWITCH_PICO_NATIVE_DEFAULT})
if(SWITCH_PICO_HD_RUMBLE)
set(SWITCH_PICO_HAPTICS_EXPERIMENT ON)
endif()
if(SWITCH2_PROBE_HUB)
set(SWITCH_PICO_CLOCK_DEFAULT 240)
if(SWITCH_PICO_HAPTICS_EXPERIMENT)
set(SWITCH_PICO_CLOCK_DEFAULT 300)
else()
set(SWITCH_PICO_CLOCK_DEFAULT 240)
endif()
endif()
set(SWITCH_PICO_SYS_CLOCK_MHZ "${SWITCH_PICO_CLOCK_DEFAULT}" CACHE STRING
"Pico 2 W CPU clock: 300 MHz default, 150 stock or 400 opt-in")
@ -73,8 +78,8 @@ set_property(CACHE SWITCH_PICO_SYS_CLOCK_MHZ PROPERTY STRINGS 150 240 300 400)
if(NOT SWITCH_PICO_SYS_CLOCK_MHZ MATCHES "^(150|240|300|400)$")
message(FATAL_ERROR "SWITCH_PICO_SYS_CLOCK_MHZ must be 150, 240, 300, or 400")
endif()
if(SWITCH2_PROBE_HUB AND NOT SWITCH_PICO_SYS_CLOCK_MHZ STREQUAL "240")
message(FATAL_ERROR "Native SIO hub requires SWITCH_PICO_SYS_CLOCK_MHZ=240")
if(SWITCH2_PROBE_HUB AND NOT SWITCH_PICO_SYS_CLOCK_MHZ MATCHES "^(240|300)$")
message(FATAL_ERROR "Native SIO hub requires SWITCH_PICO_SYS_CLOCK_MHZ=240 or 300")
endif()
set(SWITCH_PICO_OVERCLOCK_MV "1300" CACHE STRING
"Experimental core voltage: 1300 mV, or explicit 1400 mV at 400 MHz")
@ -95,17 +100,13 @@ option(SWITCH_PICO_HCI_CREDIT_BUFFER
if(SWITCH_PICO_HCI_CREDIT_BUFFER AND NOT SWITCH_PICO_HCI_CREDIT_BATCH)
message(FATAL_ERROR "The dedicated HCI credit buffer requires credit batching")
endif()
if(SWITCH_PICO_HD_RUMBLE)
set(SWITCH_PICO_HAPTICS_EXPERIMENT ON)
set(SWITCH_PICO_HD_PACKET_FRAMES "32" CACHE STRING
"Native stereo frames per packet: only the qualified 32-frame format is supported")
set_property(CACHE SWITCH_PICO_HD_PACKET_FRAMES PROPERTY STRINGS 32)
if(NOT SWITCH_PICO_HD_PACKET_FRAMES STREQUAL "32")
message(FATAL_ERROR "Native haptics requires 32-frame packets; the non-working 64-frame format is unsupported")
endif()
set(SWITCH_PICO_HD_PACKET_FRAMES "${SWITCH_PICO_PACKET_FRAMES_DEFAULT}" CACHE STRING
"Native stereo frames per packet: 32 default, 64 unqualified experiment")
set_property(CACHE SWITCH_PICO_HD_PACKET_FRAMES PROPERTY STRINGS 32 64)
if(NOT SWITCH_PICO_HD_PACKET_FRAMES MATCHES "^(32|64)$")
message(FATAL_ERROR "SWITCH_PICO_HD_PACKET_FRAMES must be 32 or 64")
endif()
if(SWITCH_PICO_INPUT_BACKEND STREQUAL "BLUEPAD32"
AND SWITCH_PICO_HAPTICS_EXPERIMENT AND SWITCH_PICO_HD_PACKET_FRAMES STREQUAL "32")
if(SWITCH_PICO_INPUT_BACKEND STREQUAL "BLUEPAD32" AND SWITCH_PICO_HAPTICS_EXPERIMENT)
if(NOT SWITCH_PICO_CYW43_PACKET_READ OR NOT SWITCH_PICO_HCI_CREDIT_BATCH
OR SWITCH_PICO_SYS_CLOCK_MHZ LESS 300)
message(FATAL_ERROR "32-frame native transport requires packet reads, credit batching and at least 300 MHz")