Kodi Community Forum
[LINUX] Sony PlayStation 3 Blu-ray Disc Remote (PS3 BD) + LIRC + XBMC = SUCCESS - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: [LINUX] Sony PlayStation 3 Blu-ray Disc Remote (PS3 BD) + LIRC + XBMC = SUCCESS (/showthread.php?tid=50717)



- flxfxp - 2009-09-29

Don't they have anything todo with the patch formatting and encoding?
Try these, they work for me:
http://dl.getdropbox.com/u/50769/xbmscript/device.patch
http://dl.getdropbox.com/u/50769/xbmscript/fakehid.patch


- kubax - 2009-09-29

these are the patches ruff posted at page 6/7, but he also posted 4 patches at site 16 which i should test..


- flxfxp - 2009-10-02

Copied from the XBMScript thread:
UPDATE 10-02-2009
  • PS3 Bluetooth Remote support. A very special thanks to walmis (blueman developer)
  • Fixed minor bugs and redesigned the questions asked on installation
XBMScript is the first program that has ps3 bluetooth remote support integrated and does not require the tedious process of having a Graphical Desktop (such as GNOME) just to run the blueman-applet

For this feature I would like to give a special shout out to:
walmis: for the ps3_pair program. Without him the ps3 remote pairing would be a lot more difficult! Be sure to check out http://blueman-project.org for the best bluetooth applet on GNOME!
kubax: for all the brainstorming and bluez headaches we shared together Smile
ruff: ps3 remote powersaving and keymapping patches

-------------------------------
It have been a couple of very long days, but I shall explain the technical details here so that you can all enjoy easy ps3 remote usage.

I've had a long and entertaining brainstorm session with kubax to get the ps3 remote initially working with xbmc. During this we discovered that the latest version of bluez supports ps3 remote keymapping and powersaving out of the box! We don't know if ruff's patches got accepted upstream, but this also fixed the problem that kubax had with his remote after he disconnected and reconnected his remote.
This process was done using the latest bluez from the official ubuntu repository and the blueman applet.

After this got figured out I started working on a now graphical way of discovering and pairing the remote. I soon discovered that this was completely impossible with its current commandline tools.
Since the blueman-applet is in fact capable of properly creating the connection and setting up authorization and the input device I decided to have a chat with walmis the maintainer of blueman and owner of http://blueman-project.org.

His help has been very generous and he created a python program that uses the bluez API to:
  1. Discover the remote
  2. Enumerates a list of bluetooth devices and automatically selects the PS3 BD Remote
  3. Sets up pairing
  4. Connects it as a input device

The only issue that remains with the remote setup is that it can't redirect uinput by default. This is circumvented by first running "modprobe uinput" before starting bluetoothd.
To archieve this i removed bluetooth as a service and added "modprobe uinput" and "bluetoothd" to rc.local.
Not all buttons work, but I believe this will be fixed soon enough when ruff's keymapping patch gets accepted at the bluez source. However, the most important buttons (navigation, video buttons) do work.

To easily install the ps3 bluetooth remote without XBMScript use this script:
Code:
      apt-get install bluez -y
      wget http://flx.me/script/ps3_pair.tar.gz
      tar -xzvf ps3_pair.tar.gz
      echo -e '\E[1;37m\033[1mHold the ENTER and START key remote for 7 seconds after pressing any key\033[0m'
      echo Press a key to continue
      read -n1 any_key
      verify="n"
      while [ "$verify" != y ]
      do
      python ps3_pair.py
      echo "Did the Remote got detected and set up? If no, it shall repeat the process(y/n)"
      read verify
      done
      echo "PS3 Remote installation succesful, press any key to reboot"
      read -n1 any_key
      update-rc.d -f bluetooth remove
      echo modprobe uinput > /etc/rc.local
      echo /usr/sbin/bluetoothd >> /etc/rc.local
      echo "exit 0" >> /etc/rc.local
      reboot

