Skip to content

[Feature Request] [Input / Windows] Nintendo Switch 2 Pro Controller (057E:2069) not detected over USB because bundled crueter-ci/SDL3 is built without libusb (SDL_hidapi_switch2 omitted) #770

Open

Description

@sbculg

What do you want ?

Summary
On Windows 10/11, the wired Nintendo Switch 2 Pro Controller (VID 057E / PID 2069) is currently not detected by the emulator (buttons, sticks, 250Hz IMU gyro, and HD rumble are completely unresponsive unless routed through external wrappers).

Root Cause Analysis

  1. Protocol & Driver Requirement (SDL_hidapi_switch2.c): Unlike the original Switch 1 Pro Controller, the Switch 2 Pro Controller boots asleep (answering interrupt IN polls on Interface 0 with NAK) until it receives an initialization and wake handshake over USB Interface 1 (Vendor Class 0xFF, WinUSB bulk endpoints, GUID {6F13725E-EF0E-4FD3-AE5F-B2DE989EC825}). Valve already contributed full native support for this controller (wake handshake, SPI flash calibration reads, report 0x05 250Hz 6-axis IMU streaming, and report 0x02 40-bit HD rumble) to upstream SDL3 in src/joystick/hidapi/SDL_hidapi_switch2.c (SDL Discourse #62142).

  2. Why It Fails in Current Windows Builds: In SDL3, SDL_hidapi_switch2.c is guarded by #ifdef HAVE_LIBUSB (SDL_HIDAPI_LIBUSB). Inspecting the Windows executable symbols shows that while the emulator links libusb-1.0.dll for joycon_driver.cpp, the prebuilt static SDL3 package pulled via cpmfile.json (crueter-ci/SDL3, 3.4.14-1788231389-147a8ee32d) was compiled without libusb support enabled. As a result, SDL_hidapi_switch2.c (SDL_JOYSTICK_HIDAPI_SWITCH2) was completely stripped at compile time.

Verification & Working User Workaround
We verified this root cause by compiling a standalone SDL3.dll from upstream libsdl-org/SDL on Windows x64 with libusb-1.0.29 enabled (SDL Issue #14742) and injecting it at runtime via SDL's built-in dynamic API override (SDL3_DYNAMIC_API=\SDL3.dll). With this override, the emulator natively wakes and recognizes the wired Switch 2 Pro Controller out of the box with full 250Hz gyroscope motion and rumble support.

Suggested Upstream Fix
Update the Windows CI build of crueter-ci/SDL3 (or the CMake configuration when building SDL3 from source) to pass libusb-1.0 so HAVE_LIBUSB / SDL_JOYSTICK_HIDAPI_SWITCH2 is compiled into SDL3:
-DSDL_HIDAPI=ON -DSDL_HIDAPI_LIBUSB=ON -DSDL_HIDAPI_LIBUSB_SHARED=OFF # or ON since libusb-1.0.dll is already shipped -DLibUSB_INCLUDE_PATH="<path_to_libusb_include>" -DLibUSB_LIBRARY="<path_to_libusb-1.0.lib>"


由于预编译的 crueter-ci/SDL3 静态库未开启 libusb 编译选项,导致有线连接的 Switch 2 Pro 手柄 (057E:2069) 无法被原生识别

问题概述
在 Windows 10/11 环境下,通过 USB 有线连接 Nintendo Switch 2 Pro 手柄(VID 057E / PID 2069)时,模拟器完全无法识别该手柄的按键、摇杆、250Hz 陀螺仪体感及震动。

根本原因定位

1.硬件握手与驱动来源(SDL_hidapi_switch2.c):与初代 Switch Pro 手柄不同,NS2 Pro 手柄插入 USB 后默认处于休眠状态,必须通过 USB Interface 1(Vendor Class 0xFF,基于 WinUSB 的 Bulk 批量传输端点,设备 GUID 为 {6F13725E-EF0E-4FD3-AE5F-B2DE989EC825}) 发送特定的握手序列才能唤醒并开启包含三轴陀螺仪数据的 0x05 号输入报告。Valve(Steam 团队)早已将该手柄的完整原生驱动(含唤醒握手、SPI 闪存出厂校准读取、250Hz 六轴陀螺仪解析及 0x02 号 40-bit 双频 HD 震动支持)贡献给了上游 SDL3 官方库(位于 src/joystick/hidapi/SDL_hidapi_switch2.c,见 SDL 官方提交记录)。

2.为什么当前模拟器构建版本缺失该驱动:在 SDL3 源码中,SDL_hidapi_switch2.c 依赖 #ifdef HAVE_LIBUSB 宏。通过逆向检查模拟器 Windows 版 .exe 符号表发现,虽然模拟器自身为了 joycon_driver.cpp 链接了 libusb-1.0.dll,但 cpmfile.json 拉取的预编译静态库 crueter-ci/SDL3(3.4.14)在编译时未传入 libusb 依赖,导致整个 SDL_hidapi_switch2.c(SDL_JOYSTICK_HIDAPI_SWITCH2)在编译阶段被剔除。

实测验证与修复建议
我们通过上游 libsdl-org/SDL 配合 libusb-1.0.29(参考 SDL Issue #14742)编译了开启 SDL_HIDAPI_LIBUSB=ON 的 SDL3.dll,并利用模拟器内部保留的 SDL3_DYNAMIC_API 环境变量在启动时动态接管,实测模拟器可立即原生唤醒并识别 NS2 Pro 手柄的按键、陀螺仪与震动。建议在打包 crueter-ci/SDL3 静态库(或主仓库 CMake 配置)时开启 -DSDL_HIDAPI_LIBUSB=ON 并链接仓库已有的 libusb 依赖。

临时解决办法 SDL3.zip

Image

Why it's useful

Nintendo Switch 2 Pro Controller

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions