Wii Bonjour

What's the Wii Bonjour system?

In a nutshell: a new WiiC functionality to load registered Wii devices, without searching for them anymore.

How does it work?

Starting from WiiC 0.53, typing sudo make install the setup will create your own WiiC configuration folder: .wiic. Its default location is within your home directory (recognized by the $HOME environment variable). Within .wiic you can create a configuration file called wiimotes.config. To accomplish this, type (both on Linux or MacOS platforms):

   cd ~/.wiic
   touch wiimotes.config

Once created, you are ready to register your Wii devices.

Adding a new Wii device

First of all, you need to know your device MAC address. If you don't, you can retrieve it in different ways. For example, run wiic-example or wiicpp-example and put your device in discovery mode (by pressing concurrently buttons 1 and 2 on it). As soon as the device will be detected, you should see its address printed:

   [INFO] Found Wiimote (00-1f-c5-2d-79-7b) [id 1].

Once got it, edit wiimotes.config with any editor, add the address, save and quit. WARNING: one line per address...

How can I load registered devices?

If you're developing a C application, replace wiic_find(struct wiimote_t** wm, int max_wiimotes, int timeout) with wiic_load(struct wiimote_t** wm). In case of C++ software, you can use CWii::LoadRegisteredWiimotes(). Here is a C example:

int main(int argc, char** argv) {
        wiimote** wiimotes;
        int loaded, connected;

        * Initialize an array of wiimote objects.
        * The parameter is the number of wiimotes I want to create.
        wiimotes =  wiic_init(MAX_WIIMOTES);

        * Load wiimote devices
        * This will return the number of loaded wiimotes from the configuration file.
        loaded = wiic_load(wiimotes);
        if (!loaded) {
                printf ("No wiimotes loaded.");
                return 0;

        * Connect to the wiimotes
        * This will return the number of established connections to the found wiimotes.
        connected = wiic_connect(wiimotes, loaded);
        if (connected)
        printf("Connected to %i wiimotes (of %i loaded).\n", connected, loaded);
        else {
                printf("Failed to connect to any wiimote.\n");
                return 0;

Finally, some hints:

  1. when loading registered devices, put them in discovery mode, otherwise connections cannot be established.
  2. ALL the registered devices in wiimotes.config will be loaded. However, in case you don't need one of them, do not put it in discovery mode, and no connection will be established.
  3. You can register as many devices as you want, but take into account that you should init the same number of Wiimote data structures before loading and connecting to them!




edit SideBar

Blix theme adapted by David Gilbert, powered by PmWiki