Teaser: connecting Nintendo Switch controllers to the Wii
A few months ago I started playing with the Bluetooth controller embedded in the Nintendo Wii, to see if it was possible to get it to connect to other devices than just the Wii remotes. If you ask internet forums, you might fall into the impression that the Wii is not using a standard Bluetooth controller, or that it has been somehow "crippled" in order to restrict it to connect to the Wiimotes only, but that's not the case: it's an ordinary controller from its era, it's just that the Wii software (both the official SDK and the homebrew libogc) only uses it for the Wiimotes.
I first started looking into
lwBT, the bluetooth
stack used in libogc, but I quickly realized that it was impossible to get full
control over the controller via this library: it has been adapted to work with
the subset of the HID protocol used by the Wiimotes, and even if you can issue
bluetooth commands to the controller via the HCI layer, you cannot receive the
replies, since they are already intercepted by lwBT and there's no way to hook
into them.
So I started writing my own little bluetooth stack,
bt-embedded which
from the ground up has been designed to be used by embedded devices and
covering the use case of serving different clients running in a single process,
and I've integrated it into
embedded-game-controller
(though this is not merged into the master branch yet) in order to allow
connecting to bluetooth controllers. And in the last couple of days I've
written a little ugly program to visualize the controllers in a 3D scene, in
order to better test them:
Yes, the 3D model sucks, it was a nice model when I downloaded it from a free site, but then heavily reduced the number of polygons using Blender and went a bit too far; I'll do a better model later. The accelerometer information is not shown yet (I'd like to use it to actually tilt the controller, instead of using the joystick), but that will not be hard.
At the moment, the only supported controllers are the Nintendo Switch Pro controller (I'm using a clone here) and the Joy-cons, so there's still quite some work to do to add more.
It's been a journey in which I learned a lot about Bluetooth and USB and, who knows, maybe this will come handy in the future too.
Commentos
There's also webmention support.