Any questions I'll be happy to answer Smile

Regards,

Dennis


- dc2447 - 2009-10-02

flxfxp Wrote:Copied from the XBMScript thread:
UPDATE 10-02-2009
  • PS3 Bluetooth Remote support. A very special thanks to walmis (blueman developer)
  • Fixed minor bugs and redesigned the questions asked on installation
XBMScript is the first program that has ps3 bluetooth remote support integrated and does not require the tedious process of having a Graphical Desktop (such as GNOME) just to run the blueman-applet

For this feature I would like to give a special shout out to:
walmis: for the ps3_pair program. Without him the ps3 remote pairing would be a lot more difficult! Be sure to check out http://blueman-project.org for the best bluetooth applet on GNOME!
kubax: for all the brainstorming and bluez headaches we shared together Smile
ruff: ps3 remote powersaving and keymapping patches

-------------------------------
It have been a couple of very long days, but I shall explain the technical details here so that you can all enjoy easy ps3 remote usage.

I've had a long and entertaining brainstorm session with kubax to get the ps3 remote initially working with xbmc. During this we discovered that the latest version of bluez supports ps3 remote keymapping and powersaving out of the box! We don't know if ruff's patches got accepted upstream, but this also fixed the problem that kubax had with his remote after he disconnected and reconnected his remote.
This process was done using the latest bluez from the official ubuntu repository and the blueman applet.

After this got figured out I started working on a now graphical way of discovering and pairing the remote. I soon discovered that this was completely impossible with its current commandline tools.
Since the blueman-applet is in fact capable of properly creating the connection and setting up authorization and the input device I decided to have a chat with walmis the maintainer of blueman and owner of http://blueman-project.org.

His help has been very generous and he created a python program that uses the bluez API to:
  1. Discover the remote
  2. Enumerates a list of bluetooth devices and automatically selects the PS3 BD Remote
  3. Sets up pairing
  4. Connects it as a input device

The only issue that remains with the remote setup is that it can't redirect uinput by default. This is circumvented by first running "modprobe uinput" before starting bluetoothd.
To archieve this i removed bluetooth as a service and added "modprobe uinput" and "bluetoothd" to rc.local.
Not all buttons work, but I believe this will be fixed soon enough when ruff's keymapping patch gets accepted at the bluez source. However, the most important buttons (navigation, video buttons) do work.

To easily install the ps3 bluetooth remote without XBMScript use this script:
Code:
      apt-get install bluez -y
      wget http://flx.me/script/ps3_pair.tar.gz
      tar -xzvf ps3_pair.tar.gz
      echo -e '\E[1;37m\033[1mHold the ENTER and START key remote for 7 seconds after pressing any key\033[0m'
      echo Press a key to continue
      read -n1 any_key
      verify="n"
      while [ "$verify" != y ]
      do
      python ps3_pair.py
      echo "Did the Remote got detected and set up? If no, it shall repeat the process(y/n)"
      read verify
      done
      echo "PS3 Remote installation succesful, press any key to reboot"
      read -n1 any_key
      update-rc.d -f bluetooth remove
      echo modprobe uinput > /etc/rc.local
      echo /usr/sbin/bluetoothd >> /etc/rc.local
      echo "exit 0" >> /etc/rc.local
      reboot

Any questions I'll be happy to answer Smile

Regards,

Dennis

I guess this needs to be run from inside a gnome session?

Quote: python ps3_pair.py
ERROR:dbus.proxies:Introspect error on org.bluez:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.bluez was not provided by any .service files
Traceback (most recent call last):
File "ps3_pair.py", line 90, in <module>
Main()
File "ps3_pair.py", line 18, in __init__
self.adapter = self.manager.GetAdapter()
File "/home/davidcam/bluez/utils.py", line 28, in warp
raise errors.parse_dbus_error(exception)
bluez.errors.DBusServiceUnknownError: The name org.bluez was not provided by any .service files



