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.

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 vous devrez sélectionner votre type de périphérique IR.

sudo dpkg-reconfigure lirc-modules-source
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 (→)
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électionnez i2c et PVR150
(Haut/bas pour naviguer; barre espace pour sélectionner; tabulation pour "<OK>")
Le script vous proposé de compilé automatiquement les modules. Sélectionner non.
Vous avez maintenant différente option pour remplacer le fichier lirc-modules-source.conf. Sélectionner Installer la version du responsable du paquet.

Modification /etc/lirc/hardware.conf

Éditez le fichier /etc/lirc/hardware.conf.

Jonas : Le fichier n'existait pas quand quand j'ai voulu l'éditer. J'ai alors lancé lircd dans un consoles, puis je l'ai killer.
  • Modifiez LOAD_MODULES=false en LOAD_MODULES=true.
  • Ajoutez votre modules dans MODULES="". Le nom de votre modules est le nom du modules que vous avez sélectionner précédemment précédé du préfixe. Par exemple pour le pilotesmceusb : "lirc_mceusb".
  • Pour les récepteurs des carte PVR-150 les configurations sont :
LIRCD_ARGS="--device=/dev/lirc0" 
LOAD_MODULES=true
MODULES="lirc_dev lirc_pvr150"

lirc - exemples "hardware.conf"

Compilation des modules lirc

Les modules lirc on besoin d'être recomplilé à chaque fois que vous mettez à jours le kernel.

FIXME traduction !!! C'est automatique ou pas ?

Just follow these build steps every time you boot into a newer kernel for the first time.

FIXME This step will grab the necessary headers to build the kernel modules:

sudo m-a update,prepare

Nétoyez toutes ancienne trace du module lirc

sudo rm /usr/src/lirc*deb
sudo m-a clean lirc

Compilez et installer les modules du kernel

sudo m-a a-i lirc

Mettez à jours la liste des modules

sudo depmod -a

Création du lircd.conf

Le fichier lircd.conf liste les correspondances entre le signal IR et la fonction de la touche. Il existe deux options pour créer le fichier lircd.conf.

  • Trouver un fichier déjà fait pour votre télécommande.
  • Créer votre propre fichier

Utilisation d'un fichier lircd.conf existant

Si vous avez trouver un fichier de configuration sauter la section suivante.

Créer son fichier lircd.conf

FIXME à complèter/vérifier avec attention

Vous souhaitez créer votre propre fichier lircd.conf on vous n'avez pas trouver de fichier déjà fait. Vous pouvez utilisez irrecord

Insérez le modules que vous venez de compiler.

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

Exemple:

sudo modprobe lirc_mceusb

S'il il y a une erreur c'est certainement dût au "m-a ignored the special i2c module". Forcez le et réessayez la commande modprobe.

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
sudo modprobe lirc_mceusb

"Enregistrer" votre Télécommande.

sudo irrecord -d /dev/lirc0 lircd.conf

Une fois la configuration faites, déplacez votre fichier dans /etc/lirc/lircd.conf.

sudo mv lircd.conf /etc/lirc

Démarrage de Lirc et teste

Les modules sont charger au démarage de lirc. S'il n'est pas encore chargé

The modules will load when you start lirc, if they aren't already loaded.
sudo /etc/init.d/lirc start
irw

Le terminal "FIXME attend" (il ne retourne pas a la ligne de commande). Appuyez sur les touches de votre télécomande et vous devriez voir le terminal les affichée. Pour quitter pressez <ctrl> + 'C'.
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.

Si irw "FIXME retourne immédiatement et que vous pouvey retaper une commande c'est que le module ne c'est pas bien chargé. Essayer de redémarrer votre ordinateur. Si ça ne fonctionne toujours pas, regardez si le modules c'est bien charger avec la commande dmesg | grep lirc.

Si vous avez :

sweet_user_name@ubuntu:~$ sudo /etc/init.d/lirc start
Password:
##################################################
## LIRC IS NOT CONFIGURED ##
## ##
## read /usr/share/doc/lirc/html/configure.html ##
##################################################

C'est que vous n'avez pas bien créer votre lircd.conf. Retounez à la section [#creation du lircd.conf].

Création du fichier .lircrc

Métode standard

Le fichier .lircrc indique quel est l'action les boutons déclanche.

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.

La syntaxe basic est

begin
    prog = PROGRAME
    button = BOUTONS
    config = ACTION
end

Où :

  • PROGRAME Est le programe qui va utiliser ce boutons, par exemple : PROGRAME sera 'mythtv', 'mplayer', 'xine', 'vlc', ou 'irexec'.
  • BOUTONS est le nom du boutons qui se trouve dans /etc/lirc/lircd.conf.
  • ACTION est l'action qui sera lancer quand on presse sur le boutons. Vous pourrez trouver des fichier d'exemple dans tutorial qui a servis de base pour cette page.

Méthode alternative - IRKick

Si vous utilisez KDE vous pouvez vous servir des fonctionnalitée de 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.

Installez les paquets 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 :)

Note par des applications spécifique utilissant lirc

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.

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.

Information additionnel

Ces pilotes supporte : * 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.

Si vous utilisez le pilote lirc_serial vous devez désactivé le support série du kernel.

Commencer parInstallez le paquet setserial.

Ensuite vous pouvez utilisé 2 métodes différentes. (jonas j'ai utilisé la seconde qui semble plus simple et qui a fonctionné).

1ère méthodz

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

2ème méthode

Utilisation de la configuration debian de setserial

sudo dpkg-reconfigure setserial
* Choisissez "manuel"
* [[:tutoriel:comment_editer_un_fichier|Modifiez]] **/var/lib/setserial/autoserial.conf**.
 * Ajoutez (ou modifiez si les ligne sont déjà présente) (metter ttyS1 si vous utilise le 2ème port)
/dev/ttyS0 uart none
* Copier ce script dans ''/etc/serial.conf''
sudo cp /var/lib/setserial/autoserial.conf /etc/serial.conf

Reconstruction du modules

Si vous avez besoin de recompiler le module (après une mise à jours du kernel) il suffira de taper les ligne suivante :

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 Method

Et vous aurez certainement besoin de rédémarrer lirc

sudo /etc/init.d/lirc restart

Liens

  • lirc_brouillon.1183917641.txt.gz
  • Dernière modification: Le 08/07/2007, 23:09
  • (modification externe)