sudo dpkg-reconfigure lirc
Showing posts with label IR Remote. Show all posts
Showing posts with label IR Remote. Show all posts
Monday, April 20, 2009
Saturday, April 18, 2009
Howto setup Remote for Ubuntu 8.04 XBMC with MS Remote
It is pretty straight forward to setup basic functionality but finding information is a nightmare.
The biggest problem was to get the shutdown to work with auto started irexec.
1) Remote control XBMC and other applications.
2) Start stop & kill XBMC with remote
3) Shutdown computer
4) Autostart irexec
Basic setup
The first step is to install and configure LIRC.
sudo apt-get install -y lirc
Select windows media center remotes (New version)
IR Transmitter: Select “none”
run irw in terminal and press any button on the remote, the name of device and button should show on screen.
This is pretty much it if you have a standard remote. I have had no problem with MS MCE Remote. You should now be able to control XBMC.
To control other applications you have to create your own button => function mappings.
This is stored in the .lircrc file in ~/.
This is best done by using the lirc generator from the mythbuntu team.
sudo apt-get -y install mythbuntu-lirc-generator
run
mythbuntu-lircrc-generator
and you will get the lircrc files for the most common applications.
Totem is the standard player in Ubuntu 8.04, it is supported by this setup but first you need to enable the remote plugin from within the player.
Advanced setup
Download files & scripts here.
The biggest problem was to get the shutdown to work with auto started irexec.
1) Remote control XBMC and other applications.
2) Start stop & kill XBMC with remote
3) Shutdown computer
4) Autostart irexec
Basic setup
The first step is to install and configure LIRC.
sudo apt-get install -y lirc
Select windows media center remotes (New version)
IR Transmitter: Select “none”
run irw in terminal and press any button on the remote, the name of device and button should show on screen.
This is pretty much it if you have a standard remote. I have had no problem with MS MCE Remote. You should now be able to control XBMC.
To control other applications you have to create your own button => function mappings.
This is stored in the .lircrc file in ~/.
This is best done by using the lirc generator from the mythbuntu team.
sudo apt-get -y install mythbuntu-lirc-generator
run
mythbuntu-lircrc-generator
and you will get the lircrc files for the most common applications.
Totem is the standard player in Ubuntu 8.04, it is supported by this setup but first you need to enable the remote plugin from within the player.
Advanced setup
Download files & scripts here.
Setup start stop & shutdown
Most of this is from http://xbmc.org/forum/showthread.php?t=30230. Some changes was necessary though.
We need irexec to do this and for good measure we setup irxevent as well. The latter is used to send keyboard commands. (ctrl-s etc)
install irxevent
sudo apt-get -y install lirc-x
Most of this is from http://xbmc.org/forum/showthread.php?t=30230. Some changes was necessary though.
We need irexec to do this and for good measure we setup irxevent as well. The latter is used to send keyboard commands. (ctrl-s etc)
install irxevent
sudo apt-get -y install lirc-x
create file named irexec in ~/.lircrc
# Start XBMC
begin
prog = irexec
button = Home
config = ~/scripts/startXBMC.sh &
end
# Kill XBMC
begin
prog = irexec
button = Red
config = ~/scripts/killXBMC.sh &
end
#shutdown
begin
prog = irexec
button = Power
config = ~/scripts/shutdown.sh &
end
The '&' is necessary at least in my setup, otherwise the startXBMC will loop in the background and when I exit XBMC it is restarted several times.
I found the solution here http://xbmc.org/forum/showthread.php?t=30230.
Create an empty file named irxevent in ~/.lircrc
It will contain the mappings for irxevent. I am not using it for the moment. I wanted to send ctrl-alt-Delete, but could not get it to work.
Add
include ~/.lirc/irexec
include ~/.lirc/irxevent
to the ~.lircrc file
The next step is to create the script files.
Pick them up at http://xbmc.org/forum/showthread.php?t=30230.
Worked fine for me, I replaced /home/youruser/ with ~/ when possible. I think the remaining hardcoded usernames can be removed by following the comments further down in the thread (pidof?). I guess killall would also do the trick.
To autostart the irexec (and irxevent) add
/home/username/scripts/startIRexec.sh
to system/preferences/sessions. NB: ~/scripts does not work here.
First test to start manually from terminal
~/scripts/startIRexec.sh
Run it twice and you should see that the script kills the old processes before the new is started.
ps -C irexec
should show one irexec process after two runs.
Now you should be able to start and kill XBMC. Kill should only be used when XMBC cannot be closed down the normal way I think.
Please note that I have mapped Power button to shutdown, when shutdown is finally working it will make it impossible to use the Power button to exit XBMC without shutting down the computer. The mapping can be changed in the irxec file. I think it can also be fixed by using mode in the lirc files to separate the applications.
Now to the shutdown..
I use
sudo /sbin/shutdown -h now
in the shutdown script. We can't have the script asking for password and this is fixed by editing the /etc/sudoers file. It is edited with this command:
sudo visudo.
First make backup
cp /etc/sudoers /etc/sudoers.org
This is where we hit the wall. The correct way(?) to do this is to add the line
youruser ALL=NOPASSWD: /sbin/shutdown
at the end of the sudoers file.
It worksfine if you start irexec manually from the terminal.
But after reboot and autostart shutdown does not work, everything else works fine.
I finally found a solution/ workaround.
add
%admin ALL=NOPASSWD: /sbin/shutdown
I am aware this is not a good setup, but it will have to do for a while. Can anyone help?
If you find this guide helpful let me know. I would be willing to re-write it with some quality if anyone needs it.
Add:
# Start XBMC
begin
prog = irexec
button = Home
config = ~/scripts/startXBMC.sh &
end
# Kill XBMC
begin
prog = irexec
button = Red
config = ~/scripts/killXBMC.sh &
end
#shutdown
begin
prog = irexec
button = Power
config = ~/scripts/shutdown.sh &
end
The '&' is necessary at least in my setup, otherwise the startXBMC will loop in the background and when I exit XBMC it is restarted several times.
I found the solution here http://xbmc.org/forum/showthread.php?t=30230.
Create an empty file named irxevent in ~/.lircrc
It will contain the mappings for irxevent. I am not using it for the moment. I wanted to send ctrl-alt-Delete, but could not get it to work.
Add
include ~/.lirc/irexec
include ~/.lirc/irxevent
to the ~.lircrc file
echo "include ~/.lirc/irexec" >> ~/.lircrc
echo "include ~/.lirc/irxevent" >> ~/.lircrc
The next step is to create the script files.
Pick them up at http://xbmc.org/forum/showthread.php?t=30230.
Worked fine for me, I replaced /home/youruser/ with ~/ when possible. I think the remaining hardcoded usernames can be removed by following the comments further down in the thread (pidof?). I guess killall would also do the trick.
To autostart the irexec (and irxevent) add
/home/username/scripts/startIRexec.sh
to system/preferences/sessions. NB: ~/scripts does not work here.
First test to start manually from terminal
~/scripts/startIRexec.sh
Run it twice and you should see that the script kills the old processes before the new is started.
ps -C irexec
should show one irexec process after two runs.
Now you should be able to start and kill XBMC. Kill should only be used when XMBC cannot be closed down the normal way I think.
Please note that I have mapped Power button to shutdown, when shutdown is finally working it will make it impossible to use the Power button to exit XBMC without shutting down the computer. The mapping can be changed in the irxec file. I think it can also be fixed by using mode in the lirc files to separate the applications.
Now to the shutdown..
I use
sudo /sbin/shutdown -h now
in the shutdown script. We can't have the script asking for password and this is fixed by editing the /etc/sudoers file. It is edited with this command:
sudo visudo.
First make backup
cp /etc/sudoers /etc/sudoers.org
This is where we hit the wall. The correct way(?) to do this is to add the line
youruser ALL=NOPASSWD: /sbin/shutdown
at the end of the sudoers file.
It worksfine if you start irexec manually from the terminal.
But after reboot and autostart shutdown does not work, everything else works fine.
I finally found a solution/ workaround.
add
%admin ALL=NOPASSWD: /sbin/shutdown
I am aware this is not a good setup, but it will have to do for a while. Can anyone help?
If you find this guide helpful let me know. I would be willing to re-write it with some quality if anyone needs it.
Subscribe to:
Posts (Atom)