How tommywabg/switch2connect works
Switch 2 Connect is a Windows controller-connection and emulation application, with companion ESP32-S3 BLE-bridge firmware. The main workflow is to discover a Switch controller over Bluetooth, USB, or the bridge; process its input and motion; then expose it through a selected virtual-controller backend. The README also documents driver management, wired-controller handling, keyboard and gyro mappings, and DualSense haptics. Source excerpts and the index support the core orchestration and selected calls; broader capability links use README evidence, while unsampled implementation details are not inferred.
Main entry points: controller.py Controller runtime · discoverer.py Controller discovery · virtual_controller.py Virtual controller · usb_serial_bridge.py Bridge serial client
Components 23
Connection and discovery
- Application UI
src/gui.py - Controller discovery
src/discoverer.py - Wired HID controller
src/usb_hid_controller.py
Input processing
- Controller runtime
src/controller.py - Profiles and mappings
src/config.py - Gyro processing
src/gyro.py - Keyboard output
src/keyboard_output.py
Emulation and feedback
- Virtual controller
src/virtual_controller.py - WinUHid backend
src/winuhid_client.py - USBIP server
src/usbip_server.py - DualSense USBIP
src/usbip_dualsense_server.py - DualSense haptics
src/dualsense_haptic.py - DualSense reports
src/dualsense_structs.py
Windows integration
- Driver management
src/driver_install_helper.py - HidHide management
src/hidhide.py - PnP configuration
src/pnp_cfgmgr.py - Power policy
src/power_saving.py - Timer resolution
src/timer_resolution.py
ESP32 bridge
- Bridge serial client
src/usb_serial_bridge.py - ESP32-S3 firmware
ESP32-S3 firmware/esp32s3_usb_bridge/main/main.c - Bluedroid firmware
ESP32-S3 firmware/esp32s3_usb_bridge_bluedroid/main/main.c
Other components
- Player
- Bluetooth controller
Connections 26
- Player → Application UI: configures
README.md - Application UI → Controller discovery: starts discovery
- Controller discovery → Controller runtime: creates controllers
src/discoverer.py - Controller discovery → Wired HID controller: scans USB
src/discoverer.py - Bluetooth controller → Controller discovery: advertises
README.md - Controller discovery → Bridge serial client: detects bridge
src/discoverer.py - Bridge serial client → ESP32-S3 firmware: sends commands
- Bridge serial client → Bluedroid firmware: sends commands
- Controller runtime → Profiles and mappings: reads mappings
src/controller.py - Controller runtime → Gyro processing: uses motion processing
src/controller.py - Controller runtime → Keyboard output: emits key input
src/controller.py - Wired HID controller → Controller runtime: provides input
src/usb_hid_controller.py - Bridge serial client → Controller runtime: provides input
src/usb_serial_bridge.py - Controller runtime → Virtual controller: routes input
README.md - Virtual controller → WinUHid backend: uses backend
src/virtual_controller.py - Virtual controller → USBIP server: uses backend
src/virtual_controller.py - Virtual controller → DualSense USBIP: starts PS5 server
src/virtual_controller.py - DualSense USBIP → DualSense reports: uses reports
src/usbip_dualsense_server.py - DualSense USBIP → DualSense haptics: uses haptic processing
src/usbip_dualsense_server.py - Application UI → Driver management: manages drivers
README.md - Driver management → PnP configuration: checks devices
src/driver_install_helper.py - Driver management → HidHide management: checks HidHide
src/driver_install_helper.py - Wired HID controller → HidHide management: supports hiding
src/usb_hid_controller.py - Power policy → Timer resolution: sets timer policy
src/power_saving.py - Controller runtime → Power policy: observes policy
src/controller.py - Player → Bluetooth controller: pairs by sync
README.md