Kodi Community Forum

Full Version: [LINUX] PS3 Blutooth Remote on XBMC/Fedora Core 12 x86_64 (WITHOUT LIRC)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Thought I'd share my experience, I've narrowed the whole process down to a nice guide:

After publishing my previous experience with XBMC, LIRC and the Iguanaworks IR adapter - I felt that after a bit of long term use the solution was a bit lacking for me. I still had to point the Control at the Tv/PC and holding a key to browse through a large list of movies had shuddering.

I did some more research on the matter, and settled on moving to bluetooth for directionless remote control ability. I had a belkin USB bluetooth adapter lying around, and I purchases a PS3 BD Remote Control unit for R400 from a local supplier.

There have been a few forum posts and articles about this for Ubuntu, but since I'm using Fedora Core 12 64-bit, I thought I'd share my experience:

bluetoothd (The Bluetooth Daemon) is installed by default. to provide a layer access between HCI devices and the kernel, you need to install a package called Bluez. Bluez does not natively support the PS3 remote implementation, so we will need to patch the bluez source with a diff from Kitlaan. To keep package management correct, I install the requisite version of bluez from yum, then compile the same version from source with the diff applied.

First to get the packages - Fedora 12 only has Bluez up to 4.58, and we want 4.64 - I just created a custom repo that pointed to the Fedora 13 repo (/etc/yum.repos.d/f13.repo) - file contents are:

[f13]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://ftp.sun.ac.za/ftp/pub/mirrors/fedora/updates/13/$basearch/
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch

Then execute the yum install of Bluez 4.64:
yum install bluez bluez-libs bluez-libs-devel

Then download the bluez 4.64 source and unzip it
cd ~; wget http://www.kernel.org/pub/linux/bluetoot...64.tar.gz; tar zxvf bluez-4.64.tar.gz

And download the Kitlaan PS3 bluez patch:

cd ~; wget http://kitlaan.twinaxis.com/projects/blu..._4.64.diff

Patch the source:
cd ~\bluez-4.64; patch -p1 < ../bluez_ps3remote_4.64.diff

Then configure, make and install the modified bluez:
cd ~\bluez-4.64; ./configure; make && make install

Next step is to setup the bluetooth remote as an input device on bluetooth, for this you need "Blueman" management tools, so install them: yum install blueman Now login as root, start X and open "blueman-applet" - clieck on "Search" and then press and hold the playstation remotes Enter and Start Buttons together (this puts the remote in discovery mode) - the device will now pop up in the menu of selectable bluetooth devices. click on setup device, and choost NOT to pair, and choose the input service for the device. Once that is done, trust the device and you are done.

Since I auto-login with the "xbmc" user and auto-run XBMC, blueman-applet tries to run in the background as user "xbmc", but with the reduced privileges it usally crashes out with messages in /var/log/messages like:

Aug 31 15:51:19 localhost python: abrt: detected unhandled Python exception in /usr/bin/blueman-applet

The simplest solution is just to set sticky bit on blueman-applet so it will hold its original owner permissions after executing:

chown 7755 /usr/bin/blueman-applet

This got rid of the error messages for me, and it starts up 100% in Gnome. Now that your device is setup with bluetooth, we need to find its Mac address and create a custom mapped input.conf for bluetooth to map the buttons. To find the paired device Mac address (Also check that its connected in /proc):

[root@xbmc ~]# hcitool con
Connections: > ACL 00:23:06:E7:16:F9 handle 1 state 1 lm MASTER

[root@xbmc ~]# cat /proc/bus/input/devices
I: Bus=0005 Vendor=054c Product=0306 Version=0000
N: Name="PS3 Remote Controller"
P: Phys=
S: Sysfs=/devices/virtual/input/input6
U: Uniq=
H: Handlers=kbd event6
B: EV=3
B: KEY=8000000000000000 30000000000000 0 2100000000000000 0 0 bfc00080001c f01c0000d29a1ffe

Copy that ACL Mac address, you'll need to for /etc/bluetooth/input.conf (Listed is my custom configuration, which works for me, but you can change as required):

