Add verified Joy-Con 2 USB bridge with native mouse support

Implement the standalone USB protocol probe and Bluetooth-backed right Joy-Con bridge with its own persistent virtual pairing identity. Preserve complete ordered native reports, including opaque motion data, and match the console feature set. Relay built-in vibration cues only after genuine source acknowledgement and expose safe BOOTSEL pairing control. Include native capture diagnostics and focused protocol, packet-lifecycle, and cue regressions. Native mouse operation confirmed on Switch with bridge 0.24; private captures and firmware backups remain outside the commit.
This commit is contained in:
Joey Yakimowich-Payne 2026-09-10 17:46:03 -06:00
commit 3040c9d294
34 changed files with 3777 additions and 15 deletions

View file

@ -0,0 +1,51 @@
from __future__ import annotations
import os
import shutil
import subprocess
from pathlib import Path
import pytest
def test_switch2_usb_probe_deferred_sample(tmp_path: Path) -> None:
root = Path(__file__).resolve().parents[1]
compiler = shutil.which("cc") or shutil.which("gcc")
assert compiler is not None, "a host C compiler is required"
sdk_candidates = [
root / "build" / "_deps" / "pico_sdk-src",
root / "external" / "pico-sdk",
]
if sdk_path := os.environ.get("PICO_SDK_PATH"):
sdk_candidates.insert(0, Path(sdk_path))
mbedtls = next(
(sdk / "lib" / "mbedtls" for sdk in sdk_candidates
if (sdk / "lib" / "mbedtls" / "library" / "aes.c").is_file()),
None,
)
if mbedtls is None:
pytest.skip("Pico SDK mbedTLS required; configure firmware or set PICO_SDK_PATH")
probe = root / "tools" / "switch2_usb_probe"
executable = tmp_path / "switch2_usb_probe_protocol"
subprocess.run(
[
compiler,
"-std=c11",
"-Wall",
"-Wextra",
"-Werror",
"-pedantic",
f'-DMBEDTLS_CONFIG_FILE="{probe / "mbedtls_config.h"}"',
f"-I{probe}",
f"-I{mbedtls / 'include'}",
str(probe / "protocol.c"),
str(mbedtls / "library" / "aes.c"),
str(mbedtls / "library" / "platform_util.c"),
str(root / "tests" / "switch2_usb_probe_protocol_test.c"),
"-o",
str(executable),
],
check=True,
cwd=root,
)
subprocess.run([str(executable)], check=True, cwd=root)