View Full Version : [MAC] HOW-TO use Sony PS3 Bluetooth Remote to control XBMC for Mac
Yeh, I know this is dirty hack.
Yeh, I know this is ugly.
Yeh, I know this is unfinished in all ways.
Yeh, I know this is not customizeable in any way.
Yeh, I know this might crash.
Okay, someone asked for this in blog's comments. This is about my first cocoa/obj-c apps so it is ugly and poorly made and full of things that are not implemented.
So this is small app which connects to PS3 BD remote via Bluetooth and binds buttons to keyboard presses and that way is able to control XBMC. No, keys are not rebindable yet. No, it doesnt support long presses yet.
Usage:
Start ps3remote.app
Press enter and start simoltaneously and click connect, keep pressing enter and start until connect.
If it gets connection, it should work, just start XBMC and start using it. If it didn't, try again.
UI hides itself when not in focus (click from dock to see it again)
Keys binded. Arrows, enter, back, return, play, stop, scanfwd, scanrew, stepfwd and steprew. Works with default keymap.xml.
As I said, I'm cocoa newb so development will be slow. Next goal is to get long presses working. Sourcecode will come when I have cleaned it up. Then later maybe implement this straight to XBMC but there is not
Nothing more to say, I hope this will be usefull to someone (I doubt that)
Alpha 0.01: http://tv.aninga.net/ps3remote.app.zip
Thanks for posting this!
-elan
bmfrosty
2008-02-09, 01:08
Hrm. I wish I could offer to write something like this, but I really don't have the skills. It seems to me that eventually XBMC should have a built in bluetooth sync menu and a remote selection menu.
No one's really tried this yet? Oh well, I'm off for a week. But when I got back in business, I'll try to include this to OSXBMC. Elan, could you post full compilation information somewhere (which macports I need, which ffmpeg it uses and configs and so on). There is no way to do controls modularily? Would there even be someone intrested in using ps3 remote for their OSXBMC?
No one's really tried this yet? Oh well, I'm off for a week. But when I got back in business, I'll try to include this to OSXBMC. Elan, could you post full compilation information somewhere (which macports I need, which ffmpeg it uses and configs and so on). There is no way to do controls modularily? Would there even be someone intrested in using ps3 remote for their OSXBMC?
I just did. I went to Best Buy today and bought the PS3 BT remote. And It works quite well !!:nod:
Thank you for your contribution. I'm not a programmer, but I did look at the resources inside your app hoping I could find some means to assign the keys, but unfortunately I didn't.
AS it looks right now, the app is useful for basic navigation, which is pretty good, especially if you consider it's the only game in town.
Is there a way to add some sort of a configuration, even if it's via a "config" file (text, xml, etc), where you can define the key binding? Tha would really go a long way to make this really useful. It doesn't have to be pretty, just workable.
Thanks again.
Dudeman:grin:
Is there a way to add some sort of a configuration, even if it's via a "config" file (text, xml, etc), where you can define the key binding? Tha would really go a long way to make this really useful. It doesn't have to be pretty, just workable.
Okay I'm back. Yeh, It doesn't have it yet, but I promise there will be some sort of config coming. Dont really know how to do it easily but I'll look for it. There are two ways to make this progg awesome: 1) Make it like RemoteBuddy or 2) integrate it to XBMC. Either way, I cant do it yet. But which do you users think was better?
jeremymc7
2008-03-02, 03:06
Okay I'm back. Yeh, It doesn't have it yet, but I promise there will be some sort of config coming. Dont really know how to do it easily but I'll look for it. There are two ways to make this progg awesome: 1) Make it like RemoteBuddy or 2) integrate it to XBMC. Either way, I cant do it yet. But which do you users think was better?
Any update on getting a config for the PS3 remote?
Working on it, trying to get pushed down buttons work but I cant really think get it to work as it should.. I think I'll skip that feature for now and try to do configs first. I'll look what I can do tonight or tomorrow.
ps. Could some obj-c guru tell me why doesnt push button down but only taps it, maybe it's because that kCGSessionEventTap? I could'nt find anything better for that..
event = CGEventCreateKeyboardEvent(NULL, key, TRUE);
CGEventPost(kCGSessionEventTap, event);
iordonez
2008-03-03, 04:39
Okay I'm back. Yeh, It doesn't have it yet, but I promise there will be some sort of config coming. Dont really know how to do it easily but I'll look for it. There are two ways to make this progg awesome: 1) Make it like RemoteBuddy or 2) integrate it to XBMC. Either way, I cant do it yet. But which do you users think was better?
Just a chime in here... The answer I feels fits best is both.
1) A a stand alone app this could have the possibility to integrate with so many other programs, such as frontrow, Powerpoint, etc.
2) Having to open a program to get remote support working in XBMC is a hassle and very un-mac like. Integration with XBMC and some sort of BT pairing option inside it's settings would make for the ultimate simplicity.
Okay, here it is. new version of ps3remote. This time with basic configurability. Config file can be found from ~/Library/Preferences/com.yourcompany.ps3remote.plist , lauch new version once and it will create necessary data there and then you are good to go with configurations.. Only drawback is you have to use CGkeyCode numbers found in example here http://developer.apple.com/documentation/mac/Text/Text-33.html. There are some tools for this too but I haven't look for them too much.
Release 0.2: http://tv.aninga.net/ps3remote0.2.app.zip
Next version will come with something daemon-like OR "sticky" buttons OR something else nice. Better configurationpanel would be nice too.. Good luck and see you later!
jeremymc7
2008-03-12, 09:39
Okay, here it is. new version of ps3remote. This time with basic configurability. Config file can be found from ~/Library/Preferences/com.yourcompany.ps3remote.plist , lauch new version once and it will create necessary data there and then you are good to go with configurations.. Only drawback is you have to use CGkeyCode numbers found in example here http://developer.apple.com/documentation/mac/Text/Text-33.html. There are some tools for this too but I haven't look for them too much.
Release 0.2: http://tv.aninga.net/ps3remote0.2.app.zip
Next version will come with something daemon-like OR "sticky" buttons OR something else nice. Better configurationpanel would be nice too.. Good luck and see you later!
I've having an issue with key repeating. Then I press any button on the PS3 remote it keeps repeating until I press another button, and then that button keeps repeating.
Any help ?
Hmm.. Sounds funny.. I just tested the version I have uploaded and it seems to work properly atleast for me.. This could be possible and I think it would be good if it were (I could do the repeating key on hold easily with this).. But could you give some information about your hardware and software, I'll try to look why this differs to my setup..
jeremymc7
2008-03-12, 16:54
Hmm.. Sounds funny.. I just tested the version I have uploaded and it seems to work properly atleast for me.. This could be possible and I think it would be good if it were (I could do the repeating key on hold easily with this).. But could you give some information about your hardware and software, I'll try to look why this differs to my setup..
I tried re-lauching the app, reconnecting the remote, connecting while holding down the buttons, connecting while tapping the buttons, restarting, and I still get the repeating. The display window for the app shows the key in repeat until I press another key and then it shows that key. Can't seem to get it too stop repeating the last used key, so the remote is just sitting here. =( H/W & S/W config is bellow. Thanks for your help.
MAC Hardware / Software
Apple Mac Mini
2 GHz Core 2 Duo
4GB Ram (3.3GB usable)
OSX 10.5.2
XBMC For Mac OSX v0.1.6
Does the first release work? If yes, I'll make another release for you, which definitely "unpushes" the button like first one making push will be just tap. I removed that code as I thought it would be obsolete. In my comp it just taps the button, doesn't hold down. Dont really know why I can't reproduce this. Do you have any other bluetooth devices(it shouldn't matter but asking anyway)?
Okay, try this one, If first release works for you, this should work too..
Release 0.2.1: http://tv.aninga.net/ps3remote0.2.1.app.zip
jeremymc7
2008-03-13, 00:07
Okay, try this one, If first release works for you, this should work too..
Release 0.2.1: http://tv.aninga.net/ps3remote0.2.1.app.zip
I never tried the 0.1.0 version so I can't say if it worked. This 0.2.1 version does indeed work for me. I don't get any of the key repeat problems I did with the 0.2.0 version.
It does seem that there may be some mislabels between the remote app and the actual button presses. I don't know if this is just cosmetic as of it. IE
Remote Label Remote App Label
Arrow Left KEY_LEFT
Arrow Up KEY_UP
Arrow Right KEY_DOWN
Arrow Down KEY_RIGHT
Thanks so much. Now I can start drooling for the next version with full and easier config.
;-)
Thanks again !
jeremymc7
2008-03-13, 00:19
Okay, here it is. new version of ps3remote. This time with basic configurability. Config file can be found from ~/Library/Preferences/com.yourcompany.ps3remote.plist , lauch new version once and it will create necessary data there and then you are good to go with configurations.
I can't find the com.yourcompany.ps3remote.plist config file. There is nothing named "com.yourcompany.ps3remote.plist" in either the ~/Library/Preferences/ path or when going through ~users/(computer name)/Library/Preferences/ path.
Any help with this one now? Maybe related to the repeating issue?
;-)
Yeh. I can reproduce this.. Seems it haven't work from the beginning, dont really know why.. It really worked for me couple weeks ago!. It doesn't seem to write file althought I'm syncin defaults as it should be done.. Need to look for this more, but dont have time this weekend.
Also, I have decided that next major version will be implementing this to XBMC straight if no one has any arguments to change my mind. Also if anyone is using this and dont like idea of integrating to XBMC or likes more configurability and so on, I'd suggest you to look for RemoteBuddy(no, it's not my software so not advertising :D).
_tv_ with regard to integrating with XBMC keep the following in mind (I just copied and pasted my comment from elan's blog):
@elan
“In terms of Bluetooth, d4rk is working on implementing a UDP client-server protocol, and planning on having an external server running which communicates input events to a running XBMC.”
It’s actually an internal server that receives the event messages. Also the messages aren’t restricted to purely input events. For example, there is also a notification event that pops up a little window on screen with a message. What’s external would be the various clients that communicate with the server.
“I have no issue with people doing the same for now and internally supporting OS X Bluetooth HIDs.”
The whole point of the new protocol is to abstract out device specific code and at the same time not compromise on speed. At this point, I wouldn’t encourage anyone to write any device specific code that ties in tighlty with XBMC, Bluetooth or otherwise, since it won’t get accepted. Ideally write your code so that the device specific portions are modular so that it can be reused using the new protocol.
The protocol is close to completion at this stage and basic commands are functional. I already have a few working examples. I’ll be posting examples, documentation etc on the forums once it’s more usable.
As mentioned, the intent of the new protocol is to decouple device specific code from XBMC code. This has quite a few advantages. Firstly, XBMC will not need to be recompiled for every new device that needs to be supported. Secondly, users/developers can write their own input "drivers" in their language of choice (which can eventually be packaged along with the official XBMC distributions once that gets going).
The new protocol will support both analog and digital button events as well as mouse events, which can in turn be used by devices that have accelerometers, support motion sensing etc. Since it's a network based protocol, devices that aren't hooked up to the computer that XBMC is running on can be used as well (in fact the computers could be running different OSes).
The new protocol will be supported in the Linux, Mac and Win32 builds and possibly even the XBox build.
Anyway, just keep these things in mind during your development.
PS: Is your program open source?
d4rk, yes. I have heard about it and really going to "port" this to it when it's included in builds. And yes, this will be open source when I get my code to look like I want someone to read :;): And this app, it's not even worth really open sourceing atm, so bad example for everyone, as it is my first apps. Do you have any time when to expect input abstraction to finish? Which is closer, week or month? I'm really looking forward to it. Thanks for the nice job.
I'm hoping to finish the basic implementation for Linux by tomorrow or the day ofter, and hopefully it will work on OSX with no changes. A safe estimate is 1 week, if everything is smooth (maybe 2 weeks including some documentation and some simple examples in Python).
Oh sweet! I thought it would be far away in the future. Then I'll just wait for that to come alive before doing anything.
Nick8888
2008-03-15, 17:05
d4rk has added basic support for this in linux branch.
Ive been wondering what the event server was but that was a good explanation above.
Wow, this is great!
I have no experience with cocoa, but I will look at it as soon as the code becomes public.
btw; does the Sixaxis work with the same events?
sogorman
2008-03-21, 18:27
First off, thanks for all the work you all are doing intergrating the PS3 remote into xbmc. This is a great, cheep, and easy remote control solution.
Do you think it would be possible in future releases for the software to stay paired with a remote even after the "ps3remote" app is closed?
jeremymc7
2008-03-21, 23:23
Do you think it would be possible in future releases for the software to stay paired with a remote even after the "ps3remote" app is closed?
I think once they implement the modular coding for OSXBMC that issue will be resolved. If I understand correctly each remote will have it's own module similar to a plug in that can be part of OSXBMC directly but still be independent so that new builds are not effected. It'll be a nice clean solution. This will allow you to just launch OSXBMC and the desired remote will just work without having to launch (or pair) anything else.
What I'm really waiting for would be config options to map any OSXBMC command to any button on the remote.
=)
Do you think it would be possible in future releases for the software to stay paired with a remote even after the "ps3remote" app is closed?
It is possible and I have it working under Linux, no sample code has been committed yet though. It's just a simple matter of the program talking to the remote to also act as a Bluetooth HID server, so that it can "wake up" when a button on the remote is pressed for the first time. This of course is after the initial pairing. The only drawback is that this process needs root privileges.
BTW, _tv_, the event server is now part XBMC, there are some examples in C++ and Python under tools/EventClients (http://xbmc.svn.sourceforge.net/viewvc/xbmc/branches/linuxport/XBMC/tools/EventClients/). There's also a simple example of using the PS3 remote (a script originally written by brandonj (http://xbmc.org/forum/showthread.php?t=28765)). Feel free to take a look if you want.
I have taken look for it and it looks good but I'm pretty busy now with other things. I might make the program with python+lightBlue because no bluez under os x. Or just some Mac OS X prefpane with alltime backgroundrunning process so you could launch xbmc with ps3's playstation button or something. But I'll really look for this next week when I hopefully have more time. Thanks for your great work!
I just tested new event servers ps3_remote.py and it works flawlessly after I got lightblue installed to correct python. Seems that my proggram is now officially obsoleted :D. Nice work d4rk and others with that event server! Everyone who was intrested in my ps3remote, I suggest you to install lightblue (readme, but use sudo /usr/bin/python setup.py install) and try the python script found in d4rk's links posted before.
I just tested new event servers ps3_remote.py and it works flawlessly after I got lightblue installed to correct python. Seems that my proggram is now officially obsoleted :D. Nice work d4rk and others with that event server! Everyone who was intrested in my ps3remote, I suggest you to install lightblue (readme, but use sudo /usr/bin/python setup.py install) and try the python script found in d4rk's links posted before.
Does the python script go in the scripts folder?
I successfully installed Lightblue using sudo /usr/bin/python setup.py install. Downloaded the ps3_remote.py file and placed it in the scripts folder of OSXBMC. Successfully paired the PS3 remote with the Mac, but I still can't control OSXBMC with the PS3 remote.
Where did I do wrong?
iordonez
2008-03-27, 01:42
I successfully installed Lightblue using sudo /usr/bin/python setup.py install. Downloaded the ps3_remote.py file and placed it in the scripts folder of OSXBMC. Successfully paired the PS3 remote with the Mac, but I still can't control OSXBMC with the PS3 remote.
Where did I do wrong?
The current XBMC release doesn't yet support python... don't bother trying to use python scripts until it does. Watch www.osxbmc.com for more news.
Guess I got a little ahead of myself. Thanks for the info.
The EventClient python script is completely seperated from the XBMC python support thus it doesn't matter if XBMC supports it or not.
The ps3 python scripts talk over UDP.
I'm using linux so I can't really help you on why the script doesn't work however :)
I successfully installed Lightblue using sudo /usr/bin/python setup.py install. Downloaded the ps3_remote.py file and placed it in the scripts folder of OSXBMC. Successfully paired the PS3 remote with the Mac, but I still can't control OSXBMC with the PS3 remote.
Where did I do wrong?
It's not XBMC python script, just normal os-level python script. Run it with ./ps3_remote.py localhost 9777. Nothing more complex. It doesnt matter where it is as long the files that require are with it (take the whole Event Clients dir)
jeremymc7
2008-03-27, 19:19
I'm having a hard time getting it to work myself. When someone gets this figured out could you please post a set by step to get it working. Thanks so much.
bmfrosty
2008-03-27, 21:07
I'm having a hard time getting it to work myself. When someone gets this figured out could you please post a set by step to get it working. Thanks so much.
A HOWTO would be very nice.
sogorman
2008-03-28, 03:50
I Second that.
Thanks!!!
Basically, this is not ready for end users because need of installing dependencies, but here it is nutshell:
1. install lightBlue with sudo /usr/bin/python setup.py install
2. Download Event Clients folder
3. Launch XBMC and run ps3_remote.py from terminal
4. press start+enter
5. Done
REMOTE BUDDY! I think you guys should just get remotebuddy and then this all works great. I love that application infact it is one of the best softwares I know. Anyway check it out.
Could you stop fooling around? Everyone here knows already it but that's not the point. We want native way to interact with XBMC trough bluetooth and so on. RemoteBuddy is cool but we need something else for this. But yes, I would suggest everyone who doesn't want to run scripts use remote buddy. I might start working with some Preference Panel -type listener which is always present in the background, pairs automatically with PS3-remote and sends buttons to xbmc through udp.. Also this could launch xbmc with ps3-button if it's not already on and so on. I'm very busy with studies atm so dont wait for this, use python scripts or Remote Buddy.
bmfrosty
2008-04-01, 09:50
I'm working on a PS3 remote specific keymap. I'll hopefully have something ready within a week or so.
bmfrosty
2008-04-01, 09:59
If lightblue gets added to the distribution, it could probably be added as a tickbox in the settings somewhere to activate the remote. To cause the remote to launch xbmc would have to be a pref pane or something, but I'm thinking that xbmc could be set up to hide or minimize instead of quit, and the remote being activated could be used to restore the window and fullscreen. Of course that's beyond me. I think I may have to buy a python book.
Not really prefpane but it would work too, any XBMChelper or something running in the back could listen bt connections (or why not, even ir connections later, or anything else) and try to get udp-connection on, if not it would launch (for now, hideing and showing XBMC is not really option because huge cpu-usage on idle but it would be great option). Also it could be possible to make python script for XBMC to configure that all backgroundrunning XBMChelper.. This is my intentions but I'll see what I can do, but dont wait for anything :)
sogorman
2008-04-28, 05:35
Any update on the PS3 remote front? My biggest problem is that for whatever reason new batteries are completely drained after 2 days of use.
Thanks!
Not more than this: the python version of PS3 eventclient made to app. I'm not sure if this works without external libs but it should (lightblue is included in bundle). I haven't done the script, I just made app bundle from it.
Usage:
Launch XBMC and launch PS3_remote.app
press start+enter
it should work
I haven't had time to work on real implementation, too busy with other things but I've been using this for some time now and it should work.. Have fun!
http://tv.aninga.net/ps3_remote.app.zip
bmfrosty
2008-04-30, 22:55
I've made some updates to the scripts that improves the way the keys map - specifically I've made the mappings a combination of mce and xbox remotes.
Does anyone know if it's possible to get xbmc to launch the script, or does it still have to be done from outside of xbmc?
One last thing that I need to do is set up some type of keepalive so that we don't get that 1 minute timeout and the need to do a reconnect. I also want to set it up so it saves the host and port settings and the remote association.
You could make another thread in python that pings the server every xx seconds. J2ME Client does this if you need some inspiration.
xOrphenochx
2008-07-28, 02:44
I found this thread a couple of months ago and gave it a try. With the latest one, after awhile it seems to start taking up 100% CPU. I didn't really care then because I primarily ran XBMC on my mini I use for everything, but now I have one just deticated for playing video. Any update would be appreciated.
Could you provide more details regarding the problem, things like what OS version, how long is "after a while" etc and post a ticket at http://xbmc.org/trac.
xOrphenochx
2008-07-30, 01:21
Is there anyway I can get a log out of this application. Funny thing is it runs on the old mini, but not the one I just got, the older 2.1 version that wasn't done from the eventsclient still works. I'd be glad to post any information I get, this is a really lovely program.
Is your Mini running OS X or Linux? Version 2.1? What program are you referring to?
xOrphenochx
2008-07-30, 13:54
OS X, I was refering to http://tv.aninga.net/ps3remote0.2.1.app.zip
In that case, _tv_ will be able to answer your question better as he is the author of the application.
Morph1us
2008-08-08, 19:38
Just bought a sony BT remote and this little app works fine...
Thanks m8 great job.
I want to add a few more buttons to use this to get aroud my pc aswell as XBMC....
Where do i start guy's any idea's...
Morph1us
2008-08-08, 19:42
Sorry I ment to add its a mac mini 1,83GHz core 2 duo, 1 GB sdram running mac os x 10.5.4
:)
xboxgame
2008-08-16, 22:10
is there any way to auto connect without using mouse
Morph1us
2008-09-24, 23:13
Hi guys....
Can someone please let me know if I am able to use this remote for all functions on xbmc.
At the mo I am using it with ps3_remote.app, it works but the only buttons that the apple remote uses. ie no volume or display buttons.
Its on a mini mac with the new xbmc beta 1, using built in bluetooth.
Do i need to edit the keymap?
A step by step would be cool but more important to me is am i waisting my time with this remote for full control...
Should i just get a different remote?
Cheers Morph
I just tested it and it works, although I didn't notice any interface in ps3_remote.app. Maybe that's by design.
Anyhow what I did:
Launch ps3_remote.app
Launch XBMC
Hold down start+enter for about 5-10 seconds until you hear a beep
Release and use the navigation pad on the remote and see if XBMC responds. If it doesn't repeat the last step, until it works.
EDIT: Just to reconfirm, you downloaded this version: http://tv.aninga.net/ps3remote0.2.1.app.zip ?
Should look something like this once connected:
44
Another option is to use Remote Buddy which also supports this remote.
Morph1us
2008-09-25, 20:27
Thanks Dark just trying it now...
I have to put the other folder in this pack into the mac's application files right?
Morph1us
2008-09-25, 20:38
It works to navigate but there is only 9 buttons you can use?
Can i get the other buttons to control the volume and a few other bits like on the old xbox remote?
Cheers
The current issue with using the PS3 Remote on the Mac, is that it requires repairing every time it needs to be used (unless it is never disconnected in which case the battery will get drained).
If you're tech savvy enough and have a Linux machine with Bluetooth on your network, you can use the ps3d (http://xbmc.org/trac/browser/branches/linuxport/XBMC/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py) event client to control your Mac. Under Linux, you only need to pair it once and after that, it will auto connect as soon as you press any button on the remote. This also works quite well with the PS3 Sixaxis Controller.
Can i get the other buttons to control the volume and a few other bits like on the old xbox remote?
Cheers
I don't think the keymap is configurable from the looks of it. You will need to contact the author of the application if you want to make any changes to it, since I don't believe it is open source.
Again, if you're tech savvy enough and have enough knowledge about installing Python modules, you can try the command line ps3 remote event client (http://xbmc.org/trac/browser/branches/linuxport/XBMC/tools/EventClients/Clients/PS3 BD Remote), which allows you to customize the keymap. There is however no user level documentation for this program, but it does work :)
Morph1us
2008-09-25, 21:41
Thanks for the info Dark you know your stuff.
I have no idea about linux i am just a old school XBMC user from the xbox 1, upgraded to mac mini for HD video....
Wish i new a bit about python and coding to help.... :(
It just seemed strange to me that loads of other ppl were not having the same probs as me with controling the mac mini.
How does everyone else control XBMC?
If there is a good remote that does all i want i will buy it, i though the ps3 remote would have been great as it is BT so no line of site issues.
Has the ps3remote app been dropped now?
Cheers
Gamester17
2008-09-26, 00:17
How does everyone else control XBMC?Apple Remote, (or a universal remote which supports mimicking the Apple Remote), compatible with Apple products introduced in 2005 or later that have a built-in Infrared (IR) receiver.
http://store.apple.com/us/product/MA128G/B?mco=MTIxODk3Mw
Morph1us
2008-09-26, 22:01
Thanks Gamester
I have that remote i got it with the mini mac but its not able to do all the things the old xbox remote could...
There must be a beter remote than that one?
Cheers
Wow this app is amazing and it's free(Atleast now I don't have to pay 20 Euro and be forced to use Plex because Remote Buddy does only support Plex not Xbmc for mac)
Tough I want to assign more buttons but no plist is being created :(