feat(builder): the Switch 2 Pro Controller over Bluetooth (Windows) #3244

Merged
llun merged 2 commits from fofuxo/Longshot:feat/switch2-bluetooth into main 2026-12-06 05:34:09 +00:00
Contributor

Summary

A Switch 2 Pro Controller over Bluetooth did nothing in Longshot: the builder's driver (build_core::switch2) read it
over USB only, and Windows has nothing a game can use for it over the air. It is not a Bluetooth HID device but a
Bluetooth LE peripheral with a GATT service of Nintendo's own, so pairing it in Windows' settings never makes it a
gamepad. Players used a bridge program and lost its motion sensor and rumble.

Now the builder takes it over Bluetooth too, with its sticks, buttons, gyroscope and rumble: hold the controller's SYNC
button with the game running and the builder pairs it with this PC; from then on any button wakes it. A controller
paired with a console stays the console's (the builder leaves it alone until SYNC is held). The NFC reader stays
USB only.

  • builder/crates/build-core/src/switch2/ble.rs (new): the protocol on its own (the advertisement's Nintendo data, which
    controller is taken, the commands with byte 2 saying Bluetooth, an answer told from its acknowledgement, the pairing's
    four commands, a report, the vibration payload), tested on canned bytes; and os, the WinRT link: the advertisement
    watcher, the GATT connection (session held first, the service looked up uncached, the 7.5 ms connection interval asked
    for, the answer and input characteristics subscribed to), the command pipe and the vibration writes.
  • switch2.rs: the commands, the flash reads (subcommand 4 over the air), the calibration and the report are the USB
    ones through the Pipe trait, which now says which link it is; a second virtual pad and rumble thread for the air link
    (SHARED[USB] / SHARED[BT], generic callbacks); ble_main, the link's thread.
  • The cable wins. A controller on Bluetooth that a cable is plugged into goes on talking over the air, and the cable's
    start-up changes what it sends there: before that start-up the cable asks the controller its own Bluetooth address
    (command 0x15, subcommand 1 with no host given, bluetooth_address), and that controller's air link alone is dropped
    (CABLED holds the address, on_cable); a button wakes it on Bluetooth again once the cable is pulled. Another
    Switch 2 Pro Controller keeps its air link: one on each link is two players. A controller that does not say its
    address is taken to be any (every air link let go while it is plugged in). Such a controller, still leaving its air
    link, also drops the cable's first start-up commands, the features among them (it then streamed with no motion and
    its trigger bits flickering): the USB start-up is sent again while commands go unanswered (start_settled), and two
    unanswered in a row end a try at once, each costing the pipe's half second.
  • The Bluetooth thread waits for an adapter: with no Bluetooth LE adapter at the start it looks again every 5 s (and
    reads its address again whenever the watcher stops), and the advertisements heard wait in a bounded queue (16),
    dropped past it while a controller is connected.
  • Over the air the rumble goes every 8 ms instead of 12: writes are unacknowledged (waiting would hold up the reports
    sharing the link), and at 12 ms one lost now and then left a gap felt in most Test vibration runs.
  • New crate feature, no new crate: windows 0.62.2 (already in Cargo.lock through Slint's winit) with the Bluetooth,
    GATT, collections and streams features, Windows only.

The protocol is the community's: https://github.com/ndeadly/switch2_controller_research, and the GATT UUIDs, the
Bluetooth start-up, the pairing and the cable's dropped start-up as https://github.com/uayten/JoyShockLibrary4Unreal
measured and uses them (as does mkw-recomp, the source of the Bluetooth support the issue links). Nothing is copied:
the code is written here.

Fixes #2670. On top of #3239 (rumble strength over USB, merged): the air link takes its strength too, and
docs/dev/reference/input.md's rumble paragraph says USB or Bluetooth with #3239's text.

Testing

Tested: Windows 11 Pro (build 26300), AMD Ryzen 9 5900X, NVIDIA GeForce RTX 3070 (driver 621.47), a Switch 2 Pro
Controller (firmware as shipped) over Bluetooth on the PC's own adapter (Intel Wireless Bluetooth on the
board, USB 8087:0025), and over USB. A runtime of this branch over
main's base (dev.py rt), from a copy of my own profile:

  • Paired by holding SYNC with the game running; after a restart of the game and of the controller, any button
    reconnected it with no SYNC. Log: switch2: Switch 2 Pro Controller over Bluetooth (…): started (sticks calibrated at 2029 2092 / 2128 2100), the same centres the USB start reads; its reports over Bluetooth: 104 a second.
  • Buttons, sticks, Controls › Test vibration and Controls › Motion (aiming an item the Inventory cheat gave) over
    Bluetooth; Test vibration over USB.
  • Over the air the rumble's writes are unacknowledged: at 12 ms a lost one left a short gap felt in most Test vibration
    runs; at 8 ms, much more rarely (by feel).
  • Cable and air in turn, several times: plugged in on Bluetooth, the air link let go (a controller is on the cable: the cable has it) and the cable took it (over USB: started, reports arrive (ID 05, 64 bytes)); pulled, a button
    brought it back on Bluetooth. Before the cable fix the same plug gave random inputs (the left trigger flickering every
    5 to 10 ms, the menu opened) and no motion.
  • After the review's fixes, rebased on main @ a2b7abf9, a runtime over the base 7bc53f84: the cable said the
    controller's address, the same as its air link's (the controller on the cable is 4044f7ed86cc on Bluetooth, over Bluetooth (4044f7ed86cc): started); plugged in twice and pulled twice, the cable took it (once the controller
    dropped its air link itself, once it is on the cable now: the cable has it) and a button brought it back over the
    air; buttons, sticks, Motion and Test vibration over Bluetooth with #3239's strength. Started with the PC's Bluetooth
    switched off (advertisements cannot be watched ... retrying), switched on in game: a button connected it, 109
    reports a second. Beside it a DualShock 4 and Joy-Cons (a pair as one, and single), four pads at once, each working.
    HOS_SWITCH2_HD=1 on the cable (#3239's still to test): HD rumble (RenHDrum), Test vibration at another pitch
    and no stronger or weaker by feel; hitting a wall, a long fall and falling into water each stopped with its effect,
    none stuck.
  • cargo test -p build-core switch2: 16 passed (8 new: the cable's address question and which air link it lets go; the advertisement and what is taken, the commands and answers,
    the pairing, the vibration payload, the calibration over the air past each block's acknowledgement, a notification as
    the USB report, a start-up dropped and sent again). Undoing the air link's flash read ((cmd[2], cmd[3]) = (0x01, 0x04)) fails over_bluetooth_the_calibration_is_read_past_each_block_s_acknowledgement.
  • cargo test -p build-core: 246 passed, 2 ignored on the rebased head (208 and 1 before it). Before the review:
    dev.py test-changed: the crates' tests and the Python checks
    that read the changed files; test_switch_table (the two rows' new text) and test_cargo_lock_sources pass.
  • mise run test on Windows 11, with WinLibs' GCC and the checkout's llvm-mingw clang first on the PATH: 829 passed,
    52 skipped, 30 failed: the same 30 that fail on main @ 7bc53f84 in this environment, listed by cause in #3239's
    Testing (the C compiler beside {cxx}, glslang's file name, no spirv-val or llvm-mc, no symlink privilege, fixtures
    that don't compile here, and five not looked into). None is in the code this changes. test_driver_env_choose,
    test_guest_page_fast32 and test_mesh_fallback_layout failed once in test-changed, 24 at once, and pass in the
    full run.
  • cargo clippy -p build-core --all-targets -- -D warnings: clean on the rebased head; rustfmt clean.

Still to test:

  • Windows, a Switch 2 Pro Controller over Bluetooth on an adapter other than Intel's (Realtek, MediaTek, a USB dongle): pair with SYNC,
    play a while with rumble and Motion on, expecting the same, and the log's report rate near 100 a second or more (by
    hand)
  • Windows, two Switch 2 Pro Controllers, one on the cable and one over Bluetooth: both play as two pads, and plugging
    the second one's cable in lets go of its own air link alone (by hand; I have one)
  • Windows, no Bluetooth LE adapter at the start (a USB dongle plugged in, or the adapter enabled in Device Manager,
    with the game running): a button connects the controller with no restart (by hand; this PC's adapter is on the
    board, tested switched off and on only)

Measurements

Nothing to measure: the driver runs on threads of its own in the builder, as the USB one does; with no Bluetooth LE adapter its thread asks Windows for one every 5 s and sleeps between. The cable's address question adds one command (half a second at most when unanswered, three tries) to a USB start-up.

Risks

  • A PC with a Switch 2 Pro Controller paired with it now has the builder connect to it when a button is pressed, as a
    player expects; HOS_SWITCH2=0 (the game's switches) still leaves the controller, on both links, to a bridge program.
  • Bluetooth audio on the same adapter shares its airtime with the controller's 7.5 ms interval; seen no effect on a
    wireless headset during these tests.
  • A rare short gap in rumble over the air remains (a lost unacknowledged write).
  • Not taken over Bluetooth: the Joy-Con 2 and the GameCube controller (their product ids are refused): they need
    start-ups and reports of their own.
  • A revert is enough; nothing changes in saves or settings.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary A Switch 2 Pro Controller over Bluetooth did nothing in Longshot: the builder's driver (`build_core::switch2`) read it over USB only, and Windows has nothing a game can use for it over the air. It is not a Bluetooth HID device but a Bluetooth LE peripheral with a GATT service of Nintendo's own, so pairing it in Windows' settings never makes it a gamepad. Players used a bridge program and lost its motion sensor and rumble. Now the builder takes it over Bluetooth too, with its sticks, buttons, gyroscope and rumble: hold the controller's SYNC button with the game running and the builder pairs it with this PC; from then on any button wakes it. A controller paired with a console stays the console's (the builder leaves it alone until SYNC is held). The NFC reader stays USB only. - `builder/crates/build-core/src/switch2/ble.rs` (new): the protocol on its own (the advertisement's Nintendo data, which controller is taken, the commands with byte 2 saying Bluetooth, an answer told from its acknowledgement, the pairing's four commands, a report, the vibration payload), tested on canned bytes; and `os`, the WinRT link: the advertisement watcher, the GATT connection (session held first, the service looked up uncached, the 7.5 ms connection interval asked for, the answer and input characteristics subscribed to), the command pipe and the vibration writes. - `switch2.rs`: the commands, the flash reads (subcommand 4 over the air), the calibration and the report are the USB ones through the `Pipe` trait, which now says which link it is; a second virtual pad and rumble thread for the air link (`SHARED[USB]` / `SHARED[BT]`, generic callbacks); `ble_main`, the link's thread. - The cable wins. A controller on Bluetooth that a cable is plugged into goes on talking over the air, and the cable's start-up changes what it sends there: before that start-up the cable asks the controller its own Bluetooth address (command 0x15, subcommand 1 with no host given, `bluetooth_address`), and that controller's air link alone is dropped (`CABLED` holds the address, `on_cable`); a button wakes it on Bluetooth again once the cable is pulled. Another Switch 2 Pro Controller keeps its air link: one on each link is two players. A controller that does not say its address is taken to be any (every air link let go while it is plugged in). Such a controller, still leaving its air link, also drops the cable's first start-up commands, the features among them (it then streamed with no motion and its trigger bits flickering): the USB start-up is sent again while commands go unanswered (`start_settled`), and two unanswered in a row end a try at once, each costing the pipe's half second. - The Bluetooth thread waits for an adapter: with no Bluetooth LE adapter at the start it looks again every 5 s (and reads its address again whenever the watcher stops), and the advertisements heard wait in a bounded queue (16), dropped past it while a controller is connected. - Over the air the rumble goes every 8 ms instead of 12: writes are unacknowledged (waiting would hold up the reports sharing the link), and at 12 ms one lost now and then left a gap felt in most Test vibration runs. - New crate feature, no new crate: `windows` 0.62.2 (already in `Cargo.lock` through Slint's winit) with the Bluetooth, GATT, collections and streams features, Windows only. The protocol is the community's: https://github.com/ndeadly/switch2_controller_research, and the GATT UUIDs, the Bluetooth start-up, the pairing and the cable's dropped start-up as https://github.com/uayten/JoyShockLibrary4Unreal measured and uses them (as does mkw-recomp, the source of the Bluetooth support the issue links). Nothing is copied: the code is written here. Fixes #2670. On top of #3239 (rumble strength over USB, merged): the air link takes its strength too, and `docs/dev/reference/input.md`'s rumble paragraph says USB or Bluetooth with #3239's text. ## Testing **Tested:** Windows 11 Pro (build 26300), AMD Ryzen 9 5900X, NVIDIA GeForce RTX 3070 (driver 621.47), a Switch 2 Pro Controller (firmware as shipped) over Bluetooth on the PC's own adapter (Intel Wireless Bluetooth on the board, USB 8087:0025), and over USB. A runtime of this branch over main's base (`dev.py rt`), from a copy of my own profile: - Paired by holding SYNC with the game running; after a restart of the game and of the controller, any button reconnected it with no SYNC. Log: `switch2: Switch 2 Pro Controller over Bluetooth (…): started (sticks calibrated at 2029 2092 / 2128 2100)`, the same centres the USB start reads; `its reports over Bluetooth: 104 a second`. - Buttons, sticks, Controls › Test vibration and Controls › Motion (aiming an item the Inventory cheat gave) over Bluetooth; Test vibration over USB. - Over the air the rumble's writes are unacknowledged: at 12 ms a lost one left a short gap felt in most Test vibration runs; at 8 ms, much more rarely (by feel). - Cable and air in turn, several times: plugged in on Bluetooth, the air link let go (`a controller is on the cable: the cable has it`) and the cable took it (`over USB: started`, `reports arrive (ID 05, 64 bytes)`); pulled, a button brought it back on Bluetooth. Before the cable fix the same plug gave random inputs (the left trigger flickering every 5 to 10 ms, the menu opened) and no motion. - After the review's fixes, rebased on `main` @ a2b7abf9, a runtime over the base 7bc53f84: the cable said the controller's address, the same as its air link's (`the controller on the cable is 4044f7ed86cc on Bluetooth`, `over Bluetooth (4044f7ed86cc): started`); plugged in twice and pulled twice, the cable took it (once the controller dropped its air link itself, once `it is on the cable now: the cable has it`) and a button brought it back over the air; buttons, sticks, Motion and Test vibration over Bluetooth with #3239's strength. Started with the PC's Bluetooth switched off (`advertisements cannot be watched ... retrying`), switched on in game: a button connected it, 109 reports a second. Beside it a DualShock 4 and Joy-Cons (a pair as one, and single), four pads at once, each working. `HOS_SWITCH2_HD=1` on the cable (#3239's still to test): `HD rumble (RenHDrum)`, Test vibration at another pitch and no stronger or weaker by feel; hitting a wall, a long fall and falling into water each stopped with its effect, none stuck. - `cargo test -p build-core switch2`: 16 passed (8 new: the cable's address question and which air link it lets go; the advertisement and what is taken, the commands and answers, the pairing, the vibration payload, the calibration over the air past each block's acknowledgement, a notification as the USB report, a start-up dropped and sent again). Undoing the air link's flash read (`(cmd[2], cmd[3]) = (0x01, 0x04)`) fails `over_bluetooth_the_calibration_is_read_past_each_block_s_acknowledgement`. - `cargo test -p build-core`: 246 passed, 2 ignored on the rebased head (208 and 1 before it). Before the review: `dev.py test-changed`: the crates' tests and the Python checks that read the changed files; `test_switch_table` (the two rows' new text) and `test_cargo_lock_sources` pass. - `mise run test` on Windows 11, with WinLibs' GCC and the checkout's llvm-mingw clang first on the PATH: 829 passed, 52 skipped, 30 failed: the same 30 that fail on `main` @ 7bc53f84 in this environment, listed by cause in #3239's Testing (the C compiler beside `{cxx}`, glslang's file name, no spirv-val or llvm-mc, no symlink privilege, fixtures that don't compile here, and five not looked into). None is in the code this changes. `test_driver_env_choose`, `test_guest_page_fast32` and `test_mesh_fallback_layout` failed once in `test-changed`, 24 at once, and pass in the full run. - `cargo clippy -p build-core --all-targets -- -D warnings`: clean on the rebased head; rustfmt clean. **Still to test:** - Windows, a Switch 2 Pro Controller over Bluetooth on an adapter other than Intel's (Realtek, MediaTek, a USB dongle): pair with SYNC, play a while with rumble and Motion on, expecting the same, and the log's report rate near 100 a second or more (by hand) - Windows, two Switch 2 Pro Controllers, one on the cable and one over Bluetooth: both play as two pads, and plugging the second one's cable in lets go of its own air link alone (by hand; I have one) - Windows, no Bluetooth LE adapter at the start (a USB dongle plugged in, or the adapter enabled in Device Manager, with the game running): a button connects the controller with no restart (by hand; this PC's adapter is on the board, tested switched off and on only) ## Measurements Nothing to measure: the driver runs on threads of its own in the builder, as the USB one does; with no Bluetooth LE adapter its thread asks Windows for one every 5 s and sleeps between. The cable's address question adds one command (half a second at most when unanswered, three tries) to a USB start-up. ## Risks - A PC with a Switch 2 Pro Controller paired with it now has the builder connect to it when a button is pressed, as a player expects; `HOS_SWITCH2=0` (the game's switches) still leaves the controller, on both links, to a bridge program. - Bluetooth audio on the same adapter shares its airtime with the controller's 7.5 ms interval; seen no effect on a wireless headset during these tests. - A rare short gap in rumble over the air remains (a lost unacknowledged write). - Not taken over Bluetooth: the Joy-Con 2 and the GameCube controller (their product ids are refused): they need start-ups and reports of their own. - A revert is enough; nothing changes in saves or settings. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(builder): the Switch 2 Pro Controller over Bluetooth (Windows)
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
3a3d79995e
The builder's Switch 2 Pro Controller driver read the controller over
USB only. Over Bluetooth the controller is no HID device: a Bluetooth LE
peripheral with a GATT service of Nintendo's own, which Windows never
makes a gamepad. Now the builder watches the controllers'
advertisements (WinRT), takes one pairing (SYNC held) or paired with
this PC, pairs it the controller's own way, starts and calibrates it
with the USB commands on the service's command characteristic, and gives
its reports to a virtual pad of its own: sticks, buttons, motion and
rumble. A controller paired with another host is left to it.

The cable wins: a controller plugged in while on Bluetooth is let go on
the air, and the USB start-up is sent again while the controller, still
leaving its air link, drops its commands (it streamed with no motion
and its trigger bits flickering until then). Two commands unanswered in
a row end a start: each cost half a second.

switch2/ble.rs holds the protocol (advertisement, commands, answers,
pairing, report, vibration) and the WinRT link; tests on canned bytes.

Fixes #2670

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 Pro 26300, Ryzen 9 5900X, RTX 3070 (driver 621.47), a Switch 2 Pro Controller over Bluetooth on the PC's own adapter and over USB: a runtime of this branch over main's base, from a copy of my profile. Paired with SYNC, woken by a button after; buttons, sticks, Test vibration and Motion aiming over Bluetooth; cable and air in turn several times, the cable taking it and a button bringing it back over the air; 104 reports a second over Bluetooth.

Tested in game: Windows 11 Pro 26300, Ryzen 9 5900X, RTX 3070 (driver 621.47), a Switch 2 Pro Controller over Bluetooth on the PC's own adapter and over USB: a runtime of this branch over main's base, from a copy of my profile. Paired with SYNC, woken by a button after; buttons, sticks, Test vibration and Motion aiming over Bluetooth; cable and air in turn several times, the cable taking it and a button bringing it back over the air; 104 reports a second over Bluetooth.
fofuxo changed title from WIP: feat(builder): the Switch 2 Pro Controller over Bluetooth (Windows) to feat(builder): the Switch 2 Pro Controller over Bluetooth (Windows) 2026-12-05 12:14:53 +00:00
Owner
@rebase
Member

I rebased this pull request onto main (b6330a5b0b): the new head is a2906ec88c.

Conflicts resolved

  • builder/crates/build-core/src/switch2.rs: Kept motion enabled and the separate USB and Bluetooth callbacks; added the required motion argument to the Bluetooth pad call.
  • docs/dev/reference/input.md: Kept the Bluetooth controller documentation and the GameCube adapter entry.

Nothing was built or run: read the resolution before merging.


Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I rebased this pull request onto `main` (b6330a5b0b0e): the new head is a2906ec88c40. **Conflicts resolved** - builder/crates/build-core/src/switch2.rs: Kept motion enabled and the separate USB and Bluetooth callbacks; added the required motion argument to the Bluetooth pad call. - docs/dev/reference/input.md: Kept the Bluetooth controller documentation and the GameCube adapter entry. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed feat/switch2-bluetooth from 3a3d79995e
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to a2906ec88c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-05 17:12:43 +00:00
Compare
BeanBot requested changes 2026-12-05 17:14:22 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The Bluetooth driver prevents a separate Bluetooth controller from working whenever a USB controller is connected. Its advertisement queue can also grow throughout a long session.

Adds Windows Bluetooth LE support for the Switch 2 Pro Controller, including motion and rumble, using the existing virtual-pad path. The basic connection worked in the author's game run, but controller selection and resource handling need changes.

Blocking (1): must change before merging.

  1. L1 builder/crates/build-core/src/switch2.rs:1308: The cable flag suppresses every Bluetooth controller, including a different physical controller. (more on the line) Do: Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device.

Should fix (2): not blocking, but worth doing before merging.

  • L2 builder/crates/build-core/src/switch2/ble.rs:247: The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller. (more on the line) Do: Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected.
  • L3 builder/crates/build-core/src/switch2.rs:1259: Bluetooth discovery exits permanently if no LE adapter is available at startup. (more on the line) Do: Retry adapter discovery while the driver is running, including after a radio or adapter change.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The new Windows Bluetooth path has only been exercised on one adapter. When: Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. Do: Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate.

@fix can do L1, L2 and L3.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • builder/crates/build-core/src/switch2/ble.rs:45: Can a Switch 2 Pro Controller paired with another host advertise a manufacturer-data section containing the IDs but fewer than 16 bytes?

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested setup: the author reports pairing, reconnecting, buttons, sticks, motion and rumble working on Windows 11, with 104 reports per second. Other Bluetooth adapters remain untested.

Other systems: The Windows USB driver and its startup path also change; the author tested USB rumble and repeated cable handoffs. Linux does not compile the WinRT link. A different Bluetooth adapter and coexistence with a second controller need testing.

Switches: HOS_SWITCH2 remains on by default on Windows and now enables Bluetooth as well as USB; HOS_SWITCH2_HD remains off by default and now applies to Bluetooth too. Their table entries and documentation were updated.

Reviewed: a2906ec88c against b6330a5b0b: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit and all changed code and documentation. Skimmed the lockfile change and recorded test results. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance and the changed files contain no apparent game-derived output.
  • The Bluetooth queues and shared controller state use locks or atomics; the command and report buffers examined have explicit length checks.
  • The Windows run reported in the pull request covers pairing, reconnecting, motion, rumble and repeated USB handoffs.

Testing: Read-only review; no code, tests or project scripts were run. CI has not run on this head.

Overlaps and merge order: The description identifies Longshot#3239 as overlapping the input reference documentation; the second pull request to land needs that line rebased.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The Bluetooth driver prevents a separate Bluetooth controller from working whenever a USB controller is connected. Its advertisement queue can also grow throughout a long session. Adds Windows Bluetooth LE support for the Switch 2 Pro Controller, including motion and rumble, using the existing virtual-pad path. The basic connection worked in the author's game run, but controller selection and resource handling need changes. **Blocking (1)**: must change before merging. 1. **L1** `builder/crates/build-core/src/switch2.rs:1308`: The cable flag suppresses every Bluetooth controller, including a different physical controller. (more on the line) **Do:** Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device. **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `builder/crates/build-core/src/switch2/ble.rs:247`: The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller. (more on the line) **Do:** Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected. - **L3** `builder/crates/build-core/src/switch2.rs:1259`: Bluetooth discovery exits permanently if no LE adapter is available at startup. (more on the line) **Do:** Retry adapter discovery while the driver is running, including after a radio or adapter change. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The new Windows Bluetooth path has only been exercised on one adapter. *When:* Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. **Do:** Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate. `@fix` can do L1, L2 and L3. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `builder/crates/build-core/src/switch2/ble.rs:45`: Can a Switch 2 Pro Controller paired with another host advertise a manufacturer-data section containing the IDs but fewer than 16 bytes? **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested setup: the author reports pairing, reconnecting, buttons, sticks, motion and rumble working on Windows 11, with 104 reports per second. Other Bluetooth adapters remain untested. **Other systems:** The Windows USB driver and its startup path also change; the author tested USB rumble and repeated cable handoffs. Linux does not compile the WinRT link. A different Bluetooth adapter and coexistence with a second controller need testing. **Switches:** HOS_SWITCH2 remains on by default on Windows and now enables Bluetooth as well as USB; HOS_SWITCH2_HD remains off by default and now applies to Bluetooth too. Their table entries and documentation were updated. **Reviewed:** a2906ec88c40 against b6330a5b0b0e: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the commit and all changed code and documentation. Skimmed the lockfile change and recorded test results. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance and the changed files contain no apparent game-derived output. - The Bluetooth queues and shared controller state use locks or atomics; the command and report buffers examined have explicit length checks. - The Windows run reported in the pull request covers pairing, reconnecting, motion, rumble and repeated USB handoffs. **Testing:** Read-only review; no code, tests or project scripts were run. CI has not run on this head. **Overlaps and merge order:** The description identifies Longshot#3239 as overlapping the input reference documentation; the second pull request to land needs that line rebased. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
@ -1129,0 +1256,4 @@
use super::ble::{self, Take};
use std::collections::{HashMap, HashSet};
use std::time::{Duration, Instant};
let Some(host) = ble::os::adapter() else {
Member

L3 (should fix): Bluetooth discovery exits permanently if no LE adapter is available at startup.

When: A player starts the game before plugging in a Bluetooth dongle; adapter() returns None and the thread returns, so holding SYNC after the dongle is connected does nothing until the game is restarted.

Do: Retry adapter discovery while the driver is running, including after a radio or adapter change.

**L3** (should fix): Bluetooth discovery exits permanently if no LE adapter is available at startup. *When:* A player starts the game before plugging in a Bluetooth dongle; adapter() returns None and the thread returns, so holding SYNC after the dongle is connected does nothing until the game is restarted. **Do:** Retry adapter discovery while the driver is running, including after a radio or adapter change.
@ -1129,0 +1305,4 @@
Take::Pair => true,
Take::Ours => false,
};
if CABLED.load(Ordering::SeqCst) || later.get(&address).is_some_and(|t| Instant::now() < *t) {
Member

L1 (blocking): The cable flag suppresses every Bluetooth controller, including a different physical controller.

When: With one Pro Controller connected over USB, CABLED is true; an independently paired second controller's advertisement is discarded, and an already connected Bluetooth pad is dropped. The advertised one-controller-per-link setup cannot work.

Do: Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device.

**L1** (blocking): The cable flag suppresses every Bluetooth controller, including a different physical controller. *When:* With one Pro Controller connected over USB, CABLED is true; an independently paired second controller's advertisement is discarded, and an already connected Bluetooth pad is dropped. The advertised one-controller-per-link setup cannot work. **Do:** Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device.
@ -0,0 +244,4 @@
w.Start()?;
Ok(Self(w))
}
Member

L2 (should fix): The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller.

When: During a long Bluetooth play session, ble_main processes reports and does not drain rx until disconnect. Every matching manufacturer-data advertisement received in that time remains queued, so memory grows with session length and nearby advertising traffic.

Do: Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected.

**L2** (should fix): The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller. *When:* During a long Bluetooth play session, ble_main processes reports and does not drain rx until disconnect. Every matching manufacturer-data advertisement received in that time remains queued, so memory grows with session length and nearby advertising traffic. **Do:** Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected.
Owner
@fix
Member

I didn't fix this pull request: the change I made would remove a switch this pull request adds (let (tx, rx) = std::sync::mpsc::channel(); in builder/crates/build-core/src/switch2.rs), which undoes it. So L2 and L3 are the author's now. Nothing was pushed.


Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

I didn't fix this pull request: the change I made would remove a switch this pull request adds (`let (tx, rx) = std::sync::mpsc::channel();` in `builder/crates/build-core/src/switch2.rs`), which undoes it. So L2 and L3 are the author's now. Nothing was pushed. --- <sub>Automated fix by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Owner

@fix it properly

@fix it properly
BeanBot force-pushed feat/switch2-bluetooth from a2906ec88c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 808955407c
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-05 17:25:32 +00:00
Compare
BeanBot left a comment

Recommendation: Request changes. A wired controller suppresses a separate Bluetooth controller, so two players cannot use those links at the same time. Discovery also does not recover when an LE adapter becomes available after startup.

What @fix changed
I changed this pull request: the new head is 808955407c. I rebased it onto main (bd4586c2e3).

Not done

  • Match USB and Bluetooth controllers, switch2.rs:1308: A reliable identity shared by the USB and Bluetooth links is needed before changing the handoff. The checkout exposes the Bluetooth address but does not establish how to obtain the same identity over USB; guessing from calibration or a device path could suppress a different controller.
  • Fix the controller handoff properly: The handoff still needs a verified cross-link identity and matching logic for both advertisements and active connections. No files were changed.

Nothing was built or run: the checks run again on the new head.

The change adds Windows Bluetooth support for the Switch 2 Pro Controller, including motion and rumble, using a separate virtual pad. The in-game test shows the feature working on one adapter, but the global cable flag prevents simultaneous use of distinct wired and wireless controllers.

Blocking (1): must change before merging.

  1. L1 builder/crates/build-core/src/switch2.rs:1308: The cable flag suppresses every Bluetooth controller, including a different physical controller. When: With one Pro Controller connected over USB, CABLED is true; an independently paired second controller's advertisement is discarded, and an already connected Bluetooth pad is dropped. The advertised one-controller-per-link setup cannot work. Do: Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device.

Should fix (2): not blocking, but worth doing before merging.

  • L2 builder/crates/build-core/src/switch2/ble.rs:247: The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller. When: During a long Bluetooth play session, ble_main processes reports and does not drain rx until disconnect. Every matching manufacturer-data advertisement received in that time remains queued, so memory grows with session length and nearby advertising traffic. Do: Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected. (for the author: @fix couldn't: Watch::start still sends every matching advertisement to an unbounded channel, while ble_main does not drain it during a connected session.)
  • L3 builder/crates/build-core/src/switch2.rs:1259: Bluetooth discovery exits permanently if no LE adapter is available at startup. When: A player starts the game before plugging in a Bluetooth dongle; adapter() returns None and the thread returns, so holding SYNC after the dongle is connected does nothing until the game is restarted. Do: Retry adapter discovery while the driver is running, including after a radio or adapter change. (for the author: @fix couldn't: ble_main still returns permanently when adapter() returns None at startup, so a later adapter connection or enablement is not discovered.)

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The new Windows Bluetooth path has only been exercised on one adapter. When: Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. Do: Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate.

@fix can do L1.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested setup: the author reports working controls, motion and rumble at 104 Bluetooth reports per second on one Windows 11 PC. Adapter interoperability remains untested elsewhere.

Other systems: The new BLE path is Windows-only; its behavior on other Bluetooth adapters is unverified. USB and Bluetooth share cable arbitration, which currently affects separate controllers. The author reports no observed Bluetooth headset effect on the tested adapter.

Switches: HOS_SWITCH2 remains enabled by default and now controls both USB and Bluetooth support; HOS_SWITCH2=0 leaves both to a bridge. No new player switch is identified.

Reviewed: 808955407c against bd4586c2e3: Read the repository instructions and contribution rules, the pull request template, and the code paths for the four ledger items. Skimmed the remaining change and recorded runs; the full changed code was not read in this re-check. The historical base diff also contains intervening changes, so the rebased pull request was assessed against bd4586c2e3.; nothing run (a code review).

Checked and fine:

  • The reported Windows run exercised pairing, wake, controls, motion, rumble and cable handoff.
  • The watcher retries if it stops after successful startup.
  • No fix was supplied, so there is no fix diff that could undo the feature.

Testing: The author reports in-game testing on Windows 11 with one Bluetooth adapter and USB, plus Rust tests and broader checks. CI has not yet run on this head; no tests were run during this read-only review.

Overlaps and merge order: Longshot #3239 also changes the input reference paragraph and is reported to supply USB rumble-strength work used by this Bluetooth link; the second pull request to land needs a rebase.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A wired controller suppresses a separate Bluetooth controller, so two players cannot use those links at the same time. Discovery also does not recover when an LE adapter becomes available after startup. **What `@fix` changed** I changed this pull request: the new head is 808955407c9c. I rebased it onto `main` (bd4586c2e3f3). **Not done** - **Match USB and Bluetooth controllers, switch2.rs:1308**: A reliable identity shared by the USB and Bluetooth links is needed before changing the handoff. The checkout exposes the Bluetooth address but does not establish how to obtain the same identity over USB; guessing from calibration or a device path could suppress a different controller. - **Fix the controller handoff properly**: The handoff still needs a verified cross-link identity and matching logic for both advertisements and active connections. No files were changed. Nothing was built or run: the checks run again on the new head. The change adds Windows Bluetooth support for the Switch 2 Pro Controller, including motion and rumble, using a separate virtual pad. The in-game test shows the feature working on one adapter, but the global cable flag prevents simultaneous use of distinct wired and wireless controllers. **Blocking (1)**: must change before merging. 1. **L1** `builder/crates/build-core/src/switch2.rs:1308`: The cable flag suppresses every Bluetooth controller, including a different physical controller. *When:* With one Pro Controller connected over USB, CABLED is true; an independently paired second controller's advertisement is discarded, and an already connected Bluetooth pad is dropped. The advertised one-controller-per-link setup cannot work. **Do:** Identify the physical controller on each link and suppress or disconnect only the Bluetooth link belonging to the cabled device. **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `builder/crates/build-core/src/switch2/ble.rs:247`: The advertisement callback sends into an unbounded channel even while the Bluetooth thread is occupied with a controller. *When:* During a long Bluetooth play session, ble_main processes reports and does not drain rx until disconnect. Every matching manufacturer-data advertisement received in that time remains queued, so memory grows with session length and nearby advertising traffic. **Do:** Use a bounded or coalescing advertisement queue and discard redundant advertisements while a controller is connected. *(for the author: `@fix` couldn't: Watch::start still sends every matching advertisement to an unbounded channel, while ble_main does not drain it during a connected session.)* - **L3** `builder/crates/build-core/src/switch2.rs:1259`: Bluetooth discovery exits permanently if no LE adapter is available at startup. *When:* A player starts the game before plugging in a Bluetooth dongle; adapter() returns None and the thread returns, so holding SYNC after the dongle is connected does nothing until the game is restarted. **Do:** Retry adapter discovery while the driver is running, including after a radio or adapter change. *(for the author: `@fix` couldn't: ble_main still returns permanently when adapter() returns None at startup, so a later adapter connection or enablement is not discovered.)* **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The new Windows Bluetooth path has only been exercised on one adapter. *When:* Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. **Do:** Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate. `@fix` can do L1. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested setup: the author reports working controls, motion and rumble at 104 Bluetooth reports per second on one Windows 11 PC. Adapter interoperability remains untested elsewhere. **Other systems:** The new BLE path is Windows-only; its behavior on other Bluetooth adapters is unverified. USB and Bluetooth share cable arbitration, which currently affects separate controllers. The author reports no observed Bluetooth headset effect on the tested adapter. **Switches:** HOS_SWITCH2 remains enabled by default and now controls both USB and Bluetooth support; HOS_SWITCH2=0 leaves both to a bridge. No new player switch is identified. **Reviewed:** 808955407c9c against bd4586c2e3f3: Read the repository instructions and contribution rules, the pull request template, and the code paths for the four ledger items. Skimmed the remaining change and recorded runs; the full changed code was not read in this re-check. The historical base diff also contains intervening changes, so the rebased pull request was assessed against bd4586c2e3f3.; nothing run (a code review). **Checked and fine:** - The reported Windows run exercised pairing, wake, controls, motion, rumble and cable handoff. - The watcher retries if it stops after successful startup. - No fix was supplied, so there is no fix diff that could undo the feature. **Testing:** The author reports in-game testing on Windows 11 with one Bluetooth adapter and USB, plus Rust tests and broader checks. CI has not yet run on this head; no tests were run during this read-only review. **Overlaps and merge order:** Longshot #3239 also changes the input reference paragraph and is reported to supply USB rumble-strength work used by this Bluetooth link; the second pull request to land needs a rebase. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
fofuxo force-pushed feat/switch2-bluetooth from 808955407c
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 669f776190
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-06 02:59:19 +00:00
Compare
Author
Contributor

Rebased on main @ a2b7abf9 (#3239's rumble paragraph merged into this one's), and the review's L1, L2 and L3 fixed in
669f7761:

  • L1: the cable asks the controller its own Bluetooth address before its start-up (command 0x15, subcommand 1 with
    no host given, as https://github.com/ndeadly/switch2_controller_research documents it), and only that controller's air
    link is let go; another Switch 2 Pro Controller keeps its own. One that doesn't answer is taken to be any, as before.
    In game the cable's answer was the air link's address (4044f7ed86cc both), and the handoff worked both ways twice.
    Two controllers at once is in Still to test: I have one.
  • L2: the advertisements wait in a bounded queue (16) and are dropped past it.
  • L3: with no Bluetooth LE adapter at the start, the thread looks again every 5 s instead of ending. Tested with the
    board's adapter switched off and on in game; a dongle plugged in later is in Still to test.
  • The question on ble.rs:45 (a short manufacturer section from a controller paired elsewhere): not answered yet. Such
    a section would read as host 0 and be taken as pairing; the research doesn't say whether one is sent, and finding out
    needs a controller paired with a console. Left as it is.

Tested again in game (Testing has it), with #3239's HOS_SWITCH2_HD=1 run on the cable too.

Rebased on `main` @ a2b7abf9 (#3239's rumble paragraph merged into this one's), and the review's L1, L2 and L3 fixed in 669f7761: - **L1**: the cable asks the controller its own Bluetooth address before its start-up (command 0x15, subcommand 1 with no host given, as https://github.com/ndeadly/switch2_controller_research documents it), and only that controller's air link is let go; another Switch 2 Pro Controller keeps its own. One that doesn't answer is taken to be any, as before. In game the cable's answer was the air link's address (`4044f7ed86cc` both), and the handoff worked both ways twice. Two controllers at once is in Still to test: I have one. - **L2**: the advertisements wait in a bounded queue (16) and are dropped past it. - **L3**: with no Bluetooth LE adapter at the start, the thread looks again every 5 s instead of ending. Tested with the board's adapter switched off and on in game; a dongle plugged in later is in Still to test. - The question on `ble.rs:45` (a short manufacturer section from a controller paired elsewhere): not answered yet. Such a section would read as host 0 and be taken as pairing; the research doesn't say whether one is sent, and finding out needs a controller paired with a console. Left as it is. Tested again in game (Testing has it), with #3239's `HOS_SWITCH2_HD=1` run on the cable too.
fofuxo requested review from BeanBot 2026-12-06 03:11:00 +00:00
Author
Contributor

Testing names this PC's adapter (Intel Wireless Bluetooth on the board, USB 8087:0025), and Still to test asks for an adapter other than Intel's.

Testing names this PC's adapter (Intel Wireless Bluetooth on the board, USB 8087:0025), and Still to test asks for an adapter other than Intel's.
fofuxo force-pushed feat/switch2-bluetooth from 669f776190
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 7436a610c9
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
2026-12-06 05:01:26 +00:00
Compare
Author
Contributor

Rebased on main @ 67dc8abe (head 7436a610), before asking for review again. None of the six commits since a2b7abf9 changes this PR's code: #3301 (the Windows builder's DLL allowlist; this branch's builder passes it, its one extra import api-ms-win-core-winrt-l1-1-0.dll being Windows' own), #3300, #3298, #3306, #3281, #3310. Two files changed on both sides and merged without conflicts: gpu/vk/switches.def (#3298's RX_VK_PRESENT_GATE row) and docs/user/graphics-and-controls.md (#3281's Skip Upscaler Wait row). Rebuilt here: dev.py rt (the builder compiled from this head) and run_all.py --strict --changed origin/main: 70 passed, 3 failed (test_gfx_effects, test_lifter, test_rt_refl_lamps, which fail on main on this PC too), 9 skipped. The in-game runs in Testing still hold: nothing they exercised changed.

Rebased on `main` @ 67dc8abe (head `7436a610`), before asking for review again. None of the six commits since a2b7abf9 changes this PR's code: #3301 (the Windows builder's DLL allowlist; this branch's builder passes it, its one extra import `api-ms-win-core-winrt-l1-1-0.dll` being Windows' own), #3300, #3298, #3306, #3281, #3310. Two files changed on both sides and merged without conflicts: `gpu/vk/switches.def` (#3298's `RX_VK_PRESENT_GATE` row) and `docs/user/graphics-and-controls.md` (#3281's Skip Upscaler Wait row). Rebuilt here: `dev.py rt` (the builder compiled from this head) and `run_all.py --strict --changed origin/main`: 70 passed, 3 failed (`test_gfx_effects`, `test_lifter`, `test_rt_refl_lamps`, which fail on `main` on this PC too), 9 skipped. The in-game runs in Testing still hold: nothing they exercised changed.
Member
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The Bluetooth controller path works in the recorded Windows run, and the three code items are resolved. Adapter interoperability still needs a run on hardware other than the Intel adapter tested so far. Recommend approval; not approved on the forge.

Adds Windows Bluetooth LE support for the Switch 2 Pro Controller, including motion and rumble, while retaining USB support. Address-based handoff allows a different controller to remain connected over Bluetooth; the implementation adds a Windows-specific discovery and GATT path.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4: The new Windows Bluetooth path has only been exercised on one adapter. When: Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. Do: Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate.

Since the last review (on 808955407c)
Resolved: L1 (The cable flag suppresses every Bluetooth controller, including a different physical contr…); L2 (The advertisement callback sends into an unbounded channel even while the Bluetooth thread…); L3 (Bluetooth discovery exits permanently if no LE adapter is available at startup.)
Still open: L4 (The new Windows Bluetooth path has only been exercised on one adapter.)

Checks: Still running: 11 checks.

Also noticed (3; not asked for, not blocking)
  • When the wired controller does not report its address, the conservative fallback still releases a different Bluetooth controller.
  • A two-controller USB/Bluetooth handoff and attaching an adapter after startup remain in the author's test list.
  • A short manufacturer section without a host address is treated as pairing; whether a console-paired controller sends one is unknown.
More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports successful pairing, reconnection, buttons, sticks, motion and rumble in game, with 104–109 reports per second on one Intel adapter. Interoperability on other adapters remains unproven.

Other systems: USB handoff was exercised with one controller; the two-controller case remains untested in game. Linux does not run the new Windows path. Bluetooth audio shares adapter airtime; the author observed no effect on a wireless headset.

Switches: HOS_SWITCH2 remains on by default and now covers Bluetooth as well as USB; HOS_SWITCH2_HD remains off by default and its experimental mode now also covers Bluetooth. The switch table and input documentation are updated.

Reviewed: 7436a610c9 against 67dc8abe81: Read AGENTS.md, CONTRIBUTING.md, the change and the relevant controller protocol and Windows link code; skimmed the lockfile, documentation changes, recorded runs and tests. The repository has no docs/review-checklist.md; the adjacent Tooling rules were unavailable.; nothing run (a code review).

Checked and fine:

  • The bounded advertisement queue uses nonblocking sends.
  • The adapter retry also refreshes the host address after the watcher stops.
  • The recorded tests cover address parsing and matching, including the unknown-address fallback.

Testing: No commands or tests from the project were run. The author reports in-game Windows testing and passing controller unit tests; CI is still running.

Overlaps and merge order: None found in the supplied information; #3239 is already merged.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The Bluetooth controller path works in the recorded Windows run, and the three code items are resolved. Adapter interoperability still needs a run on hardware other than the Intel adapter tested so far. Recommend approval; not approved on the forge. Adds Windows Bluetooth LE support for the Switch 2 Pro Controller, including motion and rumble, while retaining USB support. Address-based handoff allows a different controller to remain connected over Bluetooth; the implementation adds a Windows-specific discovery and GATT path. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4**: The new Windows Bluetooth path has only been exercised on one adapter. *When:* Connection parameters, service discovery and unacknowledged vibration writes depend on the Windows Bluetooth adapter; the author identifies another adapter as still to test. **Do:** Run pairing, reconnect, motion and rumble in game on a second Windows Bluetooth adapter and report the result and report rate. **Since the last review** (on 808955407c9c) Resolved: L1 (The cable flag suppresses every Bluetooth controller, including a different physical contr…); L2 (The advertisement callback sends into an unbounded channel even while the Bluetooth thread…); L3 (Bluetooth discovery exits permanently if no LE adapter is available at startup.) Still open: L4 (The new Windows Bluetooth path has only been exercised on one adapter.) **Checks:** Still running: 11 checks. <details> <summary>Also noticed (3; not asked for, not blocking)</summary> - When the wired controller does not report its address, the conservative fallback still releases a different Bluetooth controller. - A two-controller USB/Bluetooth handoff and attaching an adapter after startup remain in the author's test list. - A short manufacturer section without a host address is treated as pairing; whether a console-paired controller sends one is unknown. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports successful pairing, reconnection, buttons, sticks, motion and rumble in game, with 104–109 reports per second on one Intel adapter. Interoperability on other adapters remains unproven. **Other systems:** USB handoff was exercised with one controller; the two-controller case remains untested in game. Linux does not run the new Windows path. Bluetooth audio shares adapter airtime; the author observed no effect on a wireless headset. **Switches:** HOS_SWITCH2 remains on by default and now covers Bluetooth as well as USB; HOS_SWITCH2_HD remains off by default and its experimental mode now also covers Bluetooth. The switch table and input documentation are updated. **Reviewed:** 7436a610c923 against 67dc8abe810b: Read AGENTS.md, CONTRIBUTING.md, the change and the relevant controller protocol and Windows link code; skimmed the lockfile, documentation changes, recorded runs and tests. The repository has no docs/review-checklist.md; the adjacent Tooling rules were unavailable.; nothing run (a code review). **Checked and fine:** - The bounded advertisement queue uses nonblocking sends. - The adapter retry also refreshes the host address after the watcher stops. - The recorded tests cover address parsing and matching, including the unknown-address fallback. **Testing:** No commands or tests from the project were run. The author reports in-game Windows testing and passing controller unit tests; CI is still running. **Overlaps and merge order:** None found in the supplied information; #3239 is already merged. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
llun approved these changes 2026-12-06 05:34:02 +00:00
llun merged commit 2233ac7f1d into main 2026-12-06 05:34:09 +00:00
Some checks are pending
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3244
No description provided.