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?