特殊:Badtitle/NS100:Install Lirc Gutsy
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Install_Lirc_Gutsy }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/af | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Afrikaans| [[::Install Lirc Gutsy/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ar | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|العربية| [[::Install Lirc Gutsy/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/az | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|azərbaycanca| [[::Install Lirc Gutsy/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/bcc | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|جهلسری بلوچی| [[::Install Lirc Gutsy/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/bg | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|български| [[::Install Lirc Gutsy/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/br | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|brezhoneg| [[::Install Lirc Gutsy/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ca | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|català| [[::Install Lirc Gutsy/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/cs | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|čeština| [[::Install Lirc Gutsy/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/de | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Deutsch| [[::Install Lirc Gutsy/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/el | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Ελληνικά| [[::Install Lirc Gutsy/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/es | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|español| [[::Install Lirc Gutsy/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/fa | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|فارسی| [[::Install Lirc Gutsy/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/fi | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|suomi| [[::Install Lirc Gutsy/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/fr | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|français| [[::Install Lirc Gutsy/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/gu | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|ગુજરાતી| [[::Install Lirc Gutsy/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/he | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|עברית| [[::Install Lirc Gutsy/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/hu | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|magyar| [[::Install Lirc Gutsy/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/id | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Bahasa Indonesia| [[::Install Lirc Gutsy/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/it | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|italiano| [[::Install Lirc Gutsy/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ja | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|日本語| [[::Install Lirc Gutsy/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ko | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|한국어| [[::Install Lirc Gutsy/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ksh | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Ripoarisch| [[::Install Lirc Gutsy/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/mr | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|मराठी| [[::Install Lirc Gutsy/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ms | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Bahasa Melayu| [[::Install Lirc Gutsy/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/nl | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Nederlands| [[::Install Lirc Gutsy/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/no | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|norsk| [[::Install Lirc Gutsy/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/oc | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|occitan| [[::Install Lirc Gutsy/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/pl | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|polski| [[::Install Lirc Gutsy/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/pt | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|português| [[::Install Lirc Gutsy/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ro | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|română| [[::Install Lirc Gutsy/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/ru | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|русский| [[::Install Lirc Gutsy/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/si | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|සිංහල| [[::Install Lirc Gutsy/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/sq | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|shqip| [[::Install Lirc Gutsy/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/sr | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|српски / srpski| [[::Install Lirc Gutsy/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/sv | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|svenska| [[::Install Lirc Gutsy/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/th | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|ไทย| [[::Install Lirc Gutsy/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/tr | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Türkçe| [[::Install Lirc Gutsy/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/vi | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|Tiếng Việt| [[::Install Lirc Gutsy/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/yue | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|粵語| [[::Install Lirc Gutsy/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/zh | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|中文| [[::Install Lirc Gutsy/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/zh-hans | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|中文(简体)| [[::Install Lirc Gutsy/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Install_Lirc_Gutsy | UbuntuHelp:Install_Lirc_Gutsy | {{#if: | :}}Install Lirc Gutsy}}/zh-hant | • {{#if: UbuntuHelp:Install_Lirc_Gutsy|中文(繁體)| [[::Install Lirc Gutsy/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Install_Lirc_Gutsy|:Install Lirc Gutsy|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Install Lirc Gutsy/zh | | {{#ifexist: Install Lirc Gutsy/zh | | {{#ifeq: {{#titleparts:Install Lirc Gutsy|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Install Lirc Gutsy|1|-1|}} | zh | | }}
Include(Install_Lirc_Header) 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 be adapted to 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. Afterwards, continue on to the setting up multiple devices section.
Setting up a Single Device
Setup Repositories
In order to install lirc, you will need to have universe enabled. See Ubuntu documentation for more information on enabling these repositories.
Install Lirc
You will only need to install lirc once during installation. It can be later reconfigured to choose a different remote control. On a system with a command line only, you can install via:
$ sudo apt-get install lirc
On a system with a GUI, you can install via
$ DEBIAN_FRONTEND=gnome sudo apt-get install lirc
Choose Remote
Depending on whether you had a GUI available to you, you will receive a dialog for that appropriate configuration frontend.
Choose your remote from the list provided upon installation. If your remote is not listed, don't fret, you can still likely get support, but you should file a bug so that it can be fixed for future users. If your remote isn't listed or you are setting up an IR transmitter, choose "None" |
Listed Remote
When using a listed remote, the package will setup the configuration in /etc/lirc/hardware.conf
and /etc/lirc/lircd.conf
for you. You will only need to set up a .lircrc file for any users using the remote.
Unfortunately, as of kernel 2.6.22 (the kernel shipped with Ubuntu 7.10), all GPIO devices don't work using the standard lirc_gpio module. Choose your remote as you normally would, but look at the notes below to complete setup.
Unlisted Remote
For an unlisted remote, you will either have to manually create a lircd.conf or find an existing lircd.conf elsewhere. See the section at the bottom about unlisted remotes.
IR Transmitter
IR Transmitter setup is significantly more complicated to setup than a normal remote. See below for more information on how to configure one.
Test Lirc
If you chose a supported remote during installation, lirc will already be started for you and ready to test.
$ 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
Create a .lircrc file
A .lircrc file stores the mappings for all of your remote buttons to applications for your user name. Each user that will be using the remote will need a .lircrc file in their home directory. There are 4 methods available for generating your .lircrc file.
Mythbuntu Lirc generator
The Mythbuntu Team has developed a python script that will generate a sane remote control mapping to use or at least start from. It grabs all of the possible buttons and remotes from /etc/lirc/lircd.conf
and maps them over for MythTV, Xine, MPlayer, VLC, Totem, & Elisa.
Install the application as follows:
$ sudo apt-get install mythbuntu-lirc-generator
To run, simply run:
$ mythbuntu-lircrc-generator
By default, all 6 application configurations are generated for the currently logged in user. Any old configurations will be renamed.
Web Generator
The web tool LIRC Config creates customized .lircrc files for MythTV, Xine, and Mplayer from a web browser.
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 :)
Standard Method (By hand)
For information on how to manually write a .lircrc file, see the section below.
Drivers needing extra effort
The Gutsy packaging can't currently handle some of the extra work required for some remotes. The parts necessary for these are detailed here.
Serial Receiver
The serial port needs to be disabled from kernel usage so that the lirc_serial can use it. See the discussion in the IR transmitting section for how to do this.
GPIO Devices
Kernel 2.6.22 no longer allows the lirc_gpio driver to be used. Instead all gpio devices will load from the dev/input native lirc driver. See this specification for more information about what needs to be done. https://blueprints.launchpad.net/mythbuntu/+spec/lirc-gpio-alternative
Apple Remote
You will need to find your event device in /dev and set the DEVICE item in /etc/lirc/hardware.conf
IR Transmitting
IR transmitters can be used to control external devices such as cable boxes or television sets. They are very useful in home theatre automation by reducing the number of remotes necessary to control your devices.
Supported Transmitting Devices
The following drivers have support for IR transmission:
- Serial IR Transmitter (Supported by lirc_serial module)
- Command IR Receiver / Quadruple Transmitter (Supported by lirc_cmdir module)
- Microsoft Media Center Remote Version 2 (Supported by lirc_mceusb2 module)
- Hauppauge PVR-150 (Supported by lirc_pvr150 module)
- USB-UIRT (Supported by native lircd binary)
Device Specific Setup
The following section outlines the specifics for setting up the different types of IR transmitters. After preparing the device specific items, proceed on to the general IR transmitter setup.
Serial IR Transmitter
Choose Driver
When installing lirc or reconfiguring it, choose the option for either "Serial Receiver" or "Serial receiver (igor cesko's variant)".
Choose serial port
Depending upon which port you have your serial transmitter attached to, you may have to modify the modprobe options that are used for loading the kernel module.
Create a file entitled /etc/modprobe.d/lirc
with these contents:
#COM1 equivalent, /dev/ttyS0 options lirc_serial irq=4 io=0x3f8 #COM2 equivalent, /dev/ttyS1 #options lirc_serial irq=3 io=0x2f8
Uncomment the appropriate line to represent serial port you have connected your transmitter.
Disable kernel serial support
If you are running the lirc_serial driver either for a transmitter or receiver, you will need to disable kernel serial support.
- First you will need the setserial utility to do this.
$ sudo apt-get install setserial
- Reconfigure setserial
$ 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
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.
MCEUSB2 IR Transmitter
Gutsy packages include support for the mceusb2 IR transmitter. Simply select a Microsoft Media Center (New Version) remote from the list of remotes during lirc installation.
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
General Setup & Usage
After completing the device specific setup for your transmitter, there are multiple steps that must be done for all remotes.
Append lircd.conf
You will need to find (or create) a lircd.conf
that represents the remote that you will be transmitting. Append this remote to your system wide /etc/lirc/lircd.conf
. See the Unlisted Remotes section for more information on obtaining or recording a lircd.conf
Restart Lirc
sudo /etc/init.d/lirc restart
Test transmission
This is the syntax for transmitting is as follows:
irsend -d $LIRCDPROCESS SEND_ONCE $REMOTE $BUTTON
- $LIRCDPROCESS represents the lircd device from /dev that you are using for the transmitting.
- $REMOTE represents the name of your remote as described in your
/etc/lirc/lircd.conf
- $BUTTON represents the button that you are attempting to transmit.
Here is an example:
irsend -d /dev/lircd SEND_ONCE my_favorite_remote power
- This will transmit the power button from your remote entitled my_favorite_remote using the primary lircd process.
If the transmission isn't immediately working, the best method to start diagnosing is via a digital camera. Turn on the digital camera and via it's viewfinder look at the IR LED that you are attempting to transmit from. You should see a momentary bright purplish flash coming from the IR LED whenever you issue a transmit. If you don't see anything, your device is not transmitting.
Unlisted Remotes
If your remote isn't listed in the lirc installation, you should file a bug on Launchpad.
Using a premade lircd.conf
$ wget "<download link>" -O lircd.conf
- For other remotes, a good place to start looking is the Lirc Website Remotes list.
- The online remote configuration tool LIRC Config also maintains a customizable database of lircd.conf's.
Replace /etc/lirc/lircd.conf
with this lircd.conf that you have found:
$ sudo cp <name of downloaded.conf> /etc/lirc
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 intend to record from. Example:
$ sudo modprobe lirc_mceusb2
- 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
- Add the modules for the remote to /etc/lirc/hardware.conf under MODULES==
Additional lircrc information
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
- Creating a standalone file. [ All mythtv buttons will be placed in
~/.mythtv/lircrc
] - Here is an example using a mceusb/mceusb2 remote:
- https://help.ubuntu.com/community/Install_Lirc_Gutsy?action=AttachFile&do=get&target=lircrc.mythtv.mceusb
- Here is an example using a hauppauge remote:
- lircrc.mythtv.hauppauge
- IRexec
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.
Configuring a lircrc by hand
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".
Restarting Lirc
Should you ever need to restart lirc due to adding a remote, or after a suspend or anything like that:
$ sudo /etc/init.d/lirc start
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.
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 than 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.