- flxfxp - 2009-10-02

This doesn't need gnome at all, that was the intention. I tested with python 2.6.2. Are you running python 3?


- dc2447 - 2009-10-02

flxfxp Wrote:This doesn't need gnome at all, that was the intention. I tested with python 2.6.2. Are you running python 3?

dpkg-query -W python
python 2.6.2-0ubuntu1


- flxfxp - 2009-10-02

This means that bluez isnt installed or running.


- dc2447 - 2009-10-02

flxfxp Wrote:This means that bluez isnt installed or running.
That was embarassing, I had stopped bluetooth to load uinput

Ok, so I register the device but nothing happens, as in no keypresses do anything, puase, play etc

I confirmed that the pairing had worked by rerunning the script


python ps3_pair.py
Searching for devices, please wait...
Found:
1: 00:1D:4F:9C:EC:54 [David Campbell’s Computer]
2: 00:23:06:E9:74:B1 [BD Remote Control]
Select the device you wish to add [2]: 2
Registering device... Failed ( Device already exists )


- flxfxp - 2009-10-02

ok, so that isn't the problem. Have you just used the script or copied bits and pieces?
Because it has problems if uinput hasnt been ran before. do a "modprobe uinput" and after that start "bluetoothd -nd". Start bashing some buttons and see what is the outcome.

Ruff, any news about the patches being accepted upstream? It would make life a lot easier.

Regards,

Dennis


- dc2447 - 2009-10-02

flxfxp Wrote:ok, so that isn't the problem. Have you just used the script or copied bits and pieces?
Because it has problems if uinput hasnt been ran before. do a "modprobe uinput" and after that start "bluetoothd -nd". Start bashing some buttons and see what is the outcome.

I made sure uinput was loaded, started bluetooth and ran the script to pair

I have tried stopping bluetooth, doublechecking uinput is loaded rerunning bluetoothd but key pressing does nothing

http://pastie.org/639972

Actually, the only thing I didn't do was reboot, will try that

edit2: rebooted, no dice, no action keypress


- flxfxp - 2009-10-03

What distro are you using?

By the way, does anyone know how to make deb packages? I'd like to make a deb package out of the latest bluez with the patches applied for easy usage.


- dc2447 - 2009-10-03

flxfxp Wrote:What distro are you using?

By the way, does anyone know how to make deb packages? I'd like to make a deb package out of the latest bluez with the patches applied for easy usage.

I'm using Karmic.

Building a deb of the latest and greatest is trivial, getting it into a useful repo is harder...


No key events - adrian - 2009-10-04

Tried your short script on my xbmc system it seemed to work and paired the remote but like dc2447 buttons do nothing. I am running up to date Jaunty but apt reports the latest bluez version as 4.32 this seems too old to have any of the newer patches. Do I need a newer version? You post says that it works with latest official Ubuntu version and it looks like dc2447 is running bluez 4.51.


- dc2447 - 2009-10-04

adrian Wrote:Tried your short script on my xbmc system it seemed to work and paired the remote but like dc2447 buttons do nothing. I am running up to date Jaunty but apt reports the latest bluez version as 4.32 this seems too old to have any of the newer patches. Do I need a newer version? You post says that it works with latest official Ubuntu version and it looks like dc2447 is running bluez 4.51.
I'm on Karmic and bluez 4.51-0ubuntu2

I also compiled 4.55 but no dice

