1

I'm using a Pi 3B as an IR transceiver, using the general approach described by this article.

I found that Raspbian kernel 4.19 and beyond have changed lirc. I followed the guidance in this article to make necessary changes.

Specifically: Changing dtoverlay in /boot/config.txt to:

dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17

Apparently this configuration can only send or receive at any time.

Receive configuration of /etc/lirc/lirc_options.conf:

[lircd]
nodaemon        = False
driver          = default
device          = lirc1

Transmit configuration of /etc/lirc/lirc_options.conf:

[lircd]
nodaemon        = False
driver          = default
device          = lirc0

Necessary to restart lirc to change from transmit to receive:

sudo /etc/init.d/lircd stop
sudo /etc/init.d/lircd start

It appears to work normally in receive mode (run mode2, press key on remote)

$ sudo mode2 -d /dev/lirc1      Using driver default on device /dev/lirc1
Trying device: /dev/lirc1
Using device: /dev/lirc1
Running as regular user pi
pulse 906
space 887
pulse 890
space 886
pulse 890
....
^C
$

Transmit mode with device lirc0 does not work initially:

 $ irsend SEND_ONCE PHILIPS_CD KEY_OPEN

hardware does not support sending
Error running command: Input/output error

The last post in this thread provides a working solution -- start the LIRC daemon with this command:

sudo lircd --device /dev/lirc0

Since lircd is already started by the installation of lirc (sudo apt-get install lirc), I first have to run

sudo pkill -SIGTERM  lircd

to kill the instance already running.

Once I run those commands, irsend works correctly:

$ sudo pkill -SIGTERM  lircd
$ sudo lircd --device /dev/lirc0
$ irsend SEND_ONCE PHILIPS_CD KEY_OPEN
$

My question is how can I correct the init.d lircd configuration so the system boots in a usable state? e.g. allowing irsend to function.

The "start" section of the file "lircd" in /etc/init.d looks like this:

case "$1" in
        start)
                # start lircd
                [ -d "/run/lirc" ] || mkdir -p "/run/lirc"

                log_daemon_msg "Starting remote control daemon" "LIRCD"
                start-stop-daemon --start --quiet --oknodo \
                        --exec /usr/sbin/lircd -- < /dev/null
                log_end_msg $?

                # retain compatibility with old clients
                ln -fs /run/lirc/lircd /dev/lircd
                ;;
        stop)

I'm not experienced in init.d. and it is not clear where I would use the shell command "sudo lircd --device /dev/lirc0" in this file. Can anyone provide guidance on how this could be edited to start the daemon with the required parameters that allow irsend to function?

1

4 Answers 4

2

I had lirc working on over a dozen Pi-zero systems that I shipped with IR remotes. Then raspbian with kernel 4.19 was released, and I spent over a month trying to get lirc to work with it - Impossible. Finally, I went back to the 4.14 kernel and lircd-0.9.4c and it took about 30 minutes to get everything configured and working perfectly.

You are not alone; several people have even posted patches for Buster to get lirc working again. For example: https://gist.github.com/billpatrianakos/cb72e984d4730043fe79cbe5fc8f7941

Sorry I cannot be more optimistic, but if your time is worth anything and you don't need some bleeding edge feature, you might consider rolling back to something that is known to work reliably.

1

dtoverlay=gpio-ir-tx,gpio_pin=17

dtoverlay=gpio-ir,gpio_pin=18

After a lot of issues in trying to get LIRC installed on a Buster version of Rasbian, I finally figured out that the order in which you put thoses lines in the config.txt is VERY important. I had the tx-pin second and that didn't work until i moved it tot he first place!!!

Hope this saves somebody time :-)

1
  • Tried this, but it didn't seem to work :-(
    – topherg
    Commented Apr 30, 2021 at 9:05
1

There is a hidden gem in the github bug report that has a workaround for lirc not being able to send AND receive. You can revert back to a previous kernel (4.14.y), but still be running the newer Bullseye OS.

https://github.com/raspberrypi/linux/issues/2993#issuecomment-497420593

This solved the lirc problem and I was able to continue to use the new OS with new python version needed for another project. There may be a compromise that I am unaware of, but for my use case it was a win-win. I'm running a very simple, lite, headless system that provides a web server, bluetooth, lirc and a serial port. If you are running a more complex configuration (desktop, audio, video, etc), I'd recommend you back up your system before trying this option.

To downgrade your kernel to 4.14.y run:

 sudo rpi-update c30ae2bb624f7fd60fcbedff950cc4361c8d2aec

In /boot/config.txt you'll need to use the old Stretch format overlay (with your pin assignments), ie:

dtoverlay=lirc-rpi,gpio_in_pin=17,gpio_out_pin=22

and in /etc/lirc_options.conf the device line is:

...
device = /dev/lirc0
...
4
  • Very worth noting that reverting the kernel that far may easily create complications for people depending on model, what else they are using the Pi for, etc., even if nothing has bitten you (yet).
    – goldilocks
    Commented May 14 at 16:55
  • It was noted in my answer ... There may be a compromise that I am unaware of...
    – Ken H
    Commented May 14 at 17:14
  • Yes, and worth emphasizing.
    – goldilocks
    Commented May 14 at 17:41
  • The bold is a good idea. Thank you.
    – Ken H
    Commented May 14 at 18:05
0

Try reading the documentation

Name:   lirc-rpi
Info:   This overlay has been deprecated and removed - see gpio-ir
Load:   <Deprecated>

Following 4 year old posts for obsolete OS is a waste of time.

3
  • I tried that route with gpio-ir, and wasn't able to get it to work either. My thread on that topic: raspberrypi.org/forums/…
    – tim11g
    Commented Feb 3, 2020 at 19:54
  • I went back to kernel 4.19, and using gpio-ir and gpio-ir-tx overlays. Reproducing steps taken on the 4.15 kernel, I was able to get back to the same point, with the exact same result. The question above has been edited to reflect kernel 4.19 and gpio-ir and gpio-ir-tx overlays.
    – tim11g
    Commented Feb 4, 2020 at 2:37
  • @tim11g Unfortunately I can't help with detail, as I don't currently use lirc. If you still using old SysV tutorials it is never going to work. raspberrypi.stackexchange.com/a/81885/8697 may help.
    – Milliways
    Commented Feb 4, 2020 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.