Mailing List Archive

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.

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:

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

Sorry, no. But, after wasting way to many hours debugging similar issues when rebuilding my frontends, I switched to a “Flirc” IR receiver. You basically configure the USB device to emit the right keycodes for your IR signals, and have zero dependency on lirc, linux kernel, or mythtv config. If I ever rebuild/replace a frontend, I have no issues, the config is persisted in the Flirc device, no re-config needed just plug in the usb device and I’m done.

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

Hmpf... if the commands above does not run it should be easy to debug:

- lircd.service wants the one-shot lircd-setup.service. 'systemctl status lircd-setup.service' reveals last time lircd-setup.service ran. - lircd-setup.service could be run manually as a test: sudo systemctl start lircd-setuo.service - lircd-setup.service just runs the /usr/sbin/lircd-setup script. This can also be run manually without any command line options. - Adding a code line like '/bin/sh -c "date > /tmp/code3.log"' should put a simple log mark when lircd-setup runs. Or use logger(1).

On 01/06/17 23:19, Richard Shaw 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). >

There is an `install` option you can use in the modprobe configuration which allows you to specify what to run.

In this case you could use it to first run setserial, and then modprobe serial_ir

On 02/06/17 11:56, Stuart Auchterlonie wrote: > On 01/06/17 23:19, Richard Shaw 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). >> > > There is an `install` option you can use in the modprobe configuration > which allows you to specify what to run. > > In this case you could use it to first run setserial, and then modprobe > serial_ir > > see `man modprobe.conf` for details >

Oh and you probably need to rebuild your initrd as there is some modprobe work done in the initrd (primarily for storage drivers etc)

# cat /etc/lirc/lirc_options.conf # These are the default options to lircd, if installed as # /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8) # manpages for info on the different options. # # Some tools including mode2 and irw uses values such as # driver, device, plugindir and loglevel as fallback values # in not defined elsewhere.

On 02/06/17 18:37, Hika van den Hoven wrote: _______ > > Why not instead of failing, taking the first or last occurrence and > adding a message to the log "Ignoring second occurrence of ....". It's > more friendly by not failing and still clear.

Partly because this is using the standard python ConfigParser which doesn't easily lend itself to such things.

And partly because trying to understand the user's intent in cases like this too easily leads to madness. There are reasons compilers fails even for simple errors like a missing semicolon rather then trying to guess what should be there.

The patch I just checked in generates the correct error message: "while reading from 'foo.conf' [line 34]: option 'code1' in section 'modinit' already exists". IMHO, this is the proper fix. The message is generated by ConfigParser, so it's not only for this case.