个人工具

“UbuntuHelp:Install Lirc Feisty”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:Install_Lirc_Feisty}}
 
{{Languages|UbuntuHelp:Install_Lirc_Feisty}}
 
[[Include(Install_Lirc_Header)]]
 
[[Include(Install_Lirc_Header)]]
 
 
 
== Lirc Installation & Maintenance ==
 
== Lirc Installation & Maintenance ==
 
Lirc can be used for IR and RF sending and receiving for many IR and RF remote controls and senders (blasters).
 
Lirc can be used for IR and RF sending and receiving for many IR and RF remote controls and senders (blasters).
 
 
As installed, the default Lirc init scripts are properly setup to handle a single device, but the driver build scripts can handle multiple devices.  If you are looking to set up a transmitter and a receiver, multiple transmitters, or multiple receivers, set up a Single Device first and verify functionality.
 
As installed, the default Lirc init scripts are properly setup to handle a single device, but the driver build scripts can handle multiple devices.  If you are looking to set up a transmitter and a receiver, multiple transmitters, or multiple receivers, set up a Single Device first and verify functionality.
 
 
Afterwords, continue on to the setting up multiple devices section.
 
Afterwords, continue on to the setting up multiple devices section.
 
 
=== Setting up a Single Device ===
 
=== Setting up a Single Device ===
 
Throughout this howto, the lirc_mceusb driver will be used for examples.  It's ''not'' necessary to build the lirc_mceusb driver if you are using a different receiver.  It is just for examples sake. Also, note that some devices, such as the USB-UIRT, have full support built-in to the kernel and the lirc package and thus the lirc-modules-source package is not needed. See Self:Lirc_USB-UIRT for more info.
 
Throughout this howto, the lirc_mceusb driver will be used for examples.  It's ''not'' necessary to build the lirc_mceusb driver if you are using a different receiver.  It is just for examples sake. Also, note that some devices, such as the USB-UIRT, have full support built-in to the kernel and the lirc package and thus the lirc-modules-source package is not needed. See Self:Lirc_USB-UIRT for more info.
 
 
==== Setup Repositories ====
 
==== Setup Repositories ====
 
