view · edit · print · history

In this page I will describe how to connect a Nintendo wiimote on your slug.

This Document is based on

My Hardware is

  • NLSU2 with openslug 3.10 beta
  • Nintendo Wiimote (http://www.wiili.org/index.php/Wiimote) -- There was a report that this page triggered a malware filter, but I was not able to verify it. fcarolo January 25, 2008, at 08:43 PM
  • Bluetooth adapter Intuix BTDU100
  • USB Hub 2.0 Connectland
  • USB key 1Go with openslug
  • USB storage disk

The usb hub is connecto to "disk2". On the hub there is my usb key and my usb storage disk. On "disk1" there is my bleutooth adapter

Basic Installation

  1. Install OpenSlug 3.10 or later.
  2. Run the following to install the basic packages:

    ipkg install \
    kernel-module-bluetooth \
    kernel-module-l2cap \
    kernel-module-rfcomm \
    kernel-module-bnep \
    kernel-module-hci-usb \

    Then register all modules by:

    depmod -a

Test your work

You should now be able to do:

hciconfig hci0 up

to make the Bluetooth interface available to the Bluetooth protocol stack.

Run hciconfig by itself again should give something like this:

hci0: Type: USB
BD Address: 00:03:0D:00:07:8A ACL MTU: 192:8 SCO MTU: 64:8
RX bytes:8567 acl:125 sco:0 events:409 errors:0
TX bytes:4518 acl:128 sco:0 commands:130 errors:0

The `BDAddr` (short for `BD Address`) is the unique hardware address of the Bluetooth adapter.

Desactivate authentication and cryptage

For that change the auth and encrypt lines in /etc/bluetooth/hcid.conf to:

auth disable;
encrypt disable;

You'll need to restart bluetooth adapter:

/etc/init.d/bluetooth stop
/etc/init.d/bluetooth start

Find the wiimote

You can scan for the presence of the Wiimote. You must first Press A and B buttons on the wiimote. The leds of the wiimote will fash after you can type:

hcitool inq

Please note the address of the bluetooth adapter return. This address is the address of the wiimote.

Install the libwiimote

From sourceforge

  1. You can download the library from here: http://downloads.sourceforge.net/libwiimote/libwiimote-0.4.tgz
  2. You must rename all file ending with .in delete .in

    ./configure.in ==> ./configure
    ./test/Makefile.in ==> ./test/Makefile
    ./src/Makefile.in ==> ./src/Makefile
    ./Makefile.in ==> ./Makefile
    ./config.mk.in ==> ./config.mk

    # You must patch all Makefile files correcting variable $(variable_name) ==> ${variable_name}
  3. Rewrite /test/Makefile:
    include ${topdir}/config.mk

    CFLAGS:=${CFLAGS} #-static
    LIBS:=${LIBS} -L${LIBDIR} -lcwiimote -lbluetooth -lm
    all: test1 test2 test3 test4
    test1: test1.c
    ${CC} ${CFLAGS} ${INCLUDES} -o ${BINDIR}/$@ $< ${LIBS}
    test2: test2.c
    ${CC} ${CFLAGS} ${INCLUDES} -o ${BINDIR}/$@ $< ${LIBS}
    test3: test3.c
    ${CC} ${CFLAGS} ${INCLUDES} -o ${BINDIR}/$@ $< ${LIBS}
    test4: test4.c
    ${CC} ${CFLAGS} ${INCLUDES} -o ${BINDIR}/$@ $< ${LIBS}
    rm -f *.o *~ ${BINDIR}/*
  4. Delete the following line from src/Makefile:
    @ar rs $(LIBDIR)/$@ *.o
  5. Compile the library :

From my Site

  1. You can download the library from here: http://colas.sebastien.free.fr/download/libwiimote-0.4.tar.gz
  2. Compile the library

Run the test program

From the bin directory launch test1 with the wiimote address.

To know

It seems that the libwiimote doesn't work perfectly. I think this lib is written for a little endian architecture (iX86) but NSLU2 is a Big endian Architecture.

To do

Find the way to convert the library from littlen endian to big endian (compilation parameter ???)


On my configuration I must connect bluetooth adapter directly to the slug. USB Hub 2.0 doesn't work. You can try with a USB Hub 1.1...

view · edit · print · history · Last edited by fcarolo.
Based on work by fcarolo, Fiesch, and Sébastien Colas.
Originally by Sébastien Colas.
Page last modified on January 25, 2008, at 08:43 PM