[General]
# Set idle timeout (in seconds) before the connection will
# be disconnect (defaults to 0 for no timeout)
IdleTimeout=60
#
# This section contains options that are specific to a device
# change this MAC address to that of your paired device
# use "hcitool con" to list active bluetooth connections
[00:23:06:E7:16:F9] <-- Replace this with YOUR Mac Address
# This section is the PS3 Remote keymap. It is loaded when bluez starts.
# Use 'uinput.h' from bluez sources or '/usr/include/linux/input.h' for
# a list of possible KEY_* values.
#
[PS3 Remote Map]
# When the 'OverlayBuiltin' option is TRUE (the default), the keymap uses
# the built-in keymap as a starting point. When FALSE, an empty keymap is
# the starting point.
#OverlayBuiltin = TRUE
#buttoncode = keypress # Button label = action with default key mappings
0x16 = KEY_EJECTCD # EJECT = Eject CD/DVD Drive
0x64 = KEY_Y # AUDIO = Mute Audio
0x65 = KEY_Z # ANGLE = cycle aspect ratio
0x63 = KEY_T # SUBTITLE = toggle subtitles
0x0f = KEY_TAB # CLEAR = Clear menu items on screen
0x28 = KEY_B # TIMER = toggle through sleep
0x00 = KEY_1 # NUM-1
0x01 = KEY_2 # NUM-2
0x02 = KEY_3 # NUM-3
0x03 = KEY_4 # NUM-4
0x04 = KEY_5 # NUM-5
0x05 = KEY_6 # NUM-6
0x06 = KEY_7 # NUM-7
0x07 = KEY_8 # NUM-8
0x08 = KEY_9 # NUM-9
0x09 = KEY_0 # NUM-0
0x81 = KEY_F2 # RED = red
0x82 = KEY_F3 # GREEN = green
0x80 = KEY_F4 # BLUE = blue
0x83 = KEY_F5 # YELLOW = yellow
0x70 = KEY_I # DISPLAY = show information
0x1a = KEY_S # TOP MENU = show guide
0x40 = KEY_M # POP UP/MENU = menu
0x0e = KEY_ESC # RETURN = back/escape/cancel
0x5c = KEY_END # TRIANGLE/OPTIONS = cycle through recording options
0x5d = KEY_BACKSPACE # CIRCLE/BACK = back/escape/cancel
0x5f = KEY_MUTE # SQUARE/VIEW = Adjust Playback timestretch
0x5e = KEY_O # CROSS = select
0x54 = KEY_UP # UP = Up/Skip forward 10 minutes
0x56 = KEY_DOWN # DOWN = Down/Skip back 10 minutes
0x57 = KEY_LEFT # LEFT = Left/Skip back 5 seconds
0x55 = KEY_RIGHT # RIGHT = Right/Skip forward 30 seconds
0x0b = KEY_ENTER # ENTER = select
0x5a = KEY_MINUS # L1 = volume down
0x58 = KEY_Q # L2 = Queue Media
0x51 = KEY_W # L3 = Mark as Watched
0x5b = KEY_EQUAL # R1 = volume up
0x59 = KEY_PAGEUP # R2 = move up one page in watch recordings/EPG
0x52 = KEY_PAGEDOWN # R3 = move down one page in watch recordings/EPG
0x43 = KEY_F9 # PS button = mute
0x50 = KEY_M # SELECT = menu (as per PS convention)
0x53 = KEY_ENTER # START = select / Enter (matches terminology in mythwelcome)
0x33 = KEY_R # SCAN BACK = decrease scan forward speed / play backwards; playback speed; 3x, 5, 10, 20, 30, 60, 120, 180
0x32 = KEY_P # PLAY = play/pause
0x34 = KEY_F # SCAN FORWARD = decrease scan backard speed / increase playback speed; 3x, 5, 10, 20, 30, 60, 120, 180
0x30 = KEY_DOWN # PREVIOUS = skip back 10 mins
0x38 = KEY_X # STOP = back/escape/cancel
0x31 = KEY_UP # NEXT = skip forward 10 mins
# 0x60 = KEY_COMMA # SLOW/STEP BACK = jump back (default 10 minutes)
0x39 = KEY_SPACE # PAUSE = play/pause
# 0x61 = KEY_DOT # SLOW/STEP FORWARD = jump forward (default 10 minutes)
0xff = KEY_MAX

I added the following keys to /usr/local/share/xbmc/system/keymaps/keyboard.xml for the two extra buttons I mapped above (B and Y):

<FullscreenVideo>
<keyboard>
<y>AudioNextLanguage</y>
<b>ShowTime</b>

And thats it, you dont need LIRC or any special key mapping XML's for XBMC, the remote is now just a keyboard, with its buttons mapped to specific keyboard keys. This works extremely well, as holding a button will repeat it, allowing you to run through long lists of movies, etc.. The remote also does not need to be pointed at the TV or PC to work, will work up to about 10 metres (33 feet) away and behind at least one wall. Compared to the Infra-Red setup I did with the Xbox360 remote, this is MUCH better and works 100% without any intervention. Battery life is good, I've been going about 4 weeks without changing batteries so far, with no signs of degraded signal.

Here is the PS3 remote layout on my system:

Image

Original Article Here