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
  • 257
  • 3
  • 11
  • Try this: https://raspberrypi.stackexchange.com/questions/103452/rpi3-lirc-library-and-uart-ir-transceiver-setup-problem/103465#103465 – tlfong01 Feb 03 '20 at 01:44

3 Answers3

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

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
  • 54,718
  • 26
  • 92
  • 182
  • I tried that route with gpio-ir, and wasn't able to get it to work either. My thread on that topic: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=263689&p=1605231#p1605231 – tim11g Feb 03 '20 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 Feb 04 '20 at 02: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. https://raspberrypi.stackexchange.com/a/81885/8697 may help. – Milliways Feb 04 '20 at 03:19