Configuring the Sony PS3 BD Remote with MythTV & XBMC

admin, 21 April 2011, 6 comments
Categories: Acer Revo, MythTV, XBMC

This howto worked with Mythbuntu 10.04.
Also tested with 12.04LTS.

Later releases dont kneed to worry about setting up uinput as a service as it is now in the kernel.

NOTE: I have added a .txt attribute to some of these files so they display in all browsers. Remember to strip this off if downloading and using these files

The Sony bluetooth remote makes an ideal remote for both MythTV and XBMC. Here’s how to get it working with both and enable the remote to start XBMC/switch between XBMC and MythTV. On the Revo I used one of the el cheapo small USB bluetooth dongles from ebay or the like. Simply plug in the dongle and power up and it should be recognised.

First install the blueman applet:

sudo apt-get install blueman

We need to check that the uinput service is running:

lsmod | grep uinput

On my default Mythbuntu installation it is not so to enable at startup:

sudo nano /etc/modules

and add a line:

uinput

Then create a udev rule:

sudo nano /etc/udev/rules.d/40-permissions.rules

And add the line:

KERNEL==”uinput”, MODE=”0666″

Now either reboot or start the uinput service with:

sudo modprobe uinput

Now start the blueman applet from Applications | Settings | Bluetooth manager

Click on search in the applet and hold down start & enter on the Sony remote for 5 seconds. The Sony remote should be detected

Now press + in the blueman applet (check the always grant access if prompted)

Press the yellow star in the applet to trust this device

In the applet menu navigate to Device | Setup.

Select proceed without pairing

Next select Connect to input service

The remote should now work. With focus in the applet panel press the numeric keys on the remote and they should echo in the applet window. We now have a working Sony Remote. It will also work in a terminal window and other windows.

next we are going to install the kitlaan patches to allow the remote to sleep and wakeup and not require new batteries every few days! I use rechargeable batteries and have the remote auto power off after 5 minutes. Pressing a button on the remote will wake it up again. There is a slight delay in waking the remote and the system responding and sometimes a second keypress is required but I find this far preferable to constantly changing batteries.

First add the kitlaan sources ppa. See here for details

https://launchpad.net/~kitlaan/+archive/ppa

Either setup the path to the kitlaan sources via the package manager or edit the config file:

sudo nano /etc/apt/sources.list

and add the following to the end:

deb http://ppa.launchpad.net/kitlaan/ppa/ubuntu precise main
deb-src http://ppa.launchpad.net/kitlaan/ppa/ubuntu precise main

Change precise for your distribution

Add the correct key:

sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 6F7177CC

Then  install the patches:

sudo apt-get install bluez

sudo apt-get install bluez-utils

sudo apt-get install bluez-compat

Remember to upgrade the bluez packages either manually or from the package manager

I now set the idle-timeout in /etc/bluetooth/input.conf. Remove the # from the start of the line and set to 300 (seconds)

Install lirc

sudo apt-get install lirc

Now we need to configure the keymappings for mythtv and xbmc and provide the functionality to enable switching between the two using the eject button

ensure that ~/.lircrc contains the following 2 lines at the top:

include ~/.lirc/mythtv include ~/.lirc/irexec 

My ~/.lirc/irexec is here:

irexec

This configures the eject button to call a perl script located in the home directory of the my default user. Change mythuser to your own user account directory.

Then copy to ~/scripts the appswitch.pl file from Arkay  (note I have hardcoded the my($LOG) directory in this script):

appswitch.pl

Remember to make this executable:

chmod ugo+x appswitch.pl

Note I had to hardcode the logfile location into this file as it would not appear to accept relative pathnames so you may need to change this!

Here is my ~/.lirc/mythtv file with the keymappings for mythtv:

~/.lirc/mythtv

We now need two configuration files for lirc

/etc/lirc/lircd.conf

/etc/lirc/hardware.conf

Hardware.conf needs to be configured with the correct input. To find which input your BD remote is on:

cat /proc/bus/input/devices

search for the PS3 remote entry in the output and remember which event handler this is using. In my case it is event8. Then edit hardware.conf  and make sure the line

REMOTE_DEVICE="/dev/input/event8"

corresponds. ie if the remote is on event8, make sure hardware.conf uses event8.

Note that I had to set the remote socket in this file also. If you use the file here you should not need to modify this setting.

And finally add the xbmc keymappings

~/.xbmc/userdata/Lircmap.xml

~/.xbmc/userdata/keymaps/Keymap.xml

And we should now have a fully configured remote that works with both xbmc and mythtv and allows us to switch between the two applications using the eject button

Comments

6 responses to “Configuring the Sony PS3 BD Remote with MythTV & XBMC”

  1. Zugol says:

    Hi,

    This how-to is perfect but I have my remote allways pusing down button…

  2. admin says:

    I have noticed this happening after the remote has gone to sleep if you press the buttons too quickly. For some reason nothing will stop it scrolling but pressing [esc] on the keyboard will cancel this.

    I have got into the habit of pressing [enter] on the remote and waiting a few seconds then pressing it again or one of the other buttons. So long as you dont press buttons too quickly to wake the remote then it seems fine……not ideal but I havent had time to track down this problem yet I am afraid

  3. Zugol says:

    Ok ! Thanks a lot !!! You done a great work with the config file and now I can enjoy my hardware !!

  4. admin says:

    Thanks for your comments…..glad someone has found it useful….most of the configs are standard configs it just took a bit of tweaking to work with both myth and xbmc

  5. Stew Benedict says:

    Thanks a bunch for this info. I’ve been using a myth/xbmc setup with the ps3 remote using sonyps3remoted but haven’t been completely satisfied with it. Your setup is working well so far (had to dos2unix the myth file, or irexec wouldn’t launch). I added my hulu key settings to the includes.

    Some slight differences in my setup:
    * I don’t use the appswitch script. I have xbmc and hulu added to my mythtv menu and launch them from there:

    TV_WATCH_RECORDINGS
    XBMC
    EXEC xbmc

    TV_WATCH_RECORDINGS
    Hulu
    EXEC /home/stew/bin/start_hulu_hdmi

    I launch myth, irexec, irxevent from a gnome startup script, on screen :0.1, which is on HDMI to my TV, leaving my workstation desktop clear. I use the eject button to run a script to restart myth if it happens to hang/crash.

    Some implementation of lircd (Mageia in this case) use /etc/sysconfig/lircd. I had to put DRIVER and DEVICE there, rather than hardware.conf.

    I found this little snippet which lets X ignore the uinput from the remote, saves capturing stray inputs into other apps and having weird things happen (console still picks up the keystrokes, but it eliminates one big set of issues). In xorg.conf (change device path as needed):


    Section "InputClass"
    Identifier "ps3remote"
    MatchDevicePath "/dev/input/event6"
    Driver "evdev"
    Option "Ignore" "True"
    EndSection

  6. admin says:

    Thanks for the feedback and some useful snippets of info there I may give a go at some point.

    Apologies about the myth file. I will get that changed! Thought I had sorted all those ooops!

    I did have some problems in the past with locations of the lircd configs but thought that was a thing of the past!

Leave a Reply

Your email address will not be published. Required fields are marked *

fifteen + seventeen =