In order to install lirc, you will need to have '''universe''',  and '''multiverse''' enabled.  See Ubuntu documentation for more information on [https://help.ubuntu.com/community/Repositories/CommandLine#head-e1a24b1b2037f68b5a95f54388582b58ea4c9bd0 enabling these repositories].
 
In order to install lirc, you will need to have '''universe''',  and '''multiverse''' enabled.  See Ubuntu documentation for more information on [https://help.ubuntu.com/community/Repositories/CommandLine#head-e1a24b1b2037f68b5a95f54388582b58ea4c9bd0 enabling these repositories].
 
 
==== Install Lirc ====
 
==== Install Lirc ====
 
You will only need to install lirc once, however, ''the kernel modules will need to be rebuilt after every kernel update''.
 
You will only need to install lirc once, however, ''the kernel modules will need to be rebuilt after every kernel update''.
第22行: 第15行:
 
$ sudo apt-get install lirc lirc-modules-source module-assistant
 
$ sudo apt-get install lirc lirc-modules-source module-assistant
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* '''NOTE:''' Some i2c remotes are supported directly by the kernel.  If you are using a remote that would have used the i2c driver, check out the Managed I2C devices link [https://help.ubuntu.com/community/Install_Lirc_Feisty#head-661b91158a667cd25342be5b8b85c16ecc8491b3 below] to use this instead.
 
* '''NOTE:''' Some i2c remotes are supported directly by the kernel.  If you are using a remote that would have used the i2c driver, check out the Managed I2C devices link [https://help.ubuntu.com/community/Install_Lirc_Feisty#head-661b91158a667cd25342be5b8b85c16ecc8491b3 below] to use this instead.
 
 
==== Configure lirc-modules-source ====
 
==== Configure lirc-modules-source ====
 
During the configuration of lirc-modules-source, you will choose the type of lirc device you are setting up.
 
During the configuration of lirc-modules-source, you will choose the type of lirc device you are setting up.
第30行: 第21行:
 
$ sudo dpkg-reconfigure lirc-modules-source
 
$ sudo dpkg-reconfigure lirc-modules-source
 
</nowiki></pre>
 
</nowiki></pre>
 
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
 
|<|1> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=reconfigure1_1.png || You will be provided a screen with a lot of information.  Choose the okay button to move on.  
 
|<|1> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=reconfigure1_1.png || You will be provided a screen with a lot of information.  Choose the okay button to move on.  
第50行: 第40行:
 
|<|2> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=maintainer.png || You may be given an option to replace with a new version.  Be sure to choose to '''Install the package maintainer's version.'''  
 
|<|2> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=maintainer.png || You may be given an option to replace with a new version.  Be sure to choose to '''Install the package maintainer's version.'''  
 
|}
 
|}
 
 
===== Home-brew serial receiver =====
 
===== Home-brew serial receiver =====
 
 
For the '''home-brew serial receiver''' (Igor Cesko's variation) modify file /etc/lirc/lirc-modules-source.conf
 
For the '''home-brew serial receiver''' (Igor Cesko's variation) modify file /etc/lirc/lirc-modules-source.conf
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo nano /etc/lirc/lirc-modules-source.conf
 
$ sudo nano /etc/lirc/lirc-modules-source.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
and add ''-DLIRC_SERIAL_IGOR'' to line ''LIRC_SERIAL_CFLAGS'', it should look like this after modification:
 
and add ''-DLIRC_SERIAL_IGOR'' to line ''LIRC_SERIAL_CFLAGS'', it should look like this after modification:
 
<pre><nowiki>
 
<pre><nowiki>
 
LIRC_SERIAL_CFLAGS=" -DLIRC_SERIAL_SOFTCARRIER -DLIRC_SERIAL_IGOR"
 
LIRC_SERIAL_CFLAGS=" -DLIRC_SERIAL_SOFTCARRIER -DLIRC_SERIAL_IGOR"
 
</nowiki></pre>
 
</nowiki></pre>
 
 
If you want to play with additional lirc serial settings, take a look in ''config.h'' from lirc-x.x.x.tar.bz package.
 
If you want to play with additional lirc serial settings, take a look in ''config.h'' from lirc-x.x.x.tar.bz package.
 
 
 
==== Modify /etc/lirc/hardware.conf ====
 
==== Modify /etc/lirc/hardware.conf ====
 
Modify /etc/lirc/hardware.conf.
 
Modify /etc/lirc/hardware.conf.
第71行: 第55行:
 
$ sudo nano /etc/lirc/hardware.conf
 
$ sudo nano /etc/lirc/hardware.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
 
|<|5> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=hardware.png || Modify ''LOAD_MODULES=false'' to be '''LOAD_MODULES=true'''.  Also, add your module to the line that is MODULES="".  Your module is the name of the module you chose previously to build prefixed by '''lirc_''':  
 
|<|5> https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=hardware.png || Modify ''LOAD_MODULES=false'' to be '''LOAD_MODULES=true'''.  Also, add your module to the line that is MODULES="".  Your module is the name of the module you chose previously to build prefixed by '''lirc_''':  
第83行: 第66行:
 
| '''''home-brew serial receiver ''''':<br><br>'''MODULES="lirc_dev lirc_serial"'''  
 
| '''''home-brew serial receiver ''''':<br><br>'''MODULES="lirc_dev lirc_serial"'''  
 
|}
 
|}
 
 
==== Build Lirc Modules ====
 
==== Build Lirc Modules ====
 
The lirc modules will need to be rebuilt every time that you update your kernel.  Just follow these build steps every time you boot into a newer kernel for the first time.
 
The lirc modules will need to be rebuilt every time that you update your kernel.  Just follow these build steps every time you boot into a newer kernel for the first time.
 
 
* This step will grab the necessary headers to build the kernel modules:
 
* This step will grab the necessary headers to build the kernel modules:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo m-a update,prepare
 
$ sudo m-a update,prepare
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* This will clean out any old lirc module builds:
 
* This will clean out any old lirc module builds:
 
<pre><nowiki>
 
<pre><nowiki>
第97行: 第77行:
 
$ sudo m-a clean lirc
 
$ sudo m-a clean lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* This will build the kernel/install modules:
 
* This will build the kernel/install modules:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo m-a a-i -f lirc
 
$ sudo m-a a-i -f lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Update the modules list
 
* Update the modules list
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo depmod -a
 
$ sudo depmod -a
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Create a lircd.conf ====
 
==== Create a lircd.conf ====
 
You have two options for how to create a lircd.conf.  You may be able to find one already made for your device, or you may generate one yourself.
 
You have two options for how to create a lircd.conf.  You may be able to find one already made for your device, or you may generate one yourself.
第114行: 第91行:
 
$ wget "<download link>" -O lircd.conf
 
$ wget "<download link>" -O lircd.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* For the '''''MCEUSB or MCEUSB2''''' based remote: https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircd.conf.mceusb
 
* For the '''''MCEUSB or MCEUSB2''''' based remote: https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircd.conf.mceusb
 
* For '''''Hauppauge i2c-based driver, including PVR-150 blaster''''': https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircd.conf.hauppauge
 
* For '''''Hauppauge i2c-based driver, including PVR-150 blaster''''': https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircd.conf.hauppauge
第120行: 第96行:
 
* For other remotes, a good place to start looking is the [http://lirc.sourceforge.net/remotes/ Lirc Website Remotes list].
 
* For other remotes, a good place to start looking is the [http://lirc.sourceforge.net/remotes/ Lirc Website Remotes list].
 
* The online remote configuration tool [http://lircconfig.commandir.com LIRC Config] also maintains a customizable database of lircd.conf's.
 
* The online remote configuration tool [http://lircconfig.commandir.com LIRC Config] also maintains a customizable database of lircd.conf's.
 
 
Replace <code><nowiki>/etc/lirc/lircd.conf</nowiki></code> with this lircd.conf that you have found:
 
Replace <code><nowiki>/etc/lirc/lircd.conf</nowiki></code> with this lircd.conf that you have found:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo cp <name of downloaded.conf> /etc/lirc
 
$ sudo cp <name of downloaded.conf> /etc/lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* '''NOTE:''' Please make sure the file is saved as a unix file and NOT a mac or dos text file format.  This will stop it from being read.
 
* '''NOTE:''' Please make sure the file is saved as a unix file and NOT a mac or dos text file format.  This will stop it from being read.
 
 
If you have found a remote, skip the next section.
 
If you have found a remote, skip the next section.
 
 
Otherwise, continue, and you will record a remote using '''irrecord'''.
 
Otherwise, continue, and you will record a remote using '''irrecord'''.
 
 
===== Recording a Remote =====
 
===== Recording a Remote =====
 
Insert the module that you have just built and intend to record from.
 
Insert the module that you have just built and intend to record from.
 
 
Example:
 
Example:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo modprobe lirc_mceusb
 
$ sudo modprobe lirc_mceusb
 
</nowiki></pre>
 
</nowiki></pre>
 
 
If you are using a '''serial infrared''' port (the '''lirc_sir''' module) you must disable the use of the infrared unit as a serial port before you insert the module. To do this, issue a command like the below to disable the serial port first. Please note that you will not be able to use LIRC and infrared serial communication at the same time.
 
If you are using a '''serial infrared''' port (the '''lirc_sir''' module) you must disable the use of the infrared unit as a serial port before you insert the module. To do this, issue a command like the below to disable the serial port first. Please note that you will not be able to use LIRC and infrared serial communication at the same time.
 
<pre><nowiki>
 
<pre><nowiki>
第147行: 第115行:
 
$ sudo setserial /dev/ttyS1 uart none
 
$ sudo setserial /dev/ttyS1 uart none
 
</nowiki></pre>
 
</nowiki></pre>
 
 
If you don't disable the serial port use of the infrared unit, you will receive a message like the below:
 
If you don't disable the serial port use of the infrared unit, you will receive a message like the below:
 
<pre><nowiki>
 
<pre><nowiki>
 
FATAL: Error inserting lirc_sir (/lib/modules/2.6.20-x-y/misc/lirc_sir.ko): Device or resource busy
 
FATAL: Error inserting lirc_sir (/lib/modules/2.6.20-x-y/misc/lirc_sir.ko): Device or resource busy
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Once you have LIRC, up and running, see the section "Serial Receiver / Transmitter" below for how to permanently disable the infrared serial port in favour of LIRC.
 
Once you have LIRC, up and running, see the section "Serial Receiver / Transmitter" below for how to permanently disable the infrared serial port in favour of LIRC.
 
 
If inserting the module still fails (this applies to all modules), it might be because the m-a ignored the special i2c module.  Force it to load, then try the modprobe command again:
 
If inserting the module still fails (this applies to all modules), it might be because the m-a ignored the special i2c module.  Force it to load, then try the modprobe command again:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo dpkg -i /usr/src/lirc-modules-2.6.*.deb
 
$ sudo dpkg -i /usr/src/lirc-modules-2.6.*.deb
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Record the remote using irrecord
 
* Record the remote using irrecord
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo irrecord -d /dev/lirc0 lircd.conf
 
$ sudo irrecord -d /dev/lirc0 lircd.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Once you have completed your configuration, move this lircd.conf to /etc/lirc/lircd.conf
 
* Once you have completed your configuration, move this lircd.conf to /etc/lirc/lircd.conf
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo mv lircd.conf /etc/lirc
 
$ sudo mv lircd.conf /etc/lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Start Lirc & Test ====
 
==== Start Lirc & Test ====
 
The modules will load when you start lirc, if they aren't already loaded.
 
The modules will load when you start lirc, if they aren't already loaded.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo /etc/init.d/lirc start
 
$ sudo /etc/init.d/lirc start
 
$ irw</nowiki></pre>
 
$ irw</nowiki></pre>
 
The terminal should 'appear' to hang, (not return a command prompt).  Press buttons on your remote, you should see key presses then come up on the terminal. When your done, testing press <crtl> + 'c' to quit.
 
The terminal should 'appear' to hang, (not return a command prompt).  Press buttons on your remote, you should see key presses then come up on the terminal. When your done, testing press <crtl> + 'c' to quit.
 
 
If irw returns immediately, and gives you another command prompt some of your modules aren't loading correctly.  Try rebooting your computer.  If this doesn't work check dmesg for clues as to which module isn't loading.
 
If irw returns immediately, and gives you another command prompt some of your modules aren't loading correctly.  Try rebooting your computer.  If this doesn't work check dmesg for clues as to which module isn't loading.
 
<pre><nowiki> $ dmesg | grep -i lirc
 
<pre><nowiki> $ dmesg | grep -i lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
 
if you get:
 
if you get:
 
<pre><nowiki>
 
<pre><nowiki>
第189行: 第147行:
 
</nowiki></pre>
 
</nowiki></pre>
 
You haven't created replaced the default lircd.conf read the above section on [https://help.ubuntu.com/community/Install_Lirc_Edgy#head-43c53755fd9d7351d834b8816ecb5d02e12324c7 creating lircd.conf ]
 
You haven't created replaced the default lircd.conf read the above section on [https://help.ubuntu.com/community/Install_Lirc_Edgy#head-43c53755fd9d7351d834b8816ecb5d02e12324c7 creating lircd.conf ]
 
 
==== Create a .lircrc file ====
 
==== Create a .lircrc file ====
 
===== Automated Method =====
 
===== Automated Method =====
 
The web tool [http://lircconfig.commandir.com/ LIRC Config] creates customized .lircrc files for MythTV, Xine, and Mplayer from a web browser.  
 
The web tool [http://lircconfig.commandir.com/ LIRC Config] creates customized .lircrc files for MythTV, Xine, and Mplayer from a web browser.  
 
 
* '''NOTE:''' Please make sure the file is saved as a unix file and NOT a mac or dos text file format.  This will stop it from being read.
 
* '''NOTE:''' Please make sure the file is saved as a unix file and NOT a mac or dos text file format.  This will stop it from being read.
 
 
===== Standard Method =====
 
===== Standard Method =====
 
If you are intending on using lirc for only IR transmitting, you don't need to create a ~/.lircrc file.  If you are going to use it for IR receiving, you will need to create a ~/.lircrc file describing what each of the buttons does for each application you will use lirc in.
 
If you are intending on using lirc for only IR transmitting, you don't need to create a ~/.lircrc file.  If you are going to use it for IR receiving, you will need to create a ~/.lircrc file describing what each of the buttons does for each application you will use lirc in.
 
 
The basic syntax is as follows:
 
The basic syntax is as follows:
 
<pre><nowiki>
 
<pre><nowiki>
第207行: 第161行:
 
end
 
end
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Where:
 
Where:
 
''PROGRAM'' is the program you are recording buttons for.  Some examples for ''PROGRAM'' are '''mythtv''', '''mplayer''', '''xine''', '''vlc''', and '''irexec'''.
 
''PROGRAM'' is the program you are recording buttons for.  Some examples for ''PROGRAM'' are '''mythtv''', '''mplayer''', '''xine''', '''vlc''', and '''irexec'''.
 
 
''REMOTE_BUTTON'' is the name of the button in accordance with what is listed in your /etc/lirc/lircd.conf.
 
''REMOTE_BUTTON'' is the name of the button in accordance with what is listed in your /etc/lirc/lircd.conf.
 
 
''ACTION'' is the action that will be performed when this button is pressed.  You can find a list of actions in the attached .lircrc example file.
 
''ACTION'' is the action that will be performed when this button is pressed.  You can find a list of actions in the attached .lircrc example file.
 
+
* Here is the example lircrc tailored for several apps on a mceusb/mceusb2 remote:
** Here is the example lircrc tailored for several apps on a mceusb/mceusb2 remote:
+
** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.mceusb
*** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.mceusb
+
 
+
 
For a mceusb2 remote, you might need to change the button names from "chan-", "chan+", "vol-", "vol+" to "chandown", "chanup", "voldown", "volup".
 
For a mceusb2 remote, you might need to change the button names from "chan-", "chan+", "vol-", "vol+" to "chandown", "chanup", "voldown", "volup".
** Here is the example lircrc tailored for mythtv only on a hauppauge remote:
+
* Here is the example lircrc tailored for mythtv only on a hauppauge remote:
*** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.hauppauge
+
** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.hauppauge
 
+
 
===== Alternate configuration method - IRKick =====
 
===== Alternate configuration method - IRKick =====
 
If you're a KDE user, you may find it more convenient to set up functionality using irkick. This requires you already have your lircd.conf and hardware.conf set up, but you won't need an lircrc file if you take this approach.
 
If you're a KDE user, you may find it more convenient to set up functionality using irkick. This requires you already have your lircd.conf and hardware.conf set up, but you won't need an lircrc file if you take this approach.
 
 
First, you'll need to install a couple packages:
 
First, you'll need to install a couple packages:
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo apt-get install lirc-x kdelirc
 
$ sudo apt-get install lirc-x kdelirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Next, start up IRKick - It's in the Utilities menu.
 
Next, start up IRKick - It's in the Utilities menu.
 
 
IRKick contains extensions to easily setup the remotes functions with Amarok, Kaffeine, Noatun, and Konqueror, but can be made to perform any terminal command or dcop call.
 
IRKick contains extensions to easily setup the remotes functions with Amarok, Kaffeine, Noatun, and Konqueror, but can be made to perform any terminal command or dcop call.
 
 
To add functionality for a button - just click add (on the right-hand side).
 
To add functionality for a button - just click add (on the right-hand side).
 
To add a new mode for the remote, click on the left add and give it an appropriate name. Note: when adding a new mode, you'll also need to assign a button to switch to that mode. This allows you to have buttons do different things in different modes. Select the mode on the left before adding new functions for buttons.
 
To add a new mode for the remote, click on the left add and give it an appropriate name. Note: when adding a new mode, you'll also need to assign a button to switch to that mode. This allows you to have buttons do different things in different modes. Select the mode on the left before adding new functions for buttons.
 
 
Click apply when you're done making changes, and that's it, no configuration files to play with :)
 
Click apply when you're done making changes, and that's it, no configuration files to play with :)
 
 
==== Specific Application lircrc Notes ====
 
==== Specific Application lircrc Notes ====
 
 
Multiple applications can be listed in the .lircrc file, but you will need a seperate ''begin''  and ''end'' block for each button in each application.
 
Multiple applications can be listed in the .lircrc file, but you will need a seperate ''begin''  and ''end'' block for each button in each application.
 
 
* MythTV lircrc
 
* MythTV lircrc
 
If you are using this for mythtv, you will either need to create a standalone lircrc for mythtv in <code><nowiki>~/.mythtv/lircrc</nowiki></code> or create a symbolic link to this file and place all the lircrc related content in <code><nowiki>/.lircrc</nowiki></code>.
 
If you are using this for mythtv, you will either need to create a standalone lircrc for mythtv in <code><nowiki>~/.mythtv/lircrc</nowiki></code> or create a symbolic link to this file and place all the lircrc related content in <code><nowiki>/.lircrc</nowiki></code>.
 
+
* Creating a symbolic link. [ All mythtv buttons will need to be placed in <code><nowiki>~/.lircrc</nowiki></code> with the rest of the applications you use lirc for ]
** Creating a symbolic link. [ All mythtv buttons will need to be placed in <code><nowiki>~/.lircrc</nowiki></code> with the rest of the applications you use lirc for ]
+
 
<pre><nowiki>
 
<pre><nowiki>
 
$ ln -s ~/.lircrc ~/.mythtv/lircrc
 
$ ln -s ~/.lircrc ~/.mythtv/lircrc
 
</nowiki></pre>
 
</nowiki></pre>
 
+
* Creating a standalone file. [ All mythtv buttons will be placed in <code><nowiki>~/.mythtv/lircrc</nowiki></code> ]
** Creating a standalone file. [ All mythtv buttons will be placed in <code><nowiki>~/.mythtv/lircrc</nowiki></code> ]
+
** Here is an example using a mceusb/mceusb2 remote:
*** Here is an example using a mceusb/mceusb2 remote:
+
** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.mythtv.mceusb
**** https://help.ubuntu.com/community/Install_Lirc_Feisty?action=AttachFile&do=get&target=lircrc.mythtv.mceusb
+
** Here is an example using a hauppauge remote:
*** Here is an example using a hauppauge remote:
+
*[http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt lircrc.mythtv.hauppauge]
****[http://wilsonet.com/mythtv/lircrc-haupgrey-g3.txt lircrc.mythtv.hauppauge]
+
 
+
 
* IRexec
 
* IRexec
 
irexec is able to interpret keypresses and launch applications when the keys are pressed.
 
irexec is able to interpret keypresses and launch applications when the keys are pressed.
第267行: 第204行:
 
end
 
end
 
</nowiki></pre>
 
</nowiki></pre>
 
 
APPLICATION is simply the path and name of a file marked executable.
 
APPLICATION is simply the path and name of a file marked executable.
 
 
* '''NOTE:''' IRexec is installed with lirc, it is not started by default however.  You can have it start by adding it to your login "session".
 
* '''NOTE:''' IRexec is installed with lirc, it is not started by default however.  You can have it start by adding it to your login "session".
 
 
=== Setting up two or more devices ===
 
=== Setting up two or more devices ===
 
After you have proven LIRC works with a single device, you can modify your scripts to include support for multiple devices.  The first thing you will have to make sure you have kernel modules for the additional devices.  If during the single device setup, you built modules for all the devices you thought you would need, you can skip  the next step.
 
After you have proven LIRC works with a single device, you can modify your scripts to include support for multiple devices.  The first thing you will have to make sure you have kernel modules for the additional devices.  If during the single device setup, you built modules for all the devices you thought you would need, you can skip  the next step.
 
 
==== Build Additional Modules ====
 
==== Build Additional Modules ====
 
* Clear our any old module builds
 
* Clear our any old module builds
第281行: 第214行:
 
$ sudo m-a clean lirc
 
$ sudo m-a clean lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Stop lirc & unload any loaded modules.
 
* Stop lirc & unload any loaded modules.
 
<pre><nowiki>
 
<pre><nowiki>
第287行: 第219行:
 
$ sudo rmmod LOADED_LIRC_MODULES
 
$ sudo rmmod LOADED_LIRC_MODULES
 
</nowiki></pre>
 
</nowiki></pre>
** Replace LOADED_LIRC_MODULES with any lirc modules you have loaded.
+
* Replace LOADED_LIRC_MODULES with any lirc modules you have loaded.
 
+
* Reconfigure lirc-modules-source. Choose all modules you will need (including those previously chosen)
* Reconfigure lirc-modules-source. Choose all modules you will need (including those previously chosen)
+
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo dpkg-reconfigure lirc-modules-source
 
$ sudo dpkg-reconfigure lirc-modules-source
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Build/install the kernel modules
 
* Build/install the kernel modules
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo m-a a-i lirc
 
$ sudo m-a a-i lirc
 
</nowiki></pre>
 
</nowiki></pre>
 
+
* If you get a message that it won't reinstall an already installed version, you can force installation.
** If you get a message that it won't reinstall an already installed version, you can force installation.
+
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo dpkg -i /usr/src/lirc*deb
 
$ sudo dpkg -i /usr/src/lirc*deb
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Modify Init Scripts ====
 
==== Modify Init Scripts ====
 
* Modify <code><nowiki>/etc/lirc/hardware.conf</nowiki></code>
 
* Modify <code><nowiki>/etc/lirc/hardware.conf</nowiki></code>
第312行: 第240行:
 
LIRCD2_ARGS="-d /dev/lirc1 --output=/dev/lircd1 --connect=localhost:8765 --pidfile=/var/run/lircd2.pid"
 
LIRCD2_ARGS="-d /dev/lirc1 --output=/dev/lircd1 --connect=localhost:8765 --pidfile=/var/run/lircd2.pid"
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* Modify <code><nowiki>/etc/init.d/lirc</nowiki></code>
 
* Modify <code><nowiki>/etc/init.d/lirc</nowiki></code>
 
** Change this block:
 
** Change this block:
第329行: 第256行:
 
< /dev/null
 
< /dev/null
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* If you have more then 2 LIRC devices, you will need to add additional blocks to <code><nowiki>/etc/lirc/hardware.conf</nowiki></code> and <code><nowiki>/etc/init.d/lirc</nowiki></code> to connect to the main lirc process.
 
* If you have more then 2 LIRC devices, you will need to add additional blocks to <code><nowiki>/etc/lirc/hardware.conf</nowiki></code> and <code><nowiki>/etc/init.d/lirc</nowiki></code> to connect to the main lirc process.
 
 
==== Testing Lirc ====
 
==== Testing Lirc ====
 
 
* Start lirc
 
* Start lirc
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo /etc/init.d/lirc start
 
$ sudo /etc/init.d/lirc start
 
</nowiki></pre>
 
</nowiki></pre>
 
 
* You should have two lircd processes running.  You will need to provide a parameter to any lirc process trying to interact with lircd now to indicate which lircd you want to interact with.
 
* You should have two lircd processes running.  You will need to provide a parameter to any lirc process trying to interact with lircd now to indicate which lircd you want to interact with.
 
 
== Additional Information ==
 
== Additional Information ==
 
=== Supported Transmitting Devices ===
 
=== Supported Transmitting Devices ===
第348行: 第270行:
 
* lirc_mceusb2
 
* lirc_mceusb2
 
* lirc_cmdir
 
* lirc_cmdir
 
 
=== CommandIR IR Receiver and Quadruple-Transmitter ===
 
=== CommandIR IR Receiver and Quadruple-Transmitter ===
 
One site has [http://support.commandir.com/guides/index.php?distro-ubuntu-feisty automated the above procedure] for their CommandIR Mini transceiver, which has a [http://www.commandir.com remote receiver and 4 IR blasters].  The device's emitters allow control of multiple devices and '''do not require different codesets''' since each emitter can be individually selected for transmitting using irsend set_transmitters.  
 
One site has [http://support.commandir.com/guides/index.php?distro-ubuntu-feisty automated the above procedure] for their CommandIR Mini transceiver, which has a [http://www.commandir.com remote receiver and 4 IR blasters].  The device's emitters allow control of multiple devices and '''do not require different codesets''' since each emitter can be individually selected for transmitting using irsend set_transmitters.  
 
 
It is possible to use their script to setup LIRC on Ubuntu for CommandIR then make minor modifications for other hardware.  
 
It is possible to use their script to setup LIRC on Ubuntu for CommandIR then make minor modifications for other hardware.  
 
 
=== PVR-150 IR Transmitter ===
 
=== PVR-150 IR Transmitter ===
 
==== firmware and codesets ====
 
==== firmware and codesets ====
 
You need to download the Hauppauge firmware and add the appropriate codeset to your lircd.conf for the device you want to control.
 
You need to download the Hauppauge firmware and add the appropriate codeset to your lircd.conf for the device you want to control.
 
 
The firmware can be found [http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin here]. Download it and put it in ~+`/lib/firmware`+~
 
The firmware can be found [http://www.blushingpenguin.com/mark/lmilk/haup-ir-blaster.bin here]. Download it and put it in ~+`/lib/firmware`+~
 
 
The codesets can be found [http://www.blushingpenguin.com/mark/lmilk/lircd.conf here].  This file contains the codesets for every device in the database.  You will need to extract the information for the device you want to control, and append it to your /etc/lirc/lircd.conf -- but for now, just save it someplace safe.
 
The codesets can be found [http://www.blushingpenguin.com/mark/lmilk/lircd.conf here].  This file contains the codesets for every device in the database.  You will need to extract the information for the device you want to control, and append it to your /etc/lirc/lircd.conf -- but for now, just save it someplace safe.
 
 
When you have downloaded and moved the firmware and have the codeset file, '''''Reboot''''' before continuing.
 
When you have downloaded and moved the firmware and have the codeset file, '''''Reboot''''' before continuing.
 
 
==== Adding the blaster codeset ====
 
==== Adding the blaster codeset ====
 
You will need to determine the codeset of your device.  To help you determine the possible codeset, consult the list here: [http://www.blushingpenguin.com/mark/lmilk/IRcodesets.html here].  Note that finding the correct codeset for your device can be tricky- but the master list can usually help you track them down by process of elimination.
 
You will need to determine the codeset of your device.  To help you determine the possible codeset, consult the list here: [http://www.blushingpenguin.com/mark/lmilk/IRcodesets.html here].  Note that finding the correct codeset for your device can be tricky- but the master list can usually help you track them down by process of elimination.
 
 
Once you have determined a codeset, you need to extract those codes from the master file you downloaded and add them to your /etc/lirc/lircd.conf as another remote.
 
Once you have determined a codeset, you need to extract those codes from the master file you downloaded and add them to your /etc/lirc/lircd.conf as another remote.
 
 
For example, to blast a '''Power Button'''  a Motorola DCT6200 series cable box, you would use the POWER button raw code from codeset 85. If you are linking it to a key on your remote, you want to change the button name to the name reported by irw.
 
For example, to blast a '''Power Button'''  a Motorola DCT6200 series cable box, you would use the POWER button raw code from codeset 85. If you are linking it to a key on your remote, you want to change the button name to the name reported by irw.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo nano /etc/lirc/lircd.conf
 
$ sudo nano /etc/lirc/lircd.conf
 
</nowiki></pre>
 
</nowiki></pre>
 
 
First, add the blaster header:
 
First, add the blaster header:
 
<pre><nowiki>
 
<pre><nowiki>
 
begin remote
 
begin remote
 
 
name          blaster
 
name          blaster
 
bits          32
 
bits          32
第389行: 第299行:
 
begin raw_codes
 
begin raw_codes
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Next, find the power button in codeset 85- since this is a cable box, it is prefixed in the master file as 0_85:
 
Next, find the power button in codeset 85- since this is a cable box, it is prefixed in the master file as 0_85:
 
<pre><nowiki>
 
<pre><nowiki>
第400行: 第309行:
 
5570570
 
5570570
 
</nowiki></pre>
 
</nowiki></pre>
 
 
Keep adding your buttons (only the ones you want to control with the blaster).  When you are finished, add:
 
Keep adding your buttons (only the ones you want to control with the blaster).  When you are finished, add:
 
<pre><nowiki>
 
<pre><nowiki>
第409行: 第317行:
 
<pre><nowiki>
 
<pre><nowiki>
 
begin remote
 
begin remote
 
 
name          blaster
 
name          blaster
 
bits          32
 
bits          32
第433行: 第340行:
 
</nowiki></pre>
 
</nowiki></pre>
 
turns the DCT6200 cable box on and off.  Even if it does not control the device as intended, you should see the blaster flashing.
 
turns the DCT6200 cable box on and off.  Even if it does not control the device as intended, you should see the blaster flashing.
 
 
Troubleshooting codeset selection, blaster placement, etc. is beyond the scope of this guide.  A wealth of information is readily available via [http://www.google.com Google]
 
Troubleshooting codeset selection, blaster placement, etc. is beyond the scope of this guide.  A wealth of information is readily available via [http://www.google.com Google]
 
 
=== MCEUSB2 IR Transmitter ===
 
=== MCEUSB2 IR Transmitter ===
 
Feisty packages include support for the mceusb2 IR transmitter.  Usage is the same as standard serial transmitters.
 
Feisty packages include support for the mceusb2 IR transmitter.  Usage is the same as standard serial transmitters.
 
 
For information on setting up this blaster with a Motorola DCT700 cable box:  
 
For information on setting up this blaster with a Motorola DCT700 cable box:  
 
See Self:Motorola_DCT700_Channel_Change_Script  
 
See Self:Motorola_DCT700_Channel_Change_Script  
 
 
=== Serial Receiver / Transmitter ===
 
=== Serial Receiver / Transmitter ===
 
If you are running the lirc_serial driver either for a transmitter or receiver, you will need to disable kernel serial support.  There are two ways this can be achieved:
 
If you are running the lirc_serial driver either for a transmitter or receiver, you will need to disable kernel serial support.  There are two ways this can be achieved:
第451行: 第354行:
 
* Credit to TechnoPenguin & TrubbleMaker from the forums, usring modprobe.conf
 
* Credit to TechnoPenguin & TrubbleMaker from the forums, usring modprobe.conf
 
This can be achieved by editting <code><nowiki>/etc/modprobe.conf</nowiki></code> and adding the following:
 
This can be achieved by editting <code><nowiki>/etc/modprobe.conf</nowiki></code> and adding the following:
 
 
<pre><nowiki>alias char-major-61 lirc_serial
 
<pre><nowiki>alias char-major-61 lirc_serial
 
options lirc_serial irq=4 io=0x3f8
 
options lirc_serial irq=4 io=0x3f8
第457行: 第359行:
 
/sbin/modprobe --ignore-install lirc_serial
 
/sbin/modprobe --ignore-install lirc_serial
 
</nowiki></pre>
 
</nowiki></pre>
 
 
This is for a typical machine using the primary serial port (/dev/ttyS0) and the standard IRQ and IO ports.  If you are running on the secondary serial port, replace the device to be /dev/ttyS1 and the appropriate IRQ & IO ports.
 
This is for a typical machine using the primary serial port (/dev/ttyS0) and the standard IRQ and IO ports.  If you are running on the secondary serial port, replace the device to be /dev/ttyS1 and the appropriate IRQ & IO ports.
 
 
==== Second Method ====
 
==== Second Method ====
 
* Using the setserial debian configuration
 
* Using the setserial debian configuration
第465行: 第365行:
 
$ sudo dpkg-reconfigure setserial
 
$ sudo dpkg-reconfigure setserial
 
</nowiki></pre>
 
</nowiki></pre>
** Choose manual
+
* Choose manual
** Modify /var/lib/setserial/autoserial.conf
+
* Modify /var/lib/setserial/autoserial.conf
*** Add (or modify if its there already) (switch to ttyS1 if your using that instead)
+
** Add (or modify if its there already) (switch to ttyS1 if your using that instead)
 
<pre><nowiki>
 
<pre><nowiki>
 
/dev/ttyS0 uart none
 
/dev/ttyS0 uart none
 
</nowiki></pre>
 
</nowiki></pre>
** Copy that script to /etc/serial.conf
+
* Copy that script to /etc/serial.conf
 
<pre><nowiki>
 
<pre><nowiki>
 
$ sudo cp /var/lib/setserial/autoserial.conf /etc/serial.conf
 
$ sudo cp /var/lib/setserial/autoserial.conf /etc/serial.conf
第477行: 第377行:
 
=== Managed I2C Devices ===
 
=== Managed I2C Devices ===
 
Ubuntu Edgy introduces support in the kernel to directly manage some remotes via the i2c bus.  For remotes like this, the kernel is deprecating the use (and requirement) of lirc.  You should be able to press keys on the remote and have them recognized as ordinary keyboard keys.  If you don't like the way that the keypresses that are recognized for certain buttons on the remote, their behavior can be changed using Xmodmap.
 
Ubuntu Edgy introduces support in the kernel to directly manage some remotes via the i2c bus.  For remotes like this, the kernel is deprecating the use (and requirement) of lirc.  You should be able to press keys on the remote and have them recognized as ordinary keyboard keys.  If you don't like the way that the keypresses that are recognized for certain buttons on the remote, their behavior can be changed using Xmodmap.
 
 
Alternatively, if you would like to still use lirc to manage your i2c device, hexion has written a howto explaining how to install lirc from source and replace the ir_common module in the kernel causing this behavior.  See his howto here: [http://www.ubuntuforums.org/showthread.php?t=288229  HOWTO: Lirc in Edgy].
 
Alternatively, if you would like to still use lirc to manage your i2c device, hexion has written a howto explaining how to install lirc from source and replace the ir_common module in the kernel causing this behavior.  See his howto here: [http://www.ubuntuforums.org/showthread.php?t=288229  HOWTO: Lirc in Edgy].
 
 
== Rebuild Modules ==
 
== Rebuild Modules ==
 
If you ever need to rebuild your lirc modules for a new kernel version, here are the correct steps to follow:
 
If you ever need to rebuild your lirc modules for a new kernel version, here are the correct steps to follow:

2007年11月30日 (五) 17:53的版本

Include(Install_Lirc_Header)

Lirc Installation & Maintenance

Lirc can be used for IR and RF sending and receiving for many IR and RF remote controls and senders (blasters). As installed, the default Lirc init scripts are properly setup to handle a single device, but the driver build scripts can handle multiple devices. If you are looking to set up a transmitter and a receiver, multiple transmitters, or multiple receivers, set up a Single Device first and verify functionality. Afterwords, continue on to the setting up multiple devices section.

Setting up a Single Device

Throughout this howto, the lirc_mceusb driver will be used for examples. It's not necessary to build the lirc_mceusb driver if you are using a different receiver. It is just for examples sake. Also, note that some devices, such as the USB-UIRT, have full support built-in to the kernel and the lirc package and thus the lirc-modules-source package is not needed. See Self:Lirc_USB-UIRT for more info.

Setup Repositories

In order to install lirc, you will need to have universe, and multiverse enabled. See Ubuntu documentation for more information on enabling these repositories.

Install Lirc

You will only need to install lirc once, however, the kernel modules will need to be rebuilt after every kernel update.

$ sudo apt-get install lirc lirc-modules-source module-assistant
  • NOTE: Some i2c remotes are supported directly by the kernel. If you are using a remote that would have used the i2c driver, check out the Managed I2C devices link below to use this instead.

Configure lirc-modules-source

During the configuration of lirc-modules-source, you will choose the type of lirc device you are setting up.

$ sudo dpkg-reconfigure lirc-modules-source
1> Install_Lirc_Feisty?action=AttachFile&do=get&target=reconfigure1_1.png You will be provided a screen with a lot of information. Choose the okay button to move on.
6> Install_Lirc_Feisty?action=AttachFile&do=get&target=choose.png Choose your module(s) that you will need. Some modules will need additional information about the device, such as serial transmitters or serial port adapters.
PVR-150 on-card blaster/receiver: you will want to build the i2c and pvr150 modules
PVR-150 USB blaster/receiver: you will want to build either the mceusb or mceusb2 module
To use the serial infrared port that is present on many laptops, select sir. On the next page, you will then be asked what type of adapter you have; unless you have one of the specific types listed, you should select "other".
To use the home-brew serial receiver (Igor Cesko's variation) select serial. On the next page, you will then be asked what type of adapter you have; you should select "other".
Snapstream Firefly RF: you will want to build the atiusb module
1> Install_Lirc_Feisty?action=AttachFile&do=get&target=build.png You will be given an option to build the modules. Be sure not to build the modules here.
2> Install_Lirc_Feisty?action=AttachFile&do=get&target=maintainer.png You may be given an option to replace with a new version. Be sure to choose to Install the package maintainer's version.
Home-brew serial receiver

For the home-brew serial receiver (Igor Cesko's variation) modify file /etc/lirc/lirc-modules-source.conf

$ sudo nano /etc/lirc/lirc-modules-source.conf

and add -DLIRC_SERIAL_IGOR to line LIRC_SERIAL_CFLAGS, it should look like this after modification:

LIRC_SERIAL_CFLAGS=" -DLIRC_SERIAL_SOFTCARRIER -DLIRC_SERIAL_IGOR"

If you want to play with additional lirc serial settings, take a look in config.h from lirc-x.x.x.tar.bz package.

Modify /etc/lirc/hardware.conf

Modify /etc/lirc/hardware.conf.

$ sudo nano /etc/lirc/hardware.conf
5> Install_Lirc_Feisty?action=AttachFile&do=get&target=hardware.png Modify LOAD_MODULES=false to be LOAD_MODULES=true. Also, add your module to the line that is MODULES="". Your module is the name of the module you chose previously to build prefixed by lirc_:
mceusb:

MODULES="lirc_mceusb"
PVR-150/350 on-card blaster/receiver:

LIRCD_ARGS="--device=/dev/lirc0"
MODULES="lirc_pvr150"
Snapstream Firefly RF:

MODULES="lirc_atiusb"
home-brew serial receiver :

MODULES="lirc_dev lirc_serial"

Build Lirc Modules

The lirc modules will need to be rebuilt every time that you update your kernel. Just follow these build steps every time you boot into a newer kernel for the first time.

  • This step will grab the necessary headers to build the kernel modules:
$ sudo m-a update,prepare
  • This will clean out any old lirc module builds:
$ sudo rm /usr/src/lirc*deb
$ sudo m-a clean lirc
  • This will build the kernel/install modules:
$ sudo m-a a-i -f lirc
  • Update the modules list
$ sudo depmod -a

Create a lircd.conf

You have two options for how to create a lircd.conf. You may be able to find one already made for your device, or you may generate one yourself.

Using a premade lircd.conf
$ wget "<download link>" -O lircd.conf

Replace /etc/lirc/lircd.conf with this lircd.conf that you have found:

$ sudo cp <name of downloaded.conf> /etc/lirc
  • NOTE: Please make sure the file is saved as a unix file and NOT a mac or dos text file format. This will stop it from being read.

If you have found a remote, skip the next section. Otherwise, continue, and you will record a remote using irrecord.

Recording a Remote

Insert the module that you have just built and intend to record from. Example:

$ sudo modprobe lirc_mceusb

If you are using a serial infrared port (the lirc_sir module) you must disable the use of the infrared unit as a serial port before you insert the module. To do this, issue a command like the below to disable the serial port first. Please note that you will not be able to use LIRC and infrared serial communication at the same time.

$ sudo apt-get install setserial
$ sudo setserial /dev/ttyS0 uart none
$ sudo setserial /dev/ttyS1 uart none

If you don't disable the serial port use of the infrared unit, you will receive a message like the below:

FATAL: Error inserting lirc_sir (/lib/modules/2.6.20-x-y/misc/lirc_sir.ko): Device or resource busy

Once you have LIRC, up and running, see the section "Serial Receiver / Transmitter" below for how to permanently disable the infrared serial port in favour of LIRC. If inserting the module still fails (this applies to all modules), it might be because the m-a ignored the special i2c module. Force it to load, then try the modprobe command again:

$ sudo dpkg -i /usr/src/lirc-modules-2.6.*.deb
  • Record the remote using irrecord
$ sudo irrecord -d /dev/lirc0 lircd.conf
  • Once you have completed your configuration, move this lircd.conf to /etc/lirc/lircd.conf
$ sudo mv lircd.conf /etc/lirc

Start Lirc & Test

The modules will load when you start lirc, if they aren't already loaded.

$ sudo /etc/init.d/lirc start
$ irw

The terminal should 'appear' to hang, (not return a command prompt). Press buttons on your remote, you should see key presses then come up on the terminal. When your done, testing press <crtl> + 'c' to quit. If irw returns immediately, and gives you another command prompt some of your modules aren't loading correctly. Try rebooting your computer. If this doesn't work check dmesg for clues as to which module isn't loading.

 $ dmesg | grep -i lirc

if you get:

sweet_user_name@ubuntu:~$ sudo /etc/init.d/lirc start
Password:

You haven't created replaced the default lircd.conf read the above section on creating lircd.conf

Create a .lircrc file

Automated Method

The web tool LIRC Config creates customized .lircrc files for MythTV, Xine, and Mplayer from a web browser.

  • NOTE: Please make sure the file is saved as a unix file and NOT a mac or dos text file format. This will stop it from being read.
Standard Method

If you are intending on using lirc for only IR transmitting, you don't need to create a ~/.lircrc file. If you are going to use it for IR receiving, you will need to create a ~/.lircrc file describing what each of the buttons does for each application you will use lirc in. The basic syntax is as follows:

begin
prog = PROGRAM
button = REMOTE_BUTTON
config = ACTION
end

Where: PROGRAM is the program you are recording buttons for. Some examples for PROGRAM are mythtv, mplayer, xine, vlc, and irexec. REMOTE_BUTTON is the name of the button in accordance with what is listed in your /etc/lirc/lircd.conf. ACTION is the action that will be performed when this button is pressed. You can find a list of actions in the attached .lircrc example file.

For a mceusb2 remote, you might need to change the button names from "chan-", "chan+", "vol-", "vol+" to "chandown", "chanup", "voldown", "volup".

Alternate configuration method - IRKick

If you're a KDE user, you may find it more convenient to set up functionality using irkick. This requires you already have your lircd.conf and hardware.conf set up, but you won't need an lircrc file if you take this approach. First, you'll need to install a couple packages:

$ sudo apt-get install lirc-x kdelirc

Next, start up IRKick - It's in the Utilities menu. IRKick contains extensions to easily setup the remotes functions with Amarok, Kaffeine, Noatun, and Konqueror, but can be made to perform any terminal command or dcop call. To add functionality for a button - just click add (on the right-hand side). To add a new mode for the remote, click on the left add and give it an appropriate name. Note: when adding a new mode, you'll also need to assign a button to switch to that mode. This allows you to have buttons do different things in different modes. Select the mode on the left before adding new functions for buttons. Click apply when you're done making changes, and that's it, no configuration files to play with :)

Specific Application lircrc Notes

Multiple applications can be listed in the .lircrc file, but you will need a seperate begin and end block for each button in each application.

  • MythTV lircrc

If you are using this for mythtv, you will either need to create a standalone lircrc for mythtv in ~/.mythtv/lircrc or create a symbolic link to this file and place all the lircrc related content in /.lircrc.

  • Creating a symbolic link. [ All mythtv buttons will need to be placed in ~/.lircrc with the rest of the applications you use lirc for ]
$ ln -s ~/.lircrc ~/.mythtv/lircrc

irexec is able to interpret keypresses and launch applications when the keys are pressed. The syntax is:

begin
prog = irexec
button = REMOTE_BUTTON
config = APPLICATION
end

APPLICATION is simply the path and name of a file marked executable.

  • NOTE: IRexec is installed with lirc, it is not started by default however. You can have it start by adding it to your login "session".

Setting up two or more devices

After you have proven LIRC works with a single device, you can modify your scripts to include support for multiple devices. The first thing you will have to make sure you have kernel modules for the additional devices. If during the single device setup, you built modules for all the devices you thought you would need, you can skip the next step.

Build Additional Modules

  • Clear our any old module builds
$ sudo rm /usr/src/lirc*deb
$ sudo m-a clean lirc
  • Stop lirc & unload any loaded modules.
$ sudo /etc/init.d/lirc stop
$ sudo rmmod LOADED_LIRC_MODULES
  • Replace LOADED_LIRC_MODULES with any lirc modules you have loaded.
  • Reconfigure lirc-modules-source. Choose all modules you will need (including those previously chosen)
$ sudo dpkg-reconfigure lirc-modules-source
  • Build/install the kernel modules
$ sudo m-a a-i lirc
  • If you get a message that it won't reinstall an already installed version, you can force installation.
$ sudo dpkg -i /usr/src/lirc*deb

Modify Init Scripts

  • Modify /etc/lirc/hardware.conf
    • Make sure that all of your modules are now added to the list of MODULES="". Take note of the order you provide these modules. This will be the order that lirc recognizes the devices, and important if you are going to need to differentiate between different lirc devices.
    • Modify LIRCD_ARGS="" to match
LIRCD_ARGS="-d /dev/lirc0 --output=/dev/lircd --listen"
LIRCD2_ARGS="-d /dev/lirc1 --output=/dev/lircd1 --connect=localhost:8765 --pidfile=/var/run/lircd2.pid"
  • Modify /etc/init.d/lirc
    • Change this block:
LIRCD_ARGS=`build_args $LIRCD_ARGS`
start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- $LIRCD_ARGS \
< /dev/null

To be:

LIRCD_ARGS=`build_args $LIRCD_ARGS`
LIRCD2_ARGS=`build_args $LIRCD2_ARGS`
start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- $LIRCD_ARGS \
< /dev/null
/usr/sbin/lircd $LIRCD2_ARGS \
< /dev/null
  • If you have more then 2 LIRC devices, you will need to add additional blocks to /etc/lirc/hardware.conf and /etc/init.d/lirc to connect to the main lirc process.

Testing Lirc

  • Start lirc
$ sudo /etc/init.d/lirc start
  • You should have two lircd processes running. You will need to provide a parameter to any lirc process trying to interact with lircd now to indicate which lircd you want to interact with.

Additional Information

Supported Transmitting Devices

The following drivers have support for IR transmission:

  • lirc_pvr150
  • lirc_serial
  • lirc_mceusb2
  • lirc_cmdir

CommandIR IR Receiver and Quadruple-Transmitter

One site has automated the above procedure for their CommandIR Mini transceiver, which has a remote receiver and 4 IR blasters. The device's emitters allow control of multiple devices and do not require different codesets since each emitter can be individually selected for transmitting using irsend set_transmitters. It is possible to use their script to setup LIRC on Ubuntu for CommandIR then make minor modifications for other hardware.

PVR-150 IR Transmitter

firmware and codesets

You need to download the Hauppauge firmware and add the appropriate codeset to your lircd.conf for the device you want to control. The firmware can be found here. Download it and put it in ~+`/lib/firmware`+~ The codesets can be found here. This file contains the codesets for every device in the database. You will need to extract the information for the device you want to control, and append it to your /etc/lirc/lircd.conf -- but for now, just save it someplace safe. When you have downloaded and moved the firmware and have the codeset file, Reboot before continuing.

Adding the blaster codeset

You will need to determine the codeset of your device. To help you determine the possible codeset, consult the list here: here. Note that finding the correct codeset for your device can be tricky- but the master list can usually help you track them down by process of elimination. Once you have determined a codeset, you need to extract those codes from the master file you downloaded and add them to your /etc/lirc/lircd.conf as another remote. For example, to blast a Power Button a Motorola DCT6200 series cable box, you would use the POWER button raw code from codeset 85. If you are linking it to a key on your remote, you want to change the button name to the name reported by irw.

$ sudo nano /etc/lirc/lircd.conf

First, add the blaster header:

begin remote
name          blaster
bits          32
flags         RAW_CODES
eps           0
aeps          0
plead         0
gap           333333
repeat_bit    0
begin raw_codes

Next, find the power button in codeset 85- since this is a cable box, it is prefixed in the master file as 0_85:

name 0_85_KEY_POWER
5570570

then make it conform to how irw reports the keypress- in this case, irw reports it as POWER, so that is what to name it:

name POWER
5570570

Keep adding your buttons (only the ones you want to control with the blaster). When you are finished, add:

end raw_codes
end remote

to close out that remote definition. In this example, the entire remote definition for the power button only looks like:

begin remote
name          blaster
bits          32
flags         RAW_CODES
eps           0
aeps          0
plead         0
gap           333333
repeat_bit    0
begin raw_codes
name 0_85_KEY_POWER
5570570
end raw_codes
end remote

After saving the new lircd.conf, restart lirc:

$ sudo /etc/init.d/lirc restart

and test it. In the example the command:

$ irsend SEND_ONCE blaster POWEROFF

turns the DCT6200 cable box on and off. Even if it does not control the device as intended, you should see the blaster flashing. Troubleshooting codeset selection, blaster placement, etc. is beyond the scope of this guide. A wealth of information is readily available via Google

MCEUSB2 IR Transmitter

Feisty packages include support for the mceusb2 IR transmitter. Usage is the same as standard serial transmitters. For information on setting up this blaster with a Motorola DCT700 cable box: See Self:Motorola_DCT700_Channel_Change_Script

Serial Receiver / Transmitter

If you are running the lirc_serial driver either for a transmitter or receiver, you will need to disable kernel serial support. There are two ways this can be achieved: Both ways depend on setserial, so install that first

$ sudo apt-get install setserial

First Method

  • Credit to TechnoPenguin & TrubbleMaker from the forums, usring modprobe.conf

This can be achieved by editting /etc/modprobe.conf and adding the following:

alias char-major-61 lirc_serial
options lirc_serial irq=4 io=0x3f8
install lirc_serial /bin/setserial /dev/ttyS0 uart none ;\
/sbin/modprobe --ignore-install lirc_serial

This is for a typical machine using the primary serial port (/dev/ttyS0) and the standard IRQ and IO ports. If you are running on the secondary serial port, replace the device to be /dev/ttyS1 and the appropriate IRQ & IO ports.

Second Method

  • Using the setserial debian configuration
$ sudo dpkg-reconfigure setserial
  • Choose manual
  • Modify /var/lib/setserial/autoserial.conf
    • Add (or modify if its there already) (switch to ttyS1 if your using that instead)
/dev/ttyS0 uart none
  • Copy that script to /etc/serial.conf
$ sudo cp /var/lib/setserial/autoserial.conf /etc/serial.conf

Managed I2C Devices

Ubuntu Edgy introduces support in the kernel to directly manage some remotes via the i2c bus. For remotes like this, the kernel is deprecating the use (and requirement) of lirc. You should be able to press keys on the remote and have them recognized as ordinary keyboard keys. If you don't like the way that the keypresses that are recognized for certain buttons on the remote, their behavior can be changed using Xmodmap. Alternatively, if you would like to still use lirc to manage your i2c device, hexion has written a howto explaining how to install lirc from source and replace the ir_common module in the kernel causing this behavior. See his howto here: HOWTO: Lirc in Edgy.

Rebuild Modules

If you ever need to rebuild your lirc modules for a new kernel version, here are the correct steps to follow:

$ sudo dpkg -r lirc-modules-`uname -r` 
$ sudo rm /usr/src/lirc*deb
$ sudo m-a clean lirc
$ sudo m-a update,prepare
$ sudo m-a a-i lirc
$ sudo depmod -a

You probably want to restart the lirc service afterwards:

$ sudo /etc/init.d/lirc restart