How to launch XBMC application in ubuntu from PS3 BD Remote?
#1
I get that XBMC finally has a way to integrate a PS3 remote control. I've tried it and it works nicely, but how do I get the remote to launch XBMC? Or does one just always keep XBMC running idle?

Because if that's the case, I understand that XBMC redraws the menu scree GUI over and over while not playing a video because it all started with an Xbox1, and that's going to generate a lot of unneeded heat and spend excess power with the CPU.

Advice?
Reply
#2
I use irexec to run scripts from my remote.
Reply
#3
(2013-04-29, 01:10)teeedubb Wrote: I use irexec to run scripts from my remote.
That's great for infrared, but what about bluetooth?
Reply
#4
Ah, good point, I've never used a BT remote bdfore. A quick Google took me to

http://code.google.com/p/lirc-bluetooth/...svn44&r=44

Although it seems geared towards phones and BT, it'd be a good place to start.

EDIT: and this link too http://www.mythtv.org/wiki/Sony_PS3_BD_Remote

Looks like you can use lirc with the ps3 remote.
Reply
#5
(2013-04-29, 05:26)teeedubb Wrote: this link too http://www.mythtv.org/wiki/Sony_PS3_BD_Remote

Looks like you can use lirc with the ps3 remote.
Excellent link!! I will play around with this after work, maybe tell you what I did to get it going! Smile
Reply
#6
Looking for a nice, easy solution to this. If I find something I'll post here.

edit-
I used the steps in this thread to figure out that xbmcbuntu already picks up the keypress, and the PlayStation key is already assigned to an "X keysym" called "XF86HomePage" which is supposed to launch your browser to the home page.

Apparently, in regular Ubuntu you can change what the different keysyms do by going to
System -> Preferences -> Keyboard Shortcuts

But this doesn't exist in xbmcbuntu.

I can't figure out what to install to get the "keyboard shortcuts" working. I get the feeling this is the last step we need...
Reply
#7
Got it!

Basically, you have to write a script to launch/activate xbmc, then bind that script to a key/action in openbox's rc.xml.

(edit- Ok, apparently I never read the thread title. I thought this was about launching xbmc, not launching something FROM xbmc. Pretty much the same solution though.)

The script
This is a little complicated because XBMCbuntu/Linux allows you to run multiple instances of XBMC. In other words, if XBMC is already open and you launch it again, you end up with two copies of XBMC open at the same time. Not good. (Some people want multiple instances for multiple screens, but that's not us).

In Windows, if you try to open XBMC again it just sets focus to the instance that's already open. If XBMCbuntu worked this way, we could just put "xbmc" into the openbox rc.xml and be done. Unfortunately, we'll have to put in some extra work to emulate the Windows XBMC behavior. Luckily, I found a script to accomplish this.

First of all, we need a little help. I read some complicated stuff about how shell scripts basically don't have access to program windows, so we need to install wmctrl to handle this for us.
Code:
sudo apt-get install wmctrl

Next, I created a script called startxbmc.sh in my home directory.
Code:
nano ~/startxbmc.sh

And here's what I put inside it:
Code:
#!/bin/bash
ISXBMCUP=`ps -e | grep xbmc.bin | grep -v grep | wc -l`   # Check if XBMC already running (don't want to start another session).

if [ $ISXBMCUP -eq 0 ]; then           # If XBMC isn't running, then OK to start it.
  xbmc &
else
  wmctrl -a xbmc
fi
exit
Ctrl+O to save. Enter to confirm. Ctrl+X to exit.

Then you have to make the script executable.
Code:
chmod +x ~/startxbmc.sh

Now you can test it. Run this with XBMC closed, and it should open. Run this with XBMC open, and it should get focus.
Code:
~/startxbmc.sh


The keybind/action
Once you have a working script, you can assign it to the XF86HomePage key (or whatever keyboard shortcut you want).

Open rc.xml in your favorite editor.
Code:
nano ~/.config/openbox/xbmcbuntu-rc.xml

Look for the <keyboard> section (you'll gave to scroll down a while), then keep going down until you find a bunch of <keybind key="XF86blablabla. If you don't find any XF86___ keybindings by the time you get to the bottom of the </keyboard>, then you can just add the code inside the keyboard section

If you find <keybind key="XF86HomePage"> you can edit it, but I had to add mine from scratch. It looks like this:
Code:
  <keybind key="XF86HomePage">
      <action name="Execute">
          <command>~/startxbmc.sh</command>
      </action>
   </keybind>
Save and close.

This assigns the script we wrote to the HomePage key (which is the PS key on my PS3 remote)!

To make the changes take effect, you can
Code:
openbox --reconfigure
or
Code:
sudo reboot

Done! (let me know if there are any mistakes in this "guide")

References:
http://forum.xbmc.org/showthread.php?tid=149206
http://superuser.com/questions/142945/ba...fic-window
https://bbs.archlinux.org/viewtopic.php?id=93126
http://openbox.org/wiki/Help:Bindings#Key_combination

Quick note:
I imagine this should work for any keyboard with a Home/Browser key. My PS3 remote has the PS key assigned to the Home key in /etc/bluetooth/input.conf (0x43 = KEY_HOMEPAGE). If your PS3 remote is set up using LIRC or something weird, you might have to figure out how to make the PS key act like a keyboard's homepage key for this guide to work.
Reply

Logout Mark Read Team Forum Stats Members Help
How to launch XBMC application in ubuntu from PS3 BD Remote?0