[mythtv-users] lirc woes with serial_ir kernel module

Stephen Worthington stephen_agent at jsw.gen.nz
Fri Jun 2 05:52:59 UTC 2017


On Thu, 1 Jun 2017 17:19:51 -0500, you wrote:

>At some point Fedora dropped the lirc_serial module in favor of the
>serial_ir module and while I can make it work, I haven't found the right
>incantation to make it work on boot without manual intervention.
>
>My initial attempts were to update /etc/modprobe.d/lirc.conf to:
>
># Lirc module settings, /dev/ttyS0
>options serial_ir type=0 irq=4 io=0x3f8
>
>Unfortuantely it won't work properly on boot because "setserial /dev/ttyS0
>uart none" needs to be run first, otherwise you get:
>
># dmesg | grep serial_ir
>[    1.730353] serial_ir serial_ir.0: port 03f8 already in use
>[    1.730399] serial_ir serial_ir.0: use 'setserial /dev/ttySX uart none'
>[    1.730400] serial_ir serial_ir.0: or compile the serial port driver as
>module and
>[    1.730401] serial_ir serial_ir.0: make sure this module is loaded first
>[    1.730412] serial_ir: probe of serial_ir.0 failed with error -16
>
>I tried adding the setserial command to /etc/sysconfig/modules but I'm
>guessing it doesn't run early enough in the process (I assume the serial_ir
>module is loaded from the initrd before setserial is even available).
>
>I've also tried using the code lines for lirc in lirc_options.conf to
>replicate the needed order but it doesn't seem to actually get run:
>
>[modinit]
>code1 = /usr/sbin/rmmod serial_ir
>code1 = /usr/bin/setserial /dev/ttyS0 uart none
>code2 = /usr/sbin/modprobe serial_ir
>
>So now every time I reboot my frontend I have to manually perform the above
>commands prior to starting lircd or I don't get a working remote.
>
>Any ideas?
>
>Thanks,
>Richard

You probably need to be doing things with the systemd unit that starts
lirc.  That allows you to run things before lirc is started.  I do not
know Fedora at all, but in Mythbuntu 16.04, you create override files
in a subdirectory of /etc/systemd/system to alter the builtin systemd
units.  So if the unit for starting lirc is lirc.system, then you
would create a subdirectory lirc.service.d and any *.conf files in
that directory would be read in and used to override the settings in
the main lirc.service file.  Here is an example of what I do to
override the standard mythtv-backend.service file:

root at mypvr:/etc/systemd/system/mythtv-backend.service.d# cat
mythtv-backend-override.conf
[Unit]

Wants=mysql.service
After=mysql.service

Wants=dev-dvb-adapter0-frontend0.device
After=dev-dvb-adapter0-frontend0.device
Wants=dev-dvb-adapter1-frontend0.device
After=dev-dvb-adapter1-frontend0.device
Wants=dev-dvb-adapter2-frontend0.device
After=dev-dvb-adapter2-frontend0.device
Wants=dev-dvb-adapter3-frontend0.device
After=dev-dvb-adapter3-frontend0.device

Wants=mnt-rec1.mount
After=mnt-rec1.mount
Wants=mnt-rec2.mount
After=mnt-rec2.mount
Wants=mnt-rec3.mount
After=mnt-rec3.mount
Wants=mnt-rec4.mount
After=mnt-rec4.mount
Wants=mnt-rec5.mount
After=mnt-rec5.mount
Wants=mnt-rec6.mount
After=mnt-rec6.mount
Wants=mnt-rec7.mount
#After=mnt-rec7.mount

Wants=mnt-vid1.mount
Wants=mnt-vid2.mount
Wants=mnt-vid3.mount

Wants=minisatip.service
After=minisatip.service

[Service]
ExecStartPre=-/bin/bash /usr/local/bin/rm.test
StartLimitBurst=10
StartLimitInterval=10s
SendSIGKILL=yes
TimeoutStopSec=10


I think what you would need to do is create a bash script like my
rm.test script and run it from an ExecStartPre line as I am doing.


More information about the mythtv-users mailing list