# Bluetooth and the Wii Remote ## The path from a game to a Wii Remote 1. The **game's own Bluetooth stack** runs on Broadway (the SDK's libraries; a homebrew equivalent is libogc's `lwbt` (BSD-3-Clause, EISLAB) under `wiiuse` (GPL-3.0 in libogc2's tree: a closed box here)). It speaks **HCI**. 2. It sends HCI commands and ACL data as **USB transfers** through IOS: `/dev/usb/oh1/57e/305` (control requests for HCI commands, interrupt and bulk endpoints for events and ACL data; /dev/usb/oh1, DOC). 3. IOS's OH1 module drives **OHCI1**, Hollywood's internal USB bus (Hardware/USB Host Controller; IRQ 6). 4. The **BCM2045 daughtercard** is a standard Bluetooth HCI-over-USB controller, plus vendor events: releasing the red sync button sends vendor event 0xFF with payload 08 (games then inquire and connect); holding it about 10 s sends 09 (clear the stored link keys in SYSCONF's BT.DINF) (Hardware/Bluetooth Card). 5. Over the air, each **Wii Remote** (Broadcom BCM2042) is a Bluetooth HID device: L2CAP PSM 0x11 (control) and 0x13 (data), opened after authentication; pairing by PIN, the PIN being a Bluetooth address in reverse byte order (Wiimote). So the Wii itself never interprets a Wii Remote report: the game does. That fixes the modelling level. ## Modelling level (decision D5) - **The board models the BCM2045 as an HCI controller at the USB boundary**: it accepts HCI commands and ACL packets on its USB endpoints and returns HCI events and ACL packets, with an **emulated radio**: inquiry finds the emulated remotes, connections and L2CAP channels to them are bookkept, no air timing beyond a per-packet latency (FITTED). The HCI and L2CAP behaviours are the Bluetooth Core Specification's (a public standard; version 2.0 + EDR for the BCM2045 era, HYPOTHESIS until the controller's `Read_Local_Version` answer is chosen). - **The Wii Remote is a device model behind the radio**: its HID output reports (0x10 rumble, 0x11 LEDs, 0x12 data reporting mode, 0x13/0x1a IR enable, 0x14/0x19 speaker enable/mute, 0x15 status request, 0x16/0x17 memory and register write/read, 0x18 speaker data) and input reports (0x20 status, 0x21 read data, 0x22 acknowledge, 0x30-0x3f data reports), its EEPROM and register spaces (speaker 0xA2, extension 0xA4, Motion Plus 0xA6, IR camera 0xB0) (Wiimote, DOC). - **Not modelled: the BCM2042's and BCM2045's firmware.** Both are Broadcom ROMs (and Nintendo's configuration); they are behaviour here, never code. - **The HLE IOS passes USB transfers through** to the BCM2045 model unchanged; an LLE IOS drives OHCI1 at register level and reaches the same model. The model is shared. Dolphin (closed box) offers both an emulated Bluetooth controller and passthrough of a real one (general knowledge, OBSERVED, not read); the level proposed here is the first. ## The Wii Remote's peripherals (DOC, Wiimote and its sub-pages) - **Buttons**: 11, two bytes at the start of every input report except 0x3d; their bits also carry accelerometer LSBs. - **Accelerometer**: Analog Devices **ADXL330**, three axes, "at least +/- 3g with 10% sensitivity" (the data sheet's figures, as the page quotes them). X has 10 bits, Y and Z 9 (LSB zero). Calibration constants live in the remote's EEPROM. The model takes a host-side input (an orientation and an acceleration vector, or a recorded stream) and produces counts through the calibration: FITTED until a real remote's EEPROM is read. - **IR camera**: a PixArt sensor tracking up to **four points**, reported in 1024 x 768 after "8x subpixel analysis"; modes Basic (10 bytes, positions), Extended (12 bytes, plus a 4-bit size), Full (36 bytes over two interleaved reports 0x3e/0x3f, at half rate); sensitivity blocks written through register space 0xB0, with an initialisation sequence that the page says can land in one of three states at random unless the writes are spaced by 50 ms (OBSERVED by the page's authors; the model can choose the intended state and mark the randomness as not modelled, decision in D5). The **Sensor Bar** is two IR LED clusters 20 cm apart ("as measured on one unit"); it has no electronics the console reads (power only). The model projects the two clusters through a pinhole camera from a host pointer position: geometry FITTED (field of view not on the pages: U13). - **Speaker**: 4-bit Yamaha ADPCM or signed 8-bit PCM, sample rate and volume set through register space 0xA2 (the page's example: 4-bit ADPCM at 6000 Hz). Output to the host's audio as a second stream. - **Rumble**, **player LEDs**, **power button**, **battery** (status report 0x20). - **Extensions** on the I2C port at register space 0xA4: Nunchuck, Classic Controller (Pro), guitars, drums, turntable, the Balance Board (a remote of its own), Motion Plus at 0xA6 passing an extension through (Wiimote/Extension Controllers). Their register-level data formats are on the pinned sub-pages (the Nunchuck's is pinned; the others to pin when built). The "encrypted" initialisation of older extensions and the unencrypted one are both documented there (to re-read before building). ## Timing and domains - Each remote is its **own domain** (its own clock and firmware), meeting the console only at ACL packets. Report rate in continuous reporting is not stated on the pinned page (U14); Bluetooth's slot timing (625 us) bounds it. The board's choice: input reports generated at a FITTED period, delivered as HCI ACL events at the next USB interrupt-endpoint poll by OHCI1. - For determinism and replay, **host input enters only at the remote model's sample points**, recorded in the input script with the console time (the family's scripted input rule). A run-ahead or rewind host replays the same stream. ## Gate material - No hardware-captured Bluetooth traffic is held. The judges are: the Bluetooth specification for HCI and L2CAP (DOC), WiiBrew for the remote (DOC, community reverse engineering with real remotes), and homebrew that talks to remotes, built and run as test programs (any homebrew linking libogc's `wiiuse` is GPL-3.0 as a whole: built in emu-tools-gpl, run here as a binary; sources-wii.md). - A full HCI capture from a real Wii with a real remote (a USB analyser between Hollywood and the dongle) would be tier 1. None exists here; Aubrey has no Wii.