Kernel 4.19 does not include lirc_dev, so it is recommended to use gpio-ir.
https://lb.raspberrypi.org/forums/viewt ... 1&start=50
However, the command "irrecord" included in lirc does not work with gpio-ir
because the signal from /dev/lircX generated by gpio-ir is
slightly different from that of lirc_dev as follows:
lirc_dev:
Code: Select all
space XXX
pluse XXX
space XXX
...
space XXX
pulse XXX
gpio-ir:
Code: Select all
space XXX
space XXX
pulse XXX
space XXX
...
space XXX
pulse XXX
pulse XXX <- This shuold be "timeout"
Therefore, I created a patch to use irrecord with kernel 4.19.X and gpio-ir.
I also modified mode2 so that it yields the same signal as "ir-ctl -r". Instructions are shown below.
If you use "irrecord", "mode2", "irw", or "irexec" that receive IR signals, the building of patched sources shown below is required.
If you use only "irsend" that sends IR signals, the building is not required, so please install lirc with apt, and go the "After installing" section.
If your are using Raspbian Buster, the initial install will fail. It will success when you re-try the install after following "After installing" section.
Before installing:
Code: Select all
sudo su -c "grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/g' > /etc/apt/sources.list.d/deb-src.list"
sudo apt update
sudo apt install devscripts
Code: Select all
sudo apt remove lirc liblirc0 liblirc-client0
Installing with a patch for gpio-ir in Raspbian Stretch:
Code: Select all
sudo apt build-dep lirc
mkdir build
cd build
apt source lirc
wget https://raw.githubusercontent.com/neuralassembly/raspi/master/lirc-gpio-ir.patch
patch -p0 -i lirc-gpio-ir.patch
cd lirc-0.9.4c
debuild -uc -us -b
cd ..
sudo apt install ./liblirc0_0.9.4c-9_armhf.deb ./liblirc-client0_0.9.4c-9_armhf.deb ./lirc_0.9.4c-9_armhf.deb
Installing with a patch for gpio-ir in Raspbian Buster:
Code: Select all
sudo apt install dh-exec doxygen expect libasound2-dev libftdi1-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libusb-dev man2html-base portaudio19-dev socat xsltproc python3-yaml dh-python libx11-dev python3-dev python3-setuptools
mkdir build
cd build
apt source lirc
wget https://raw.githubusercontent.com/neuralassembly/raspi/master/lirc-gpio-ir-0.10.patch
patch -p0 -i lirc-gpio-ir-0.10.patch
cd lirc-0.10.1
debuild -uc -us -b
cd ..
sudo apt install ./liblirc0_0.10.1-6.2~deb10u1_armhf.deb ./liblircclient0_0.10.1-6.2~deb10u1_armhf.deb ./lirc_0.10.1-6.2~deb10u1_armhf.deb
After installing:
Please add the following lines to /boot/config.txt. You can change pin numbers.
Code: Select all
dtoverlay=gpio-ir,gpio_pin=24
dtoverlay=gpio-ir-tx,gpio_pin=25
If you do not use devinput, please execute the following command.
Code: Select all
sudo mv /etc/lirc/lircd.conf.d/devinput.lircd.conf /etc/lirc/lircd.conf.d/devinput.lircd.conf.dist
Then, please edit /etc/lirc/lirc_options.conf as follows. Restarting lirc is required. Examples of commands are: "irrecord -n", "mode2", "irw", and "irexec". Please note that there is no need to add "-d" option with the configuration below.
Code: Select all
driver = default
device = /dev/lirc1
When using irsend, please edit /etc/lirc/lirc_options.conf as follows. Restarting lirc is required. A example of commands is: "irsend SEND_ONCE TV power". Please note that there is no need to add "-d" option with the configuration below.
Code: Select all
driver = default
device = /dev/lirc0
Notice on lirc with Python3:
Lirc 0.10 installed in Raspbian Buster includes python3 module.
However, the new module has different API from that of previous python3-lirc.
The new API is shown in the following URL.
http://www.lirc.org/api-docs/html/group ... dings.html
So you have to modify your python3 script.
Notices on kernel:
When using irsend, you cannot send an IR sequcence that has more than 256 pulse/spaces because of the following limit defined in the kernel 4.19 (https://github.com/raspberrypi/linux/bl ... lirc_dev.c).
Code: Select all
#define LIRCBUF_SIZE 256
This limit does not exist in the previous kernel 4.14. LIRCBUF_SIZE would be increased to 1024 later by the kernel maintainer.
Moreover, you cannot send a sequence whose duration exceeds 500ms because of the following limit defined in the kernel (https://github.com/raspberrypi/linux/bl ... /rc-core.h).
Code: Select all
#define IR_MAX_DURATION 500000000 /* 500 ms */
This limit exists also in the previous kernel 4.14.
For example, the remote controller of my air conditioner has IR sequences with 439 pulse/spaces with a duration about 250[ms].
This signal exceeds the above LIRCBUF_SIZE, so it cannot be sent with kernel 4.19. It is also found that the limit of IR_MAX_DURATION is somewhat moderate.