Sapphire Remote

Sapphire Remote


A very cheap but functional remote for Linux machines.

This remote is described here http://rtr.ca/sapphire_remote/. It is a very nice and cheap remote. Mark Lord, the author of the above page should take all the credit, his driver is simple and simply brilliant. It requires compiling a driver and editing a couple of files, but don't worry. it's not that hard. This guide sets up the remote on a Ubuntu system, in particular these steps were tested on a new XBMCbuntu 12.0 system.

Steps involved

 * 1) Install the tools required to compile the driver.
 * 2) Download, compile and install the driver.
 * 3) Install a keymap suitable for XBMC (the driver comes programmed for mythtv).

Install the tools required to compile the driver.
Ubuntu has a virtual package called build-essential which installs the compiler tools. NB added 27 April 2013 - on XBMCbuntu you need to install gawk as well - most distros have this but XBMCbuntu is pretty cut down. The needed tools will be installed.

Download, compile and install the driver.
You need to download the latest driver from Mark's site. As at the time I am writing (8 April 2013) the latest is 4.6. Go to his website and get the most recent, and change the numbers in my example if there is a lter version.

Some distros also need a startup script, I am not sure if ubuntu does, but no harm in doing it. Mark installs the script in /usr/local/bin/sapphire_startup.sh. To make this script run on boot, use your editor to add the command to /etc/rc.local

Put the command just above the ine that says exit 0, so it will look like this: Press ^x (ctrl-x) to exit nano, answering yes to whether to save the file.

Install a keymap suitable for XBMC
Mark's driver comes with a keymap that works very nicely on mythtv, but the button presses for XBMC are different in many places. My keymap for XBMC is as follows: There is quite a bit of stuff from mythtv in there that I haven't been bothered to edit out. You of course can edit it any way you like, but the changes I have made from the mythtv buttons are:


 * Volume Up, Volume Down & Mute to correct XBMC keys
 * DVDMenu Button to "C" - context menu
 * Radio Button to "O" - show codec info (couldn't decide which button to use for that, but Radio wasn't otherwise in use)
 * Language Button to "L" - next audio track
 * Subtitle Button to "T" - toggle subtitles
 * Stop Button to "X" - stop.

Anyway, as I say, you can set them up however you like, and take advantage of long press and the other driver features.

I put the keymap under /etc/sapphire, which you have to create. Copy and paste my keymap from above and then exit nano.

Option 1: Load keymap on boot
Now if all you are doing is runnning XBMC you can install this keymap on boot and it can stay there. So load the keymap on boot via /etc/rc.local as we did to load the driver above. Again using nano edit the /etc/rc.local file and add this line AFTER the line we added earlier.

Option 2: Load keymap when starting XBMC
Personally I run mythbuntu and my machine boots to mythfrontend, and I start XBMC when I want it from a muythtv menu item. Therefore I leave the default keymap as it works for mythtv. A script starts XBMC after loading keymap.xbmc, and on exit from XBMC it restores keymap.default. This is the script:

Starting at version 4.6 the following step (making /proc/sapphire world writable) is no longer necessary. It is left here for users of earlier versions.

For this to work you need to change permissions on /proc/sapphire, which I do via a simple line in /etc/rc.local: Obviously this line must come after the one that loads the sapphire module.

This page is currently a work in progress. You can see some other info here http://forum.xbmc.org/showthread.php?tid=159433&pid=1368998#pid1368998 and I'll try and create some generic info for the wiki.--Nickr 03:03, 25 March 2013 (EDT)