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)



- neil.j1983 - 2009-11-20

nanny07 Wrote:ok.. finally. SUCCESS!

I think the problem it's, without a dubt, the pair script.
I put my dongle on windows, pair with the remote and then plugged in xbmc and everything works Smile

Now I must change the button...

How can i know wich button is pressed and how to change the fuction (in xbmc) of the pressed button?
I think that i must change the input.conf file, but there is a sort of guido to know the KEY_*(i think is the equivalent xbmc input) button?

i will post mine up on pastebin ;ater if you get stuck, but you need to uncomment the line with [11:22:33,etc] in it, and change it to your mac address

you also need to uncomment the line which tells it to use the PS3 REMOTE XBMC profiler, then scroll down to the very bottom and change the KEY_* entries to whatever key you want, the list of available ones is in the file /etc/input.h (i think), i'm pretty new to this ubuntu thing myself..

If anyone works out how to launch xbmc with a remote keypress i would be very grateful if they could share the method.


- nanny07 - 2009-11-20

i try the one of kitlaan but same fuction missing: like volume, the music/movies/tv show button (red,blue,yellow) and one for emulate the right-click

EDIT: one more thing... in the kitlaan's file the timeout is set on 30 minutes! I think it's too high... what about 3 minutes?


- kitlaan - 2009-11-21

I've been going between many timeout values. The most recent one I've been doing is 4 minutes. The default bluez timeout is 0 (as in no timeout)! I would definitely change the value if you're using the remote. In my usage, I always set a custom timeout value (i.e. set one in the device-specific section).

The KEY_* strings can be grabbed from the files listed in the conf file. Most of them match up to what's expected, but a few are really dependant on how Xorg has the keymaps set up. The most likely source is /usr/src/linux-headers-.../include/linux/input.h. From there, you may also have to configure your userdata/keymaps/keyboard.xml.

(Note, in Linux, there's the kernel keymap, and then there's the Xorg keymap, which is limited to 255 values. If you can't get a key working, you probably need to set up an xorg keymap.)

Here's a better tar archive for the pair/unpair scripts (based on the original ones)


- nanny07 - 2009-11-21

I made a search in this 3d and I found this very useful post that show me the name of every button and this one for the keymap.xml

So I have modify the keymap in accord with this list of command and now it's all configured!

I think this post will be usefull for who want to change some settings


getting PS3 BD Remote from Connected: 0 => 1 under bluez - faxo - 2009-11-23

Like nanny07 and others, I had the same problem with the PS3 BD Remote not getting "Connected: 1" (and thus not appearing in '/proc/bus/input/devices | grep emot'). This was after running kitlaan's bluez and ps3 pairing script multiple times. I also confirmed that my output from 'bluetoothd -nd' was as expected, and /var/lib/bluetooth/ contained all the right device codes (the same as kitlaan's).

Then I saw nanny07's post about having done a pairing in windows and things suddenly working for him. I tried to do the same, but I could not pair the remote in windows, because the IOGEAR software that came with my dongle wouldn't accept a pairing without a PIN number.

That's when I happened accross the following:
http://h00s.net/site/ubuntu/using-ps3-bd-remote-with-ubuntu-linux/

and decided to give it a shot. After updating line 27, per the author's instructions, to have the remote's MAC address, I fired up the script, and to my surprise it worked! Every keypress was reported by the script correctly, 'list-devices' returned "Connected: 1", and cat /proc/bus/input/devices showed the remote. For the first time ever, Linux and the remote were communicating.

But, as soon as I CTRL-C'd out of the script, things returned to their previous state. No more "Connected: 1" in list-devices, and no more remote in /proc/bus/input/devices.
Back to no communication between the remote and bluetoothd. Frustrating.

I ran the script several more times (3? 5?), to see if I could reproducibly have it connect. It worked every time, holding enter+start per the instructions.

That's when something unbelievable happened. After I exited the script (after X runs, maybe 5), I held enter+start while running 'bluetoothd -nd' but without running the script, and output appeared from bluetoothd. I hit some random buttons on the remote and bluetoothd reported the ID #'s of the keypresses every time.

I exited out of 'bluetoothd -nd' and re-ran it as '/etc/init.d/bluetooth start', and this time just hit a few buttons on the remote (not enter+start). Checking list-devices, to my surprise, it was "Connected: 1". It also appeared in /proc/bus/input/devices. Hitting numbers on the remote did exactly as was described above, they appeared in my xterm window.