Code:
bluetoothd -dn
bluetoothd[10400]: Bluetooth daemon 4.55
bluetoothd[10400]: Enabling debug information
bluetoothd[10400]: parsing main.conf
bluetoothd[10400]: discovto=0
bluetoothd[10400]: pairto=0
bluetoothd[10400]: pageto=8192
bluetoothd[10400]: name=%h-%d
bluetoothd[10400]: class=0x000100
bluetoothd[10400]: discov_interval=0
bluetoothd[10400]: Key file does not have key 'DeviceID'
bluetoothd[10400]: Starting SDP server
bluetoothd[10400]: Loading builtin plugins
bluetoothd[10400]: Loading audio plugin
bluetoothd[10400]: Loading input plugin
bluetoothd[10400]: Loading serial plugin
bluetoothd[10400]: Loading network plugin
bluetoothd[10400]: Loading service plugin
bluetoothd[10400]: Loading hciops plugin
bluetoothd[10400]: Loading hal plugin
bluetoothd[10400]: Loading storage plugin
bluetoothd[10400]: Loading plugins /usr/local/lib/bluetooth/plugins
bluetoothd[10400]: register_interface: path /org/bluez/10400/any
bluetoothd[10400]: Registered interface org.bluez.Service on path /org/bluez/10400/any
bluetoothd[10400]: /etc/bluetooth/network.conf: Key file does not have key 'Disable'
bluetoothd[10400]: /etc/bluetooth/network.conf: Key file does not have key 'DisableSecurity'
bluetoothd[10400]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'
bluetoothd[10400]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'
bluetoothd[10400]: /etc/bluetooth/network.conf: Key file does not have key 'Interface'
bluetoothd[10400]: Config options: InterfacePrefix=bnep%d, PANU_Script=(null), GN_Script=(null), NAP_Script=(null), GN_Interface=pan0, NAP_Interface=pan1, Security=true
bluetoothd[10400]: bridge pan0 created
bluetoothd[10400]: input.conf: Key file does not have key 'IdleTimeout'
bluetoothd[10400]: Unix socket created: 9
bluetoothd[10400]: audio.conf: Key file does not have key 'AutoConnect'
bluetoothd[10400]: audio.conf: Key file does not have key 'MaxConnected'
bluetoothd[10400]: Telephony plugin initialized
bluetoothd[10400]: HFP AG features: "Ability to reject a call" "Enhanced call status" "Extended Error Result Codes"
bluetoothd[10400]: HCI dev 0 registered
bluetoothd[10400]: child 10415 forked
bluetoothd[10400]: btd_adapter_ref(0x23374b8): ref=1
bluetoothd[10400]: Entering main loop
bluetoothd[10400]: RFKILL event idx 0 type 2 op 0 soft 0 hard 0
bluetoothd[10400]: RFKILL event idx 1 type 1 op 0 soft 0 hard 0
bluetoothd[10400]: child 10415 exited
bluetoothd[10400]: HCI dev 0 up
bluetoothd[10400]: Starting security manager 0
bluetoothd[10400]: Changing Major/Minor class to 0x000104
bluetoothd[10400]: register_interface: path /org/bluez/10400/hci0
bluetoothd[10400]: Registered interface org.bluez.Service on path /org/bluez/10400/hci0
bluetoothd[10400]: network_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: btd_adapter_ref(0x23374b8): ref=2
bluetoothd[10400]: Adding record with handle 0x10000
bluetoothd[10400]: Record pattern UUID 0000000f-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001115-0000-1000-8000-00805f9
bluetoothd[10400]: register_server_record: got record id 0x10000
bluetoothd[10400]: Registered interface org.bluez.NetworkPeer on path /org/bluez/10400/hci0
bluetoothd[10400]: network_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: Adding record with handle 0x10001
bluetoothd[10400]: Record pattern UUID 0000000f-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001117-0000-1000-8000-00805f9
bluetoothd[10400]: register_server_record: got record id 0x10001
bluetoothd[10400]: Registered interface org.bluez.NetworkHub on path /org/bluez/10400/hci0
bluetoothd[10400]: network_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: Adding record with handle 0x10002
bluetoothd[10400]: Record pattern UUID 0000000f-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001116-0000-1000-8000-00805f9
bluetoothd[10400]: register_server_record: got record id 0x10002
bluetoothd[10400]: Registered interface org.bluez.NetworkRouter on path /org/bluez/10400/hci0
bluetoothd[10400]: proxy_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: btd_adapter_ref(0x23374b8): ref=3
bluetoothd[10400]: Registered interface org.bluez.SerialProxyManager on path /org/bluez/10400/hci0
bluetoothd[10400]: Parsing /etc/bluetooth/serial.conf failed: No such file or directory
bluetoothd[10400]: btd_adapter_ref(0x23374b8): ref=4
bluetoothd[10400]: headset_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: btd_adapter_ref(0x23374b8): ref=5
bluetoothd[10400]: audio_adapter_ref(0x2338820): ref=1
bluetoothd[10400]: audio.conf: Key file does not have key 'Master'
bluetoothd[10400]: Adding record with handle 0x10003
bluetoothd[10400]: Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001108-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001112-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001203-0000-1000-8000-00805f9
bluetoothd[10400]: audio.conf: Key file does not have key 'SCORouting'
bluetoothd[10400]: Adding record with handle 0x10004
bluetoothd[10400]: Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000111e-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000111f-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001203-0000-1000-8000-00805f9
bluetoothd[10400]: a2dp_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: audio_adapter_ref(0x2338820): ref=2
bluetoothd[10400]: audio.conf: Key file does not have key 'Enable'
bluetoothd[10400]: audio.conf: Key file does not have key 'Disable'
bluetoothd[10400]: audio.conf: Key file does not have group 'A2DP'
bluetoothd[10400]: audio.conf: Key file does not have group 'A2DP'
bluetoothd[10400]: audio.conf: Key file does not have group 'A2DP'
bluetoothd[10400]: audio.conf: Key file does not have group 'A2DP'
bluetoothd[10400]: audio.conf: Key file does not have key 'Master'
bluetoothd[10400]: SEP 0x23399d8 registered: type:0 codec:0 seid:1
bluetoothd[10400]: Adding record with handle 0x10005
bluetoothd[10400]: Record pattern UUID 00000019-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000110a-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000110d-0000-1000-8000-00805f9
bluetoothd[10400]: avrcp_server_probe: path /org/bluez/10400/hci0
bluetoothd[10400]: audio_adapter_ref(0x2338820): ref=3
bluetoothd[10400]: audio.conf: Key file does not have key 'Master'
bluetoothd[10400]: Adding record with handle 0x10006
bluetoothd[10400]: Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000110c-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[10400]: Adding record with handle 0x10007
bluetoothd[10400]: Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[10400]: Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[10400]: Creating device /org/bluez/10400/hci0/dev_00_23_06_E9_74_B1
bluetoothd[10400]: btd_device_ref(0x233aa78): ref=1
bluetoothd[10400]: Probe drivers for /org/bluez/10400/hci0/dev_00_23_06_E9_74_B1
bluetoothd[10400]: hid_device_probe: path /org/bluez/10400/hci0/dev_00_23_06_E9_74_B1
bluetoothd[10400]: btd_device_ref(0x233aa78): ref=2
bluetoothd[10400]: Registered interface org.bluez.Input on path /org/bluez/10400/hci0/dev_00_23_06_E9_74_B1
bluetoothd[10400]: Adapter /org/bluez/10400/hci0 has been enabled
bluetoothd[10400]: Computer is classified as desktop
bluetoothd[10400]: Setting 0x000104 for major/minor device class

also, is the need for lirc config now deprecated by using this method?


- flxfxp - 2009-10-05

lirc should not be needed. I don't know about Karmic but it should work on Jaunty. Anyway, I agree i've been a bit shortsighted by not checking which bluez version is included with 9.04. Thats why I'm looking for people that can help create a patched deb for easy installation and usage. This is not trivial at all.

ruff. Kubax mentioned to me before he went on vacation that the latest cpu patches from you didn't patch correctly due to formatting. Could you please post them in code in this thread or on pastebin.com? Thanks.