wild_oscar
July 30th, 2008, 01:33 AM
The Ubuntu guide for having a PS3 Bluetooth remote controler working on your computer
Motivation:
To have a remote controller to control most of the multimedia functions in Xine, Amarok and the likes on my Ubuntu machine
Prerequisites:
- Compilation environment (TODO - don't recall which packages are necessary)
- Browser witg http://ant.starikov.googlepages.com/linuxdriverforsonybdremote2 page opened
- Package bluez-utils
- Package lirc
- A PS3 Bluetooth remote controller (DUH!)
Ubuntu version tested:
Ubuntu 8.10 HardyGuide
Part I - Installation
1) The first part of the process is pretty well described in Antst's webpage:
First you need to get sources for BT BD Remote Daemon from downloads page. (http://ant.starikov.googlepages.com/downloads)
Then you need to compile it. Just type "make" in directory with source files. You'll get binary called "bdremoted". You can copy it whenever it suits you. For example to /usr/local/sbin.
2) Find your remote's address. Also described on his webpage:
Now you can type in root console "hcitool scan" and then press simultaneously "Start" and "Enter" buttons on remote for about 5 seconds.
You should see something like:
hostname # hcitool scan
Scanning ...
00:19:C1:5A:F1:3F BD Remote Control
hostname #
00:19:C1:5A:F1:3F - is the address of your remote, which you can use for configuration
3) The next step is to make the connection between your remote and your computer. this is done by starting the remote's "damon" (the driver you've just installed) and by linking it to LIRC, the well known remote controle daemon for Linux. Lirc has a special option so it can listen to communications on a specific (computer) port, and this is how it'll all be glued.
This is also where I found Ubuntu to need a special treatment. It seems that the bluetooth daemon can't be running when the bdremote and lircd commands are issued, so what you'll want is something like:
sudo /etc/init.d/bluetooth stop
sudo /usr/bin/bdremoted -p 8888 -a 00:19:C1:5A:F1:3F
sudo lircd -H null --connect 127.0.0.1:8888
sudo /etc/init.d/bluetooth start
Replacing 00:19:C1:5A:F1:3F with the address you got from the previous step.
4) If all went well, the connection should have been started by now. You should run "irw", which is a little program that displays every button press you make on your remote control.
So go ahead, start irw. Press some buttons on your remote and you should see some lines on your shell like:
0004 00 num5 SonyBDRemote
0004 01 num5 SonyBDRemote
0005 00 num6 SonyBDRemote
0034 00 scanfwd SonyBDRemote
You have finished installing everything. If all went well, you should have your environment correctly configured. For troubleshooting, consult Part IV of the guide.
Part II - Configuration
Now that you have your environment set up, it's time to make your remote do more than just display stuff on your shell! This is done by configuring the .lircrc file that should be located on your $HOME folder (~/.lircrc).
Your reference should be:
http://www.lirc.org/html/configure.html#lircrc_format
http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/ (from "Application and Lirc support" onwards).
.lircrc is the configuration file that tells Lirc what to do when you press a button on a remote. As the second reference page says, you should learn that there are basically three types of applications:
Those which could and actually have been built with LIRC support. These act as LIRC clients when there is a running LIRC daemon.
Those which do support LIRC, but have not been compiled with the LIRC support enabled.
Those which do not support LIRC at all.
Lets forget about number 2 (you would have to recompile them with LIRC support enabled). We are reduced to "built in LIRC support" and "no LIRC support". For the latest, we can control them using the irexec program.
First things first, lets have a look at a basic configuration entry in .lircrc:
begin
remote = SonyBDRemote
button = play
prog = xine
config = Play
end
Almost every option is pretty self-explanatory. The "remote", well, the remote you'll use. You'll want SonyBDRemote here.
"button" is the remote button you press.
"prog" is the program you want to control
"config" is what you want that button to do
Recall when you ran "irw", you got lines like:
0005 00 num6 SonyBDRemote
The program provides the name of the remote you'll put on .lircrc and the name of the button you press (in the example, num6). When you're writing your configuration file, you may want to check in irw for the name of a particular button.
In the .lircrc entry example, I wanted to control the Xine program, which has built-in LIRC support. Therefore, LIRC knows what the "Play" config is.
For a better reference of the available options in Xine, check http://xinehq.de/index.php/readme#2.4.4.
TODO - Next, I'll show you how to work with irexec. In the meantime, check the reference pages I showed you.
Part III - Making it pretty
TODO - I'm developing a simple init.d script so that the remote works as soon as you start your computer.
Part IV - Troubleshooting
One minor (and unconfirmed) issue I ran into was that my computer didn't shutdown when the programs were active. To fix this, I added a shutdown script (run when the computer is shutting down !!), which I'll update on Part III of the guide.TODO - tell me what doesn't work.
Motivation:
To have a remote controller to control most of the multimedia functions in Xine, Amarok and the likes on my Ubuntu machine
Prerequisites:
- Compilation environment (TODO - don't recall which packages are necessary)
- Browser witg http://ant.starikov.googlepages.com/linuxdriverforsonybdremote2 page opened
- Package bluez-utils
- Package lirc
- A PS3 Bluetooth remote controller (DUH!)
Ubuntu version tested:
Ubuntu 8.10 HardyGuide
Part I - Installation
1) The first part of the process is pretty well described in Antst's webpage:
First you need to get sources for BT BD Remote Daemon from downloads page. (http://ant.starikov.googlepages.com/downloads)
Then you need to compile it. Just type "make" in directory with source files. You'll get binary called "bdremoted". You can copy it whenever it suits you. For example to /usr/local/sbin.
2) Find your remote's address. Also described on his webpage:
Now you can type in root console "hcitool scan" and then press simultaneously "Start" and "Enter" buttons on remote for about 5 seconds.
You should see something like:
hostname # hcitool scan
Scanning ...
00:19:C1:5A:F1:3F BD Remote Control
hostname #
00:19:C1:5A:F1:3F - is the address of your remote, which you can use for configuration
3) The next step is to make the connection between your remote and your computer. this is done by starting the remote's "damon" (the driver you've just installed) and by linking it to LIRC, the well known remote controle daemon for Linux. Lirc has a special option so it can listen to communications on a specific (computer) port, and this is how it'll all be glued.
This is also where I found Ubuntu to need a special treatment. It seems that the bluetooth daemon can't be running when the bdremote and lircd commands are issued, so what you'll want is something like:
sudo /etc/init.d/bluetooth stop
sudo /usr/bin/bdremoted -p 8888 -a 00:19:C1:5A:F1:3F
sudo lircd -H null --connect 127.0.0.1:8888
sudo /etc/init.d/bluetooth start
Replacing 00:19:C1:5A:F1:3F with the address you got from the previous step.
4) If all went well, the connection should have been started by now. You should run "irw", which is a little program that displays every button press you make on your remote control.
So go ahead, start irw. Press some buttons on your remote and you should see some lines on your shell like:
0004 00 num5 SonyBDRemote
0004 01 num5 SonyBDRemote
0005 00 num6 SonyBDRemote
0034 00 scanfwd SonyBDRemote
You have finished installing everything. If all went well, you should have your environment correctly configured. For troubleshooting, consult Part IV of the guide.
Part II - Configuration
Now that you have your environment set up, it's time to make your remote do more than just display stuff on your shell! This is done by configuring the .lircrc file that should be located on your $HOME folder (~/.lircrc).
Your reference should be:
http://www.lirc.org/html/configure.html#lircrc_format
http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/ (from "Application and Lirc support" onwards).
.lircrc is the configuration file that tells Lirc what to do when you press a button on a remote. As the second reference page says, you should learn that there are basically three types of applications:
Those which could and actually have been built with LIRC support. These act as LIRC clients when there is a running LIRC daemon.
Those which do support LIRC, but have not been compiled with the LIRC support enabled.
Those which do not support LIRC at all.
Lets forget about number 2 (you would have to recompile them with LIRC support enabled). We are reduced to "built in LIRC support" and "no LIRC support". For the latest, we can control them using the irexec program.
First things first, lets have a look at a basic configuration entry in .lircrc:
begin
remote = SonyBDRemote
button = play
prog = xine
config = Play
end
Almost every option is pretty self-explanatory. The "remote", well, the remote you'll use. You'll want SonyBDRemote here.
"button" is the remote button you press.
"prog" is the program you want to control
"config" is what you want that button to do
Recall when you ran "irw", you got lines like:
0005 00 num6 SonyBDRemote
The program provides the name of the remote you'll put on .lircrc and the name of the button you press (in the example, num6). When you're writing your configuration file, you may want to check in irw for the name of a particular button.
In the .lircrc entry example, I wanted to control the Xine program, which has built-in LIRC support. Therefore, LIRC knows what the "Play" config is.
For a better reference of the available options in Xine, check http://xinehq.de/index.php/readme#2.4.4.
TODO - Next, I'll show you how to work with irexec. In the meantime, check the reference pages I showed you.
Part III - Making it pretty
TODO - I'm developing a simple init.d script so that the remote works as soon as you start your computer.
Part IV - Troubleshooting
One minor (and unconfirmed) issue I ran into was that my computer didn't shutdown when the programs were active. To fix this, I added a shutdown script (run when the computer is shutting down !!), which I'll update on Part III of the guide.TODO - tell me what doesn't work.