Questions (#2) - Bluetooth pairing/bonding (#129) - Message List

Bluetooth pairing/bonding

First some background:

I'm attempting to use a Wii Balance Board as a fancy set of scales. My intention is that you'd just kick the button the the front, stand on the board, wait a few seconds and your weight gets logged.

Afaict, the only connection method currently supported by cwiid involves placing the controller in discovery mode. This is impractical for my purposes - on the Balance Board this requires flipping it over, removing the battery cover and pressing a red button.

I don't have a Wii, but it's my understanding that after once synching with the Wii the controllers will initiate a connection in future when pressing any of their buttons, without having to press the red button or holding 1+2. I'd like to get this behaviour in connection with my Linux box.

After reading through the information at it seems to me that I need to pair the controller to the PC. In an attempt to do that I modified Bluez so that I could send a binary PIN, and when sending my adapter's address backwards this appears to have been partially successful: the device now appears as a known device and has an entry in /var/lib/bluetooth/[adapter]/linkkeys. I'm not convinced that this worked entirely correctly: the blue light kept flashing for a few seconds after the pairing completed (after briefly going steady), and the pairing process didn't report success.

I have a few questions:

(1) Have I missed something, and there's a much simpler way to get this working?

(2) Is there more involved in the pairing process? wasn't clear on whether standard pairing is known to actually work.

(3) What should I expect from the controller when pressing the button to connect? How should I handle that, and where?

(4) Is there a better resource than for Wii Bluetooth protocol documentation and discussion - mailing lists, IRC channels, etc.?

Thanks a lot for cwiid!

  • Message #24449

    I'm certainly interested in getting something like this working, but I don't have any ideas on how to do it.

    1. You haven't missed anything obvious that I know about.
    2. No idea.
    3. No idea. I'm not sure how this would fit into the API - I assume you'd need to register a callback with BlueZ somehow.
    4. wiibrew is my go-to reference. I know of none better.
    • Message #24450

      Thanks for the fast response.

      So far I haven't found any further information, or anyone who is/was involved in reverse engineering this part of the protocol. If you come across anything/anyone, please let me know.

      I'll try to get hold of a real Wii, and either get hold of a BT dongle I can put in promiscuous mode or spoof a Wii controller and see what the Wii sends. As I don't have much time to work on this, and can't yet estimate how much effort is involved, I can't promise anything. I'll let you know here if I find anything useful, though.

  • Message #24452


    I am very interested in getting wiimote paired with my linux box too. I did pretty much the same as you. I modified bluetoothd to send the required binary pincode, run simple-agent. Bluetoothd reports the pairing is successful, creates linkkeys. But wiimote is still in discovery mode and when I press a button on it connects to my wii.

    I believe that wiimote expects something more after a successful bonding. Bluetoothd does SDP and just closes the connection.

    Then I got an idea, that wminput can help. So I run the simple-agent again, and when it finished, but wiimote was still in discovery mode, run wminput with the wiimote address as parameter. It connected successfully! And now it looks like wiimote thinks pairing was successful. It no longer connects to my wii, and when I press a button bluetoothd prints the following:

    bluetoothd[24772]: adapter_get_device(00:19:1D:AB:4D:77) bluetoothd[24772]: Incoming connection on PSM 17

    So wiimote initiates the connection! now we need to find a way to handle it with wminput. I guess wminput should register itself with bluetoothd as some king of service. And bluetoothd would notify it about new connections somehow.

    Unfortunately I know little about bluetooth, bluez and wminput. Besides I do not have much time to work on these. But I hope to get further :)




No attachments created.