GentooLinuxでWiiリモコンを試す その2
前回から大幅に進展。 Control X.Org cursor with Wiimoteで公開されたドライバにより、LinuxなどのX環境でWiiリモコンが使えるようになったらしい。赤外線センサーにも対応した模様。早速試す。 試した環境は前回と同じ。
- Wiiリモコン(RVL-003)
- PLANEX BT-01UDE(Bluetooth Ver2.0 USBアダプタ)
- Gentoo Linux amd64(kernel gentoo-sources-2.6.18-r3)
Networking ---> <*> Bluetooth subsystem support ---> --- Bluetooth subsystem supportL2CAP protocol support Device Drivers ---> Input device support ---> <*> Event interface [*] Miscellaneous devices --->SCO links support RFCOMM protocol support [*] RFCOMM TTY support BNEP protocol support [*] Multicast filter support [*] Protocol filter support HIDP protocol support Bluetooth device drivers ---> HCI USB driver [*] SCO (voice) support HCI UART driver [*] UART (H4) protocol support [*] BCSP protocol support [*] Transmit CRC with every BCSP packet HCI BCM203x USB driver HCI BPA10x USB driver HCI BlueFRITZ! USB driver HCI VHCI (Virtual HCI device) driver User level driver support USB support ---> <*> Support for Host-side USB --- USB Host Controller Drivers EHCI HCD (USB 2.0) support [ ] Full speed ISO transactions (EXPERIMENTAL) [ ] Root Hub Transaction Translators (EXPERIMENTAL) <*> OHCI HCD support <*> UHCI HCD (most Intel and VIA) support < > SL811HS HCD support
- net-wireless/bluez-libs-3.7
- net-wireless/bluez-utils-3.7
- dev-python/pybluez-0.9.1
- x11-drivers/xf86-input-evdev
- dev-python/python-xlib
$ sudo /etc/init.d/bluetooth startWiiリモコンのアドレスを取得。WiiリモコンのSyncボタンを押して以下のコマンドを実行。
$ hcitool scan Scanning ... 00:19:1D:xx:xx:xx Nintendo RVL-CNT-01上記のようにアドレスが表示されたらBluetoothの通信はできているはず。 続いてドライバを用意。
$ wget http://davr.org/wiimotulator.py.txt -O wiiremote.py $ vi wiiremote.py55行目のMY_WIIMOTE_ADDRに、Wiiリモコンのアドレスを記入する。 64bit環境の場合は、818行目の"LLHHl"を"LLHHi"に変更する。 X環境を設定。Wiiリモコン用のInputDeviceを追加。ServerLayoutに1行追加。
$ sudo vi /etc/X11/xorg.conf Section "InputDevice" # Identifier "Wiimote" Driver "evdev" Option "Name" "Nintendo Wiimote" EndSection Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Wiimote" "AlwaysCore" EndSectionで、実行。WiiリモコンのSyncボタンを押して、
$ sudo python wiiremote.py Registered key KEY_KPPLUS for button + with code 4e Registered key KEY_KPMINUS for button - with code 4a Registered key BTN_LEFT for button 1 with code 110 Registered key BTN_RIGHT for button 2 with code 111 Looking for Wiimote services at address 00:19:1D:xx:xx:xx Victory! We have found that Wiimote! We are now connected to Wiimote at address 00:19:1D:xx:xx:xxと出ればOK。 適当にボタンを押すと画面上にメッセージが出るはず。 デフォルト設定では以下の通り。
- 上ボタン WiiリモコンのLED1
- 下ボタン WiiリモコンのLED2
- 右ボタン WiiリモコンのLED3
- 左ボタン WiiリモコンのLED4
- Aボタン バイブレーションON
- Bボタン バイブレーションOFF
- -ボタン キーボードの-キー
- +ボタン キーボードの+キー
- 1ボタン マウスの左クリック
- 2ボタン マウスの右クリック(私の環境では中クリックになってしまった)
- HOMEボタン 終了
No comments:
Post a Comment