Wanting to see if this working state would survive a reboot, I power cycled.. and again hit a few arrow keys on the remote, and it instantly connected again. Firing up XBMC, the basic directional navigation and selection worked! Amazing. Since that point, hitting any button on the remote causes it to pair/connect instantly, and it stays that way until my input.conf Timeout, at which point it goes to sleep (I'm using a timeout of 1 minute currently). Pressing buttons on it again pairs/connects it, so everything is working great.

So how to explain this drastic switch to a working state? This remote was brand new out of the box, and I don't own a PS3, and it had never been paired with anything before.
As such, the following is a wild hypothesis (for which I have no data to back up) which may or may not be true:

I propose that the act of direct-connecting to the PS3 BD Remote X times (where X = 1? 3? 5?) via the h00s script
trained the remote to connect back to my dongle's MAC address whenever it's woken up via keypress. Under this (admittedly far fetched) model, the remote connects to the last bluetooth MAC address which connected to it. Perhaps this is why the PS3 BD Remote instructions say that it can only be paired with one PS3 at a time.

(I really know nothing about Bluetooth, so if this theory is completely ridiculous, now you know why!)

Hopefully this "silly" method of getting the remote to connect helps someone else. If it makes any sense and holds out for others, perhaps kitlaan can update his pairing script to also perform an outbound connection as a final step. I'm now on to playing with Keymaps to get the other half of the buttons to work in XBMC.

Thanks to everyone who's contributed to this thread. The work is tremendous and appreaciated.


only few keys are working, what should i do now? - shiree1 - 2009-11-23

kitlaan Wrote:... From there, you may also have to configure your userdata/keymaps/keyboard.xml.

(Note, in Linux, there's the kernel keymap, and then there's the Xorg keymap, which is limited to 255 values. If you can't get a key working, you probably need to set up an xorg keymap.)

hi, kitlaan.
first of all, thanks for your support. i'm a linux noob and completely depending on guys on this forum.

i'm on karmic x64 minimal without any window manager and xbmc 9.11beta1 from svn ppa.
after fresh install, i installed your patched bluez 4.57 from ppa, and paired with ps3_pair.py script.

it paired without problem and few keys (NUMBERS 0~9, ENTER, RETURN, HOMEPAGE generally,
and STOP and BACKWARD SCAN in full screen video. these are all keys that i found working) are working after that.

so, i tried to re-config my remote in keyboard mode. changed few lines from input.conf like this,
Code:
#/etc/bluetooth/input.conf
....
[00:19:C1:D1:01:2E] # my PS3BD remote
CustomKeymap=XBMC PS3 Remote
....

copied /usr/share/xbmc/system/keymaps/keyboard.xml to ~/.xbmc/userdata/keymaps/keyboard.xml but changed nothing
(it looks like already matches with the input.conf codes),

in xbmc's SETTINGS > SYSTEM > INPUT DEVICES, checked the option "REMOTE CONTROL SENDS KEYBOARD PRESS" on.

but still only the same keys are working.

then i saw your post and checked my keymaps.
my kernel keymap is pc105(intl) us, and xorg.conf is configured like this,
Code:
#/usr/etc/X11/xorg.conf
Section "InputDevice"
# generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "CoreKeyboard"
    Option         "XkbRules" "xorg"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us"
EndSection

Code:
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 event3
B: EV=3
B: KEY=8000000000000000 0 0 0 8000 100240000801 80ffc00080001f ....

it looks like everything's configured correctly, but still not working properly.
and i have no idea what's wrong.

what should i do now? any suggestion?

----------------
update :
now it's working properly.
i don't know why, because i did too many things that i don't even understand. Wink
but i'm suspecting it's somehow concerned with the lirc.
however, thanks guys. Big Grin


- spArcling - 2009-11-23

Hi,

Thanks, this fixed it for me as well.

nanny07 Wrote:ok.. finally. SUCCESS!

I think the problem it's, without a dubt, the pair script.
I put my dongle on windows, pair with the remote and then plugged in xbmc and everything works Smile



- kitlaan - 2009-11-24

shiree1 Wrote:hi, kitlaan.
copied /usr/share/xbmc/system/keymaps/keyboard.xml to ~/.xbmc/userdata/keymaps/keyboard.xml but changed nothing
(it looks like already matches with the input.conf codes),

If I remember right, the input.conf that's shipped in the deb, sends keys that aren't part of xbmc's default keyboard.xml... See this post. I think other than the ones that you listed, maybe triangle, up/down/left/right, will work in the default.



In other news, I'm hoping sometime this thanksgiving break I'll have some time to get back to work on improving ruff's smart-sleeping functionality so I can finally get that into my patch. (ruff's implementation is great; just trying to add bluez cleanup/shutdown code.) If not, I may just shove it in as is just to have it in.


bluez~kitlaan ppa update! - kitlaan - 2009-11-25

Hey everybody!

Anyone that's using using bluez from my PPA will need to watch out for the next update (bluez_4.57-0ubuntu1~kitlaan9). This one changes the format of input.conf. It'll probably show up in the next few hours.

Here's the changes, so you know what you're expecting:
  • input.conf format change. There is now only one keymap for all PS3 remotes in the input.conf. (The multi-keymap idea just isn't really worthwhile.)
  • input.conf loaded on bluez startup.
  • No keypress loss on remote reconnect (~50msec delay still there).

To do the quick-reconnect, I had to change how I loaded the keymap (otherwise things could get all messed up).

I would make a copy of your current input.conf and put it in a safe place. When the upgrade happens, it'll keep your old file, so you'll have to merge the changes in. For reference, here's the original and my custom input.conf


- faxo - 2009-11-28

kitlaan Wrote:Hey everybody!

Here's the changes, so you know what you're expecting:
  • input.conf format change. There is now only one keymap for all PS3 remotes in the input.conf. (The multi-keymap idea just isn't really worthwhile.)
  • input.conf loaded on bluez startup.
  • No keypress loss on remote reconnect (~50msec delay still there).

Awesome. Is there a diff (like your first post) for we non-Ubuntu types?

Thanks,


- nanny07 - 2009-11-28

could you post the new input.conf?

when i installed the new version i had choose not to replace the old file and now some buttons didn't work

EDIT: no, neither with the new input.conf a lot of button doesn't work Sad
EDIT2: with a restart it seems all ok


- kitlaan - 2009-11-28

faxo Wrote:Awesome. Is there a diff (like your first post) for we non-Ubuntu types?

Thanks,

Ah, right. Forgot to do so. The latest patch is now up.

Remember, any change of input.conf now requires a restart of bluetoothd (instead of just a reconnect of the remote).


- nanny07 - 2009-11-28

i don't know if is a bug of xbmc or of the new version of kitlaan's bluez, but when i switch language in a movie it's also fastforward for about 2 seconds

Is it happen also to you?


- kitlaan - 2009-11-28

nanny07 Wrote:i don't know if is a bug of xbmc or of the new version of kitlaan's bluez, but when i switch language in a movie it's also fastforward for about 2 seconds

Is it happen also to you?

Yeah, that happened to me even before I started using the remote.


- faxo - 2009-11-29

kitlaan Wrote:Ah, right. Forgot to do so. The latest patch is now up.

Remember, any change of input.conf now requires a restart of bluetoothd (instead of just a reconnect of the remote).

Thanks, the patch applied cleanly and the new input.conf is working.

A few questions:

1) Is there any support for Ruff's sub-1-minute timeouts? Perhaps by specifying "15s" instead of just "15" (which results in 15 minutes)?

2) When my PS3 Remote timeout (currently set to 1 minute) occurs, I see the following in 'bluetooth -nd':

bluetoothd[18798]: Disconnecting device because of timeout
bluetoothd[18798]: Input: disconnect /org/bluez/18798/hci0/dev_00_21_4F_AA_24_1F
bluetoothd[18798]: Disconnecting PS3 remote
bluetoothd[18798]: Destroying timer
(bluetoothd:18798): GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed

This last line concerns me. It only shows up in 'bluetooth -nd' and not in syslog.

3) Sometimes my bluetoothd crashes, perhaps because of #2. As such, I've now got bluetoothd running in a while loop to respawn it quickly. Is anyone else experiencing this? It seems to happen after several timeouts of the PS3 Remote. Maybe I only noticed it because I'm not running upstart, which would have respawned the daemon.