Le frontend s'installe avec les paquets provenant de deb-multimedia. Ajouter ce dépôt puis installer le paquet mythtv-frontend :

sudo apt install -y mythtv-frontend

Pour que la session graphique se lance automatiquement au démarrage, plusieurs solutions sont disponibles : utiliser un gestionnaire de login graphique type lightdm, xdm, gdm… ou le faire à la main. J'ai, bien sûr, choisi la dernière solution 8-). Cela consiste à démarrer xinit avec le user voulu, c'est un lanceur X exécutant le script ~/.xinitrc qui lance les différentes applications que l'on souhaite. Celui-ci doit être bloquant : tant qu'il ne rend pas la main, X tourne. J'ai choisi le gestionnaire de fenêtre openbox pour sa légèretée.

Pour commencer, supprimer le(s) gestionnaire(s) de login :

sudo apt purge lightdm xdm gdm

Créer un service systemd, celui ci sera en charge de lancer xinit avec le user mythtv au boot :

/etc/systemd/system/xinit-login.service
[Unit]
After=systemd-user-sessions.service lircd.service
 
[Service]
ExecStart=/bin/su mythtv -l -c /usr/bin/xinit
ExecStop=/usr/bin/pkill openbox
 
[Install]
WantedBy=multi-user.target

Prendre en compte le service :

sudo systemctl daemon-reload

Le fichier ~/.xinitrc est un script shell contenant tout les programmes à lancer :

  • chargement de la configuration utilisateur de la carte NVidia
  • gestion du fond d'écran et de l'économiseur d'écran
  • lancement du mapper des touches de télécommande
  • démarrage du frontend mythtv
  • exécution du gestionnaire de fenêtre openbox

J'ai repris celui que j'ai mis en place pour le boot PXE :

~/.xinitrc
# fait disparaitre le curseur
unclutter -idle 0.1 -root -regex -notclass 'Iceweasel|XTerm|Gcalctool|Gthumb' &
 
# charge la configuration utilisateur du driver de carte graphique
nvidia-settings -l
 
# désactive l'extinction automatique de l'écran pour l'économie d'énergie
xset -dpms
 
# écran de veille
xscreensaver &
 
# fond d'écran
xloadimage -onroot -center ~/bg.png
 
# mapping des touches de la télécommande
(sleep 30 ; irexec -d ) &
 
# ftrontend mythtv
mythfrontend -d --noupnp &
 
# gestionnaire de fenêtre
openbox

Installer les packages nécessaires :

sudo apt install -y openbox xloadimage unclutter xscreensaver-gl lirc

L'activer :

sudo systemctl enable xinit-login.service

Le démarrer :

sudo systemctl start xinit-login.service

Pour faire fonctionner Lirc avec mon récepteur infrarouge sur port série, quelques opérations sont à faire. D'abord installer le programme :

sudo apt install -y lirc

Le lancement de lirc s'effectue avec systemd, voici la configuration pour le lancement du démon, la section importante est [modinit] qui permet de libérer le port série et charger le module noyau (cf doc) :

