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?

tim11g
  • 301
  • 3
  • 13

4 Answers4

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

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
...
Ken H
  • 151
  • 1
  • 7
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.

Milliways
  • 62,573
  • 32
  • 113
  • 225