It appears that I'm not alone in experiencing problems recently setting up the communication between a Sony Bluetooth BD/Playstation controller and Linux. These problems have been caused by Oneiric Ubuntu sources leapfrogging Kitlaan's PPA. (The modified code was developed by Kitlaan and Ruff; the changes are pretty extensive in the areas touched, so the bluez project hasn't yet agreed to accept it. Also,
http://h00s.net/ps3bdremote.tar.gz, referenced in some of the other postings, is not currently available.)
I found that although running ps3_pair.py appeared to work, and the device was listed when running list-devices, it showed 'Connected = 0' and was not listed when running 'cat /proc/bus/input/devices'.
After a lot of experimenting here's an approach that worked for me on Mythbuntu 11.10 (MythTV on Oneiric Ocelot). Note that this approach assumes that you have access to a graphical interface (if you're using XBMC Live then according to an earlier posting you need to use fluxbox).
This approach is based on information posted on this forum and elsewhere - thanks to all of you for sharing the information (and of course to Ruff and Kitlaan for writing the code).
1. If you already have bluez installed then uninstall it by entering:
Code:
sudo apt-get purge bluez
2. Ensure that your bluetooth receiver (dongle or built in) is listed when you run lsusb. It should display something similar to this:
Code:
Bus 002 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
3. We need to specify that when we install bluez we want to use Kitlaan's patched version, by doing the following:
Add the following lines at the end of /etc/apt/sources.list
Code:
deb http://ppa.launchpad.net/kitlaan/ppa/ubuntu oneiric main
deb-src http://ppa.launchpad.net/kitlaan/ppa/ubuntu oneiric main
(Change 'oneiric' to the version of Ubuntu that you're running in the previous two lines if it's not 11.10.)
Run the following command:
Code:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6F7177CC
Create a file /etc/apt/preferences.d/bluez-pin-700
which contains the following:
Code:
Package: *
Pin: release o=LP-PPA-kitlaan
Pin-Priority: 700
4. Now install bluez by issuing the following commands:
Code:
sudo apt-get update
sudo apt-get install bluez
5. Check that you have the correct version of bluez by running:
The result should be:
Code:
ii bluez 4.96-0ubuntu3+kitlaan1~oneiric Bluetooth tools and daemons
(If the result is '4.96-0ubuntu4' then you have the version where Kitlaan's patches have been overwritten.)
6. Restart the bluetooth service:
Code:
sudo service bluetooth restart
7. Obtain and run Kitlaan's pairing program by issuing the following commands:
Code:
cd ~
wget http://kitlaan.twinaxis.com/projects/bluez-ps3remote/ps3pair.tar.gz
tar xvfz ps3pair.tar.gz
cd ~/ps3pair
sudo python ps3_pair.py
Hold the START and ENTER buttons on the PS3 remote; the result should be similar to the following:
Code:
vaughan@myth1110b:~/ps3pair$ sudo python ps3_pair.py
Please HOLD the START and ENTER buttons on the PS3 remote.
Searching for devices, please wait...
Found:
1: 00:06:F5:94:20:29 [BD Remote Control]
Select the device you wish to add [1]: 1
Registering device... Done
(This causes data about the paired device to be stored in a directory off /var/lib/bluetooth.) (If this doesn't work first time, then keep trying - on one of my systems this only worked on the third or fourth attempt.)
After this, issuing '/usr/share/doc/bluez/examples/list-devices' should show something similar to the following:
Code:
[ /org/bluez/3651/hci0 ]
Name = myth1110b-0
Powered = 1
Devices = dev_00_06_F5_94_20_29
DiscoverableTimeout = 0
PairableTimeout = 0
Discoverable = 0
Address = 00:15:83:3D:0A:57
Discovering = 0
Pairable = 1
Class = 4849920
UUIDs = 0x1000 0x1001 0x1112 0x111f 0x110a 0x110c 0x110e 0x1103
[ /org/bluez/3651/hci0/dev_00_06_F5_94_20_29 ]
Name = BD Remote Control
Paired = 0
Adapter = /org/bluez/3651/hci0
Alias = BD Remote Control
Connected = 0
UUIDs = 0x1124 0x1200
Address = 00:06:F5:94:20:29
Services = dbus.Array([], signature=dbus.Signature('o'), variant_level=1)
Class = 0x00250c
Trusted = 1
Blocked = 0
(Note that Connected is set to '0'.)
7. Install the Bluetooth manager by issuing the following:
Code:
sudo apt-get install blueman
8. Run the Bluetooth manager by opening (under X):
Applications->Settings->Bluetooth Manager
It should display a list of known Bluetooth Devices comprising just 'BD Remote Control'.
Right click on 'BD Remote Control' and click on 'Input Service'.
It may display 'Connection Failed: Host is down (112) - this isn't necessarily a problem.
If you then key on the digits (0-9) on the remote control while focus is still on the 'Bluetooth Devices' display then a window should open up which displays the numbers which you key.
If you shift focus to a different window then the results of the keypresses should be displayed in this different window.
If you issue 'cat /proc/bus/input/devices' the output should contain something similar to the following:
Code:
I: Bus=0005 Vendor=054c Product=0306 Version=0000
N: Name="PS3 Remote Controller"
P: Phys=
S: Sysfs=/devices/virtual/input/input4
U: Uniq=
H: Handlers=kbd event4
B: PROP=0
B: EV=3
B: KEY=80000000 0 700000 1083c100 8c00ea 0 6bc00000 1 0 8000 1102 c0000801 801680 0 0 10000ffe
9. Set the IdleTimeout value in /etc/bluetooth/input.conf: remove the '#' from the start of the line and set it to, say, 600 (seconds). (Issue 'sudo service bluetooth restart' after modifying input.conf.) (The bluetooth connection is disconnected after the IdleTimeout period expires; after that, the response to the next keypress on the remote control is delayed while the bluetooth connection is reestablished.)
10. If there is a risk that your system may shut down or suspend before the timeout has expired and terminated the bluetooth connection you may like to refer to the Baswazz posting from April 2011 referencing the bt-disconnect-all script (to prevent the "battery dies in less than a week" issue).
11. With this configuration I found that it worked fine until the system was restarted. After this the remote control had no effect, and nothing was listed when running list-devices. After manually entering 'sudo service bluetooth restart' the control worked again. There may be a more elegant way of doing this, but I found that after adding a line
Code:
service bluetooth restart
before 'exit 0' in /etc/rc.local it would then work OK after restarting the system.
12. Now tailor the keymappings in /etc/bluetooth/input.conf as desired for MythTV/XBMC, and configure lirc if/as necessary.
Hope this of of use - Vaughan