/etc/lirc/lirc_options.conf
[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc0
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/x86_64-linux-gnu/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600
 
[lircmd]
uinput          = False
nodaemon        = False
 
[modinit]
code = setserial /dev/ttyS0 uart none
code1 = /sbin/modprobe serial_ir

Note : en version 9.0 stretch, le module noyau à charger s'appelait lirc_serial.

Le lancement de lircd.service dépends de lircd-setup.service qui se chargera d'exécuter les commandes du bloc modinit :

sudo systemctl start lircd-setup

Puis lancer lircd.service

sudo systemctl start lircd

Vérifier son status :

sudo systemctl status lircd
● lircd.service - Flexible IR remote input/output application support
   Loaded: loaded (/etc/systemd/system/lircd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-03-06 23:06:30 CET; 1h 3min ago
     Docs: man:lircd(8)
           http://lirc.org/html/configure.html
 Main PID: 488 (lircd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/lircd.service
           └─488 /usr/sbin/lircd --nodaemon -l
 
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Notice: /etc/lirc/lircd.conf: DVD: Multiple values for same code: right
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Info: Using remote: Hauppauge.
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Notice: lircd(default) ready, using /var/run/lirc/lircd
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Notice: accepted new client on /var/run/lirc/lircd
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Info: Cannot configure the rc device for /dev/lirc0
Mar 06 23:06:30 mimosa lircd-0.9.4c[488]: Notice: accepted new client on /var/run/lirc/lircd
Mar 06 23:06:33 mimosa lircd[488]: lircd-0.9.4c[488]: Notice: accepted new client on /var/run/lirc/lircd
Mar 06 23:06:33 mimosa lircd-0.9.4c[488]: Notice: accepted new client on /var/run/lirc/lircd
Mar 06 23:06:36 mimosa lircd[488]: lircd-0.9.4c[488]: Notice: accepted new client from 127.0.0.1
Mar 06 23:06:36 mimosa lircd-0.9.4c[488]: Notice: accepted new client from 127.0.0.1
sudo systemctl status lircd-setup
● lircd-setup.service - lircd(8) initialization helper tool
   Loaded: loaded (/lib/systemd/system/lircd-setup.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Tue 2018-03-06 23:06:30 CET; 1h 6min ago
     Docs: man:lircd-setup(8)
  Process: 351 ExecStart=/usr/sbin/lircd-setup (code=exited, status=0/SUCCESS)
 Main PID: 351 (code=exited, status=0/SUCCESS)
 
Mar 06 23:06:28 mimosa systemd[1]: Starting lircd(8) initialization helper tool...
Mar 06 23:06:30 mimosa systemd[1]: Started lircd(8) initialization helper tool.

Le lancement de lircd-setup provoque le chargement des modules lirc_dev et lirc_serial. Les logs du noyaux sont de la forme :

[    9.918060] lirc_dev: IR Remote Control driver registered, major 249
[    9.920592] lirc_serial: module is from the staging directory, the quality is unknown, you have been warned.
[   10.824042] lirc_serial lirc_serial.0: auto-detected active low receiver
[   10.824293] lirc_serial lirc_serial.0: lirc_dev: driver lirc_serial registered at minor = 0

Si les logs noyaux font apparaitre une erreur du type port 03f8 already in use comme ci dessous, il faut vérifier que la commande setserial /dev/ttyS0 uart none fonctionne bien au lancement de lircd comme indiqué dans le fichier /etc/lirc/lirc_options.conf ci-dessus :

[    9.926370] lirc_dev: IR Remote Control driver registered, major 250
[    9.931945] lirc_serial: module is from the staging directory, the quality is unknown, you have been warned.
[    9.938108] lirc_serial lirc_serial.0: port 03f8 already in use
[    9.938179] lirc_serial lirc_serial.0: use 'setserial /dev/ttySX uart none'
[    9.938187] lirc_serial lirc_serial.0: or compile the serial port driver as module and
[    9.938194] lirc_serial lirc_serial.0: make sure this module is loaded first
[    9.938219] lirc_serial: probe of lirc_serial.0 failed with error -16
[    9.944411] platform lirc_serial.0: lirc_dev: driver lirc_serial registered at minor = 0

J'ai également dû modifier les options de lancement du démon lirc pour qu'il écoute sur une socket réseau via l'option -l :

/etc/systemd/system/lircd.service
[Unit]
Documentation=man:lircd(8)
Documentation=http://lirc.org/html/configure.html
Description=Flexible IR remote input/output application support
Wants=lircd-setup.service
After=network.target lircd-setup.service
 
[Service]
Type=simple
ExecStart=/usr/sbin/lircd --nodaemon -l
 
[Install]
WantedBy=multi-user.target

La configuration des clients la suivante :

/home/mythtv/.lircrc
begin
     remote = Hauppauge
     prog = mythtv
     button = Radio
     config = I
end
 
# adjust fill
begin
     remote = Hauppauge
     prog = mythtv
     button = Prev.Ch
     config = W
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Up
     repeat = 3
     config = Up
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Down
     repeat = 3
     config = Down
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Left
     repeat = 3
     config = Left
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Right
     repeat = 3
     config = Right
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Vol+
     repeat = 3
     config = F11
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Vol-
     repeat = 3
     config = F10
end
 
# aspect ratio
begin
     remote = Hauppauge
     prog = mythtv
     button = Asterix
     config = Ctrl+W
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 1
     config = 1  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 2
     config = 2  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 3
     config = 3  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 4
     config = 4  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 5
     config = 5  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 6
     config = 6  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 7
     config = 7  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 8
     config = 8  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = 9
     config = 9  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Back/Exit
     config = Esc
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Menu/i
     config = M  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Play
     repeat = 3
     config = P
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = pause
     repeat = 3
     config = P
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Ch+
# This is the "up" on the central diamond 
     repeat = 3
     config = J
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Ch-
# This is the "down" on the central diamond 
     repeat = 3
     config = U
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Mute
     config = |
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Rewind
# This is the "left" on the central diamond 
     repeat = 3
     config = Left
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Forward
# This is the "right" on the central diamond 
     repeat = 3
     config = Right
end
 
begin
     remote = Hauppauge
     prog = mythtv
# Middle button on the diamond
     button = Ok
     config = Return
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Record
     config = R  
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Stop
     config = Y
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Go
     config = Alt+G
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = TV
     config = Alt+L
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Videos
     config = Alt+T
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Music
     config = Alt+M
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Pictures
     config = Alt+G
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Guide
     config = Alt+P
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Yellow
     config = E
     repeat = 3
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Green
     config = T
     repeat = 3
end
 
begin
     remote = Hauppauge
     prog = mythtv
     button = Blue 
     repeat = 3
     config = PgDown
end
 
###########################################
# irexec
###########################################
 
begin
     remote = Hauppauge
     prog = irexec
     button = Power
     repeat = 3
     config = sudo halt
end
 
begin                  
     remote = Hauppauge
     prog = irexec
     button = Red
     repeat = 3
     config = killall /usr/bin/mythfrontend
end
  • realisations/mythtv/debian.txt
  • Dernière modification: 2021/05/16 19:12
  • (modification externe)