WiiリモコンをLinux(Debian-Etch)で使った時のメモ書き。正しいかどうかは知らない。。。
Synapticパッケージマネージャ から [検索] ボタンで 「bluez」と入力して検索。“bluez-gnome” だけが有効になっていた。で、以下を追加。
"bluetooth" "bluez-hcidump" "bluez-utils" "libbluetooth2" "libbluetooth2-dev"
手元にあった USB Bluetooth のアダプタが使えるか、早速テスト。ちなみに使ったUSB Bluetooth のアダプタは、PLANEX製の “BT-01UDE” というもの。Debian-EtchのPCに差し込んで、
hcitool dev
と入力したら、
Devices: hci0 00:0A:94:02:82:DF
と出てきた。認識はされているらしい。OKと。
http://libwiimote.sourceforge.net/ から、Wiimote Libraryをダウンロード。簡単な説明があるが、とりあえず一番下の [Download] 先から、“libwiimote-0.4.tgz” をダウンロードした。
tar xvzf libwiimote-0.4.tgz
“libwiimote-0.4/“というディレクトリが出来たのでそちらへ。
cd libwiimote-0.4
一発 make と思って make したら、怒られた。
make: *** ターゲットが指定されておらず, makefile も見つかりません. 中止.
autoconf を使って、”configure” を作ればいいらしい。って autoconf が無いぞ。
apt-get install autoconf
こんどは、apt-get を使ったりして、一貫性ないの。
libwiimote-0.4 の下で、
autoconf
するだけ。“configure” ファイルが生成された。
./configure
を実行。Makefile等ができました。
おもむろに make を実行。テスト用の実行ファイルが生成されます。libwiimote-0.4/bin/ 以下にある、“test1” ~ “test4” を実行してみよう。
あれ、、libcwiimote.so が無いって。
上で make して出来た場所が見えないみたい。で、/usr/lib/ にシンボリックリンク
ln -s /usr/local/lib/libcwiimote.a libcwiimote.a ln -s /usr/local/lib/libcwiimote.so.0.4.0 libcwiimote.so
“test1” ~ “test4” の実行時に、BDアドレスを入れないといけないが、WiiリモコンのBDアドレスがわからない。
hcitool scan
と入力して、Wiiリモコンの“1”と“2”のボタンを当時押しっと。 しばらく待つと、“Nintendo RVL-CNT-01” と共に BDアドレスが出てきた。
./test1 XX:XX:XX:XX:XX:XX
やった、成功成功。 それぞれの test でできることは以下の通り。テストしているうちにこの説明が流れていってしまうので、ここに写しといた。
test1 - libwiimote test application A - Enable accelerometer B - Enable ir-sensor 1 - Enable rumble + - Increment leds - - Decrement leds Home - Exit test2 - speaker test A - Play sample TILT_X - Modulate frequency TILT_Y - Modulate volume HOME - Exit test3 - multiple libwiimote test application 1 - Enable rumble Home - Exit test4 - libcwiimote test application Will scan MII slots and save them as files
P.S. Wiimote って言葉が良く出てくるが、どおやら Wiiリモコン そのものを示しているらしい。。。英語なのかな?