NMT:Wiimote

From Lundman Wiki
Revision as of 10:59, 14 January 2011 by Lundman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Wiimote for NMT

I have been trying to see if I can see my Wiimote on the NMT/PCH C200 media player that I have. So far it does seem to work, but the bluetoothd process tend to hang in bad ways.

For now, install the CSI package, or the ZIP file. My little init script will assume the path is /share/Apps/wiimote/ that we are working in, but the only path required is for LD_LIBRARY_PATH.

Inside the package, you will find "init.sh" file. This has the setup procedure, and what is expected. I tend to cut'n'paste the lines, rather than to try to run it.

For example, after a reboot do:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/share/Apps/wiimote
export LD_LIBRARY_PATH

cat /proc/dmesg &

mkdir -p /var/run/dbus/
/share/Apps/utils/bin/rsync --inplace -ar etc/ /etc/

./dbus-daemon --system

insmod bluetooth.ko
insmod l2cap.ko
insmod hci_usb.ko 

This sets up the PATH to find libraries in the wiimote directory. I cat the kernel messages here so that we can more directly see the output from kernel modules. It is initially very verbose, but don't worry about that. It is only new lines that are interesting.

Then we copy over the dbus files to etc. This assumes you have rsync installed, which is part of C200 utils. (Thank you vaidyasr) Then we start dbus daemon. Finally we load all the kernel modules.

I see the following output.

Bluetooth: Core ver 2.11
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: HCI USB driver ver 2.9
usbcore: registered new interface driver hci_usb

Here is were it sometimes goes wrong. We start the bluetoothd process, which finds the hardware, and enables any. This process tends to hang for me. I ignore it, and everything works, but it is rather annoying.

./usr/sbin/bluetoothd 

For me, if is run ps now, it will print everything, until it gets to the bluetoothd process, then hangs. Oh well

Now, for me, I can list my bluetooth device.

./usr/sbin/hciconfig -a
hci0:   Type: USB
       BD Address: 00:1B:DC:00:41:91 ACL MTU: 310:10 SCO MTU: 64:8
       UP RUNNING PSCAN 
       RX bytes:34350 acl:2416 sco:0 events:226 errors:0
       TX bytes:2351 acl:168 sco:0 commands:34 errors:0
       Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83
       Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
       Link policy: 
       Link mode: SLAVE ACCEPT 
       Name: 'PCH-C200-0'
       Class: 0x000100
       Service Classes: Unspecified
       Device Class: Computer, Uncategorized
       HCI Ver: 2.1 (0x4) HCI Rev: 0x12e7 LMP Ver: 2.1 (0x4) LMP Subver: 0x12e7
       Manufacturer: Cambridge Silicon Radio (10)

Nice. I can look for the wiimote:

./lswm_c200 
Put Wiimotes in discoverable mode now (press 1+2)...
00:17:AB:31:9A:03

And perhaps, more fun:

./wmdemo

and use 1, 2, 3 and so on, to turn the Wiimote LEDs on and off.

Please let me know if it works for you, and if not, what part fails. Either use the NMT forum thread, or just send me an email.