Difference between revisions of "Nintendo WiiMote"
Cobradevil (Talk | contribs) |
Cobradevil (Talk | contribs) |
||
Line 17: | Line 17: | ||
Login as root to the media director which has a bluetooth stick with ssh. | Login as root to the media director which has a bluetooth stick with ssh. | ||
Install the cwiid driver as fllows | Install the cwiid driver as fllows | ||
− | apt-get install libcwiid0 | + | apt-get install libcwiid0 |
− | apt-get install wminput | + | apt-get install wminput |
+ | |||
+ | create the daemon | ||
+ | vi /usr/sbin/wminputd | ||
+ | |||
+ | #!/bin/bash | ||
+ | #read the config file | ||
+ | . /etc/wminputd.conf | ||
+ | export DISPLAY=:0 | ||
+ | |||
+ | while true ; do | ||
+ | #check if the OrbiterGL is already running! | ||
+ | LMCE=`pidof OrbiterGL` | ||
+ | if [ ! -z $LMCE ] ; then | ||
+ | while true ; do | ||
+ | #check if the wiimote is already connected | ||
+ | SCAN=`hcitool con|grep $WIIMOTE_BDADDR` | ||
+ | if [ -z $SCAN ] ; then | ||
+ | PID=`pidof wminput` | ||
+ | kill -9 $PID | ||
+ | xset m 3 1/2 | ||
+ | wminput -c ir_ptr $WIIMOTE_BDADDR & | ||
+ | sleep 5 | ||
+ | else | ||
+ | sleep 5 | ||
+ | fi | ||
+ | done | ||
+ | fi | ||
+ | done | ||
+ | |||
+ | Make it executable | ||
+ | chmod 755 /usr/sbin/wminputd | ||
+ | |||
+ | *Create the config file | ||
+ | vi /etc/wminputd.conf | ||
+ | |||
+ | #this is the config file for the wminputd | ||
+ | #enter the wiimote mac address, you can find it with ~#hcitool scan and then press the red button | ||
+ | #besides the battery's off the wiimote | ||
+ | #Then place the show'n mac address as follows | ||
+ | WIIMOTE_BDADDR="00:AA:00:BB:AA:FF" | ||
+ | |||
+ | you can find your address with hcitool scan | ||
+ | |||
+ | *Edit the file /etc/cwiid/wminput/buttons | ||
+ | |||
+ | vi /etc/cwiid/wminput/buttons | ||
+ | And make it suitable to your needs | ||
+ | below is mine | ||
+ | #buttons | ||
+ | |||
+ | Wiimote.A = BTN_LEFT | ||
+ | Wiimote.B = BTN_RIGHT | ||
+ | Wiimote.Up = KEY_UP | ||
+ | Wiimote.Down = KEY_DOWN | ||
+ | Wiimote.Left = KEY_LEFT | ||
+ | Wiimote.Right = KEY_RIGHT | ||
+ | Wiimote.Minus = KEY_F7 | ||
+ | Wiimote.Plus = KEY_F8 | ||
+ | Wiimote.Home = KEY_F3 | ||
+ | Wiimote.1 = KEY_F1 | ||
+ | Wiimote.2 = KEY_F6 | ||
+ | |||
+ | |||
+ | * create the init file | ||
+ | vi /etc/init.d/wminputd | ||
+ | |||
+ | #!/bin/sh | ||
+ | # Start/stop the wminputd daemon. | ||
+ | # | ||
+ | ### BEGIN INIT INFO | ||
+ | # Provides: wminputd | ||
+ | # Required-Start: $syslog $time | ||
+ | # Required-Stop: $syslog $time | ||
+ | # Default-Start: 2 3 4 5 | ||
+ | # Default-Stop: 0 1 6 | ||
+ | # Short-Description: mousemodule | ||
+ | # Description: wminputd | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ### END INIT INFO | ||
+ | |||
+ | |||
+ | test -f /usr/sbin/wminputd || exit 0 | ||
+ | . /lib/lsb/init-functions | ||
+ | |||
+ | case "$1" in | ||
+ | start) log_daemon_msg "Starting wii-remote mousemodule" "wminputd" | ||
+ | start-stop-daemon -b --start --quiet --pidfile /var/run/wminputd.pid --name wminputd --startas /usr/sbin/wminputd -- $LSBNAMES | ||
+ | log_end_msg $? | ||
+ | ;; | ||
+ | stop) log_daemon_msg "Stopping wii-mote mousemodule" "wminputd" | ||
+ | start-stop-daemon --stop --quiet --pidfile /var/run/wminputd.pid --name wminputd | ||
+ | log_end_msg $? | ||
+ | ;; | ||
+ | restart) log_daemon_msg "Restarting wii-mote mousemdule" "wminputd" | ||
+ | start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/wminputd.pid --name wminputd | ||
+ | start-stop-daemon -b --start --quiet --pidfile /var/run/wminputd.pid --name wminputd --startas /usr/sbin/wminputd -- $LSBNAMES | ||
+ | log_end_msg $? | ||
+ | ;; | ||
+ | *) log_action_msg "Usage: /etc/init.d/wminputd {start|stop|restart}" | ||
+ | exit 2 | ||
+ | ;; | ||
+ | esac | ||
+ | exit 0 | ||
+ | |||
+ | run the script and push the red button beside the battery and your wiimote is ready to go | ||
+ | |||
+ | |||
+ | enable the script so it wil start at boot time | ||
+ | update-rc.d wminputd defaults | ||
+ | now start the script and take look if it works | ||
+ | /etc/init.d/wminputd start | ||
+ | |||
+ | = Troubleshooting = | ||
+ | |||
+ | Q: When i reload the router then the wiimote will be slow | ||
+ | A: Just push the red button besides the wiimote so it will connect again |
Revision as of 19:14, 24 March 2008
This article is a stub and requires expansion |
This device is not (yet?) supported by LinuxMCE, but it is known to work [1] [2] [3].
Wiimote setup
I will try to explain what i have done to make the wiimote work with linuxmce.
The wiimote is a cheap gyration device which could work for linuxmce instead of the chief remote from fiire which i find to expensive!!
Setup
Login as root to the media director which has a bluetooth stick with ssh. Install the cwiid driver as fllows
apt-get install libcwiid0 apt-get install wminput
create the daemon
vi /usr/sbin/wminputd
#!/bin/bash #read the config file . /etc/wminputd.conf export DISPLAY=:0 while true ; do #check if the OrbiterGL is already running! LMCE=`pidof OrbiterGL` if [ ! -z $LMCE ] ; then while true ; do #check if the wiimote is already connected SCAN=`hcitool con|grep $WIIMOTE_BDADDR` if [ -z $SCAN ] ; then PID=`pidof wminput` kill -9 $PID xset m 3 1/2 wminput -c ir_ptr $WIIMOTE_BDADDR & sleep 5 else sleep 5 fi done fi done
Make it executable
chmod 755 /usr/sbin/wminputd
- Create the config file
vi /etc/wminputd.conf
#this is the config file for the wminputd #enter the wiimote mac address, you can find it with ~#hcitool scan and then press the red button #besides the battery's off the wiimote #Then place the show'n mac address as follows WIIMOTE_BDADDR="00:AA:00:BB:AA:FF"
you can find your address with hcitool scan
- Edit the file /etc/cwiid/wminput/buttons
vi /etc/cwiid/wminput/buttons
And make it suitable to your needs below is mine
#buttons Wiimote.A = BTN_LEFT Wiimote.B = BTN_RIGHT Wiimote.Up = KEY_UP Wiimote.Down = KEY_DOWN Wiimote.Left = KEY_LEFT Wiimote.Right = KEY_RIGHT Wiimote.Minus = KEY_F7 Wiimote.Plus = KEY_F8 Wiimote.Home = KEY_F3 Wiimote.1 = KEY_F1 Wiimote.2 = KEY_F6
- create the init file
vi /etc/init.d/wminputd
#!/bin/sh # Start/stop the wminputd daemon. # ### BEGIN INIT INFO # Provides: wminputd # Required-Start: $syslog $time # Required-Stop: $syslog $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: mousemodule # Description: wminputd # # # ### END INIT INFO test -f /usr/sbin/wminputd || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting wii-remote mousemodule" "wminputd" start-stop-daemon -b --start --quiet --pidfile /var/run/wminputd.pid --name wminputd --startas /usr/sbin/wminputd -- $LSBNAMES log_end_msg $? ;; stop) log_daemon_msg "Stopping wii-mote mousemodule" "wminputd" start-stop-daemon --stop --quiet --pidfile /var/run/wminputd.pid --name wminputd log_end_msg $? ;; restart) log_daemon_msg "Restarting wii-mote mousemdule" "wminputd" start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/wminputd.pid --name wminputd start-stop-daemon -b --start --quiet --pidfile /var/run/wminputd.pid --name wminputd --startas /usr/sbin/wminputd -- $LSBNAMES log_end_msg $? ;; *) log_action_msg "Usage: /etc/init.d/wminputd {start|stop|restart}" exit 2 ;; esac exit 0
run the script and push the red button beside the battery and your wiimote is ready to go
enable the script so it wil start at boot time
update-rc.d wminputd defaults
now start the script and take look if it works
/etc/init.d/wminputd start
Troubleshooting
Q: When i reload the router then the wiimote will be slow A: Just push the red button besides the wiimote so it will connect again