Cette page n'a pas encore d'étiquettes.
Apportez votre aide…

Ceci est une ancienne révision du document !


Traduction en cours

Lirc - installation & maintenance

Cette page est largement basé sur le tutorial "Lirc Installation & Maintenance" provenant de la documentation anglophone d'ubuntu.

Lirc permet d'utiliser une télécommande infrarouge. Presque (mais pas toutes) sont compatibles.

FIXME à traduire

LIRC has improved in Ubuntu 6.10 over how it was in Ubuntu 6.06.
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 an IR transmitter and a receivers, multiple transmitters, or multiple receivers, set up a Single Device and verify functionality. Afterwords, continue on to the setting up multiple devices section.

Ce tutorial explique comment configurer lirc avec le pilote "lirc_mceusb". C'est un exemple, si vous souhaiter utiliser lirc avec un autre type de récépteur, vous devrez le compiler avec un autre pilotes (vous trouverez des informations complémentaire en bas de cette page).

Avant de commencer l'installation assurer vous que les dépots universe, multiverse et backports sont activé (voir la page dépots).

Commencer par Installez les paquets lirc lirc-modules-source module-assistant.

sudo apt-get install lirc lirc-modules-source module-assistant
1) Certaine télécommande sont directement supporter par le kernel voir FIXME Managed I2C Devices. 2) Pour les récepteurs des carte hauppage PVR-150 voir FIXME PVR-150

Configuration lirc-modules-source

Durant la configuration sélectionnez votre type de périphérique IR.

sudo dpkg-reconfigure lirc-modules-source

FIXME, j'ai fait les catures d'écran, mais pas encore envoyer

Informations diverses sur les périphériques IR supporté. (Flêche haut/bas pour faire défilé).
Sélectionner OK grâce à la touche de tabulation (→)
FIXME image
Sélectionnez le/les module(s) que vous souhaitez configurer. Pour certain modules consultez les informations supplémentaires (comme pour les récepteurs sur port série et les FIXME ??? adaptateur port série ???).
Pour les PVR-150 séléctionnez i2c et PVR150
(Haut/bas pour naviguer; barre espace pour sélectionner; tabulation pour "<OK>")
FIXME image
Le script vous proposé de compilé automatiquement les modules. Sélectionner non.FIXME image
Vous avez maintenant différente option pour remplacer le fichier lirc-modules-source.conf. Sélectionner Installer la version du responsable du paquet.FIXME image
je continue plus tard ;)

Modify /etc/lirc/hardware.conf

Modify /etc/lirc/hardware.conf. hardware.conf}

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_'. So for the mceusb driver, this would be 'lirc_mceusb'. BRBR'PVR-150 on-card blaster' settings are: LIRCD_ARGS="–device=/dev/lirc0" BRLOAD_MODULES=true BRMODULES="lirc_dev lirc_pvr150" attachment:hardware.png

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 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

Find a lircd.conf used to represent the remote you will be using or emulating. * A good place to start looking is the [http://lirc.sourceforge.net/remotes/ Lirc Website Remotes list].

* If you are using a MCEUSB or MCEUSB2 based remote, here is a lircd.conf for your remote:

  • attachment:lircd.conf.mceusb

* If you are using a hauppauge remote with the i2c driver ('including PVR-150 blaster'), here is a lircd.conf for your remote:

  • attachment:lircd.conf.hauppauge

Replace lircd.conf} with this lircd.conf that you have found:

}

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 this fails, 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.

if you get: lirc_start_password} 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

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.
  • Here is the example lircrc taylored for several apps on a mceusb/mceusb2 remote:
  • attachment:lircrc.mceusb
 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 taylored for mythtv only on a hauppauge remote:
 * attachment:lircrc.hauppauge

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 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 ]

lircrc}

  • Creating a standalone file. [ All mythtv buttons will be placed in lircrc} ]
  • Here is an example using a mceusb/mceusb2 remote:
    • attachment:lircrc.mythtv.mceusb
  • Here is an example using a hauppauge remote:

* 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.

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.

lirc_deb}

Modify Init Scripts

* Modify 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

8765}

* Modify lirc}

  • Change this block:

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 hardware.conf} and lirc} to connect to the main lirc process.

Test

* 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

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: [http://www.ubuntuforums.org/showthread.php?t=288229 HOWTO: Lirc in Edgy].

PVR-150 IR Transmitter

Packages

The PVR-150 IR Transmitter requires patches that have not yet been included in the upstream LIRC tree. These are packages hosted by me (Mario Limonciello superm1@ubuntu.com) that haven't been included in Edgy or Feisty yet.

  • Add the following to the bottom of /etc/apt/sources.list:

}

* Add the public key that I sign the packages with to apt-key.

{{{

wget http://people.atrpms.net/~mlimonciello/personal/80DF6D58.gpg -O- | sudo apt-key add - }}}

* Update Your modules list

{{{

sudo apt-get update }}} * Install lirc as described above. Be sure to choose the lirc_i2c and lirc_pvr150 modules when building. [https://help.ubuntu.com/community/Install_Lirc_Edgy#head-a1dba57858ffd46f283504b106d6d355794890bc above]

PVR-150 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 [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.

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: [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.

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.

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: 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 [http://www.google.com Google]

MCEUSB2 IR Transmitter

Packages included in edgy-backports include support for the mceusb2 IR transmitter. Configuration is the same as standard serial transmitters.

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)

ttys0_uart_none}

  • Copy that script to /etc/serial.conf

serial.conf}

= Rebuild Modules = If you ever need to rebuild your lirc modules for a new kernel version, here are the correct steps to follow: 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: lirc_restart}

  • lirc_brouillon.1183908124.txt.gz
  • Dernière modification: Le 08/07/2007, 20:00
  • (modification externe)