Archive:Configure Gyration USB remote for Ubuntu: Difference between revisions
>Gsgleason No edit summary |
>Gsgleason No edit summary |
||
Line 175: | Line 175: | ||
#enter | #enter | ||
#"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/28 "fill this in!" | #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/28 "fill this in!" | ||
</source> | |||
==Set Up Sudo== | |||
Since root permissions are required for evrouter to do what it does, we will launch it using sudo. However, since this is going to be a part of a script, we need to make sure that the user that is launching XBMC is allowed to run evrouter without having to put in the user's password. To do this, use the command visudo with super user permissions: | |||
<source lang="bash">sudo viduso</source> | |||
This will launch your editor to edit the sudoers file. To allow the user '''xbmc''' to run evrouter with super user permissions without a password, add this line: | |||
xbmc ALL=NOPASSWD: /usr/bin/evrouter | |||
==Configure evrouter to start up with the X server== | |||
Evrouter needs to be started after the X server is running. To do this, I put it in the user's '''~/.xinitrc''' file. | |||
This was tested using mingetty to auto log in a user that has a file ~/.bash_login as follows: | |||
<source lang="bash"> | |||
if [[ -z $SSH_CONNECTION ]]; then | |||
while [[ x`pidof X` = "x" ]]; do startx; done | |||
fi | |||
</source> | |||
This will run '''startx''' as long as the login is not through SSH and X isn't already running, and will restart it if it dies. There may be better ways to do this, but that's not the discussion here. | |||
Here is the user's '''~/.xinitrc''' file: | |||
<source lang="bash"> | |||
#!/bin/bash | |||
exec /usr/bin/nvidia-settings --load-config-only & | |||
#/usr/bin/xterm & | |||
#/usr/bin/blackbox | |||
/usr/bin/sudo /usr/bin/evrouter --config=/home/gsg/evrouter_gyration.txt /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-* | |||
exec /usr/bin/xbmc --standalone | |||
</source> | </source> |
Revision as of 22:41, 9 June 2010
Introduction
There are several buttons on the Gyration Media Center Remote that work with XBMC out of the box, so to speak.
There are also some that do not.
This method uses the evrouter program to map the unused keys (or any key you wish, for that matter) to keyboard keys that XBMC uses.
This was written using Ubuntu 9.10 i386 with XBMC 9.11 installed from the svn ppa.
We are going to use evrouter to look at the two event devices associated with the Gyration remote, which are:
/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse
Install evrouter
The Ubuntu repositories do not have evrouter, but there is a .deb package available at the author's website, which this guide will use.
Download the package:
wget http://debian.bedroomlan.org/debian/pool/main/e/evrouter/evrouter_0.4_i386.deb
Install the package:
sudo dpkg -i evrouter_0.4_i386.deb
Create configuration file for evrouter
You can use evrouter to dump the output of keys for devices. To do this, run this command:
sudo evrouter -d /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-*
While the command is running, press the buttons on the remote, and the configuration will be generated. Here is what it should look like:
sudo evrouter -d /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-* device 0: /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd: Gyration Gyration RF Technology Receiver device 1: /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse: Gyration Gyration RF Technology Receiver Display name: localhost:10.0 Window "xterm": # Window title # Window "xterm": # Resource name # Window "XTerm": # Class name "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/102 "fill this in!"
The last part in the quotes, "fill this in," needs to be replaced with the desired action. According to the man page of evrouter, the action can be either a keyboard press, a mouse button, or a shell script. Please read the man page for more info.
man evrouter
Below is a file where every single button on the remote was pressed. The working buttons have been commented out, but they are there in case you want to change the default behavior. Evrouter can be configured on a per-window basis using the Window parameter in the configuration file. The example below is affecting all windows, so if you're using this in windowed mode in a desktop environment, you might want to put the window class or resource name in the quotes. I think it should be "xbmc.bin"
Copy this and save it wherever you want. I have it save as ~/evrouter_gyration.txt which will be used later in this guide.
#Window "xbmc.bin": # Window title Window "": # Window title #Power/Sleep "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/142 "XKey/End" #or to bring up shutdown menu #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/142 "XKey/S" #LiveTV "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/366 "XKey/O" #left mouse #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/272 "fill this in!" #right mouse #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/273 "fill this in!" #green windows button "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/102 "XKey/Escape" #mypictures #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/212 "fill this in!" #myTV #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/226 "fill this in!" #mymusic #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/391 "fill this in!" #myvideos #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/393 "fill this in!" #DVD Menu #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-mouse" none key/389 "fill this in!" #stop #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/166 "fill this in!" #record #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/167 "fill this in!" #pause #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/119 "fill this in!" #rewind #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/168 "fill this in!" #fastfoward #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/208 "fill this in!" #play #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/207 "fill this in!" #skipback #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/165 "fill this in!" #skip forward #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/163 "fill this in!" #guide "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/362 "XKey/Menu" #up #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/103 "fill this in!" #down #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/108 "fill this in!" #left #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/105 "fill this in!" #right #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/106 "fill this in!" #ok #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/28 "fill this in!" #back "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/158 "XKey/BackSpace" #info "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/130 "XKey/I" #volup #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/115 "fill this in!" #voldown #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/114 "fill this in!" #mute #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/113 "fill this in!" #chan up "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/402 "XKey/Page_Up" #chan down "Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/403 "XKey/Page_Down" #1 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/2 "fill this in!" #2 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/3 "fill this in!" #3 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/4 "fill this in!" #4 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/5 "fill this in!" #5 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/6 "fill this in!" #6 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/7 "fill this in!" #7 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/8 "fill this in!" #8 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/9 "fill this in!" #9 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/10 "fill this in!" #0 #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/11 "fill this in!" #clear #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/1 "fill this in!" #enter #"Gyration Gyration RF Technology Receiver" "/dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-kbd" none key/28 "fill this in!"
Set Up Sudo
Since root permissions are required for evrouter to do what it does, we will launch it using sudo. However, since this is going to be a part of a script, we need to make sure that the user that is launching XBMC is allowed to run evrouter without having to put in the user's password. To do this, use the command visudo with super user permissions:
sudo viduso
This will launch your editor to edit the sudoers file. To allow the user xbmc to run evrouter with super user permissions without a password, add this line:
xbmc ALL=NOPASSWD: /usr/bin/evrouter
Configure evrouter to start up with the X server
Evrouter needs to be started after the X server is running. To do this, I put it in the user's ~/.xinitrc file.
This was tested using mingetty to auto log in a user that has a file ~/.bash_login as follows:
if [[ -z $SSH_CONNECTION ]]; then while [[ x`pidof X` = "x" ]]; do startx; done fi
This will run startx as long as the login is not through SSH and X isn't already running, and will restart it if it dies. There may be better ways to do this, but that's not the discussion here.
Here is the user's ~/.xinitrc file:
#!/bin/bash exec /usr/bin/nvidia-settings --load-config-only & #/usr/bin/xterm & #/usr/bin/blackbox /usr/bin/sudo /usr/bin/evrouter --config=/home/gsg/evrouter_gyration.txt /dev/input/by-id/usb-Gyration_Gyration_RF_Technology_Receiver-event-* exec /usr/bin/xbmc --standalone