Hints about using recent lirc

Contents: [Dobrica Pavlinušić's random unstructured stuff]
• Dobrica Pavlinušić's random unstructured stuff (ir‑ctl) 
• Dobrica Pavlinušić's random unstructured stuff (install) 
• Dobrica Pavlinušić's random unstructured stuff (sniff) 
• Dobrica Pavlinušić's random unstructured stuff (gpio‑ir‑tx) 
• Dobrica Pavlinušić's random unstructured stuff (device tree) 
• Dobrica Pavlinušić's random unstructured stuff (RaspberryPi) 

ir‑ctl
install
# apt install v4l-utils

root@nuc2:~# ir-ctl --features
Receive features /dev/lirc0:
 - Device can receive raw IR
 - Set receive carrier
 - Can set recording timeout min:100000 microseconds max:1000000 microseconds
Send features /dev/lirc0:
 - Device can send raw IR
 - Set carrier
 - Set duty cycle

sniff
root@nuc2:~# ir-ctl -r -m -v

gpio‑ir‑tx
send IR signals using GPIO on cubieboard 
device tree
https://github.com/dpavlin/linux‑gpio‑pinout/blob/master/device‑tree/gpio‑ir‑tx.dts 
/*
 * add gpio-ir-tx to enable ir send on sunxi
 * for RM Mini 3 IR board connected to pins
 */

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun50i-a64", "allwinner,sun50i-h5";

        /* Documentation/devicetree/bindings/leds/irled/gpio-ir-tx.txt */
        fragment@0 {
                target-path = "/";

                __overlay__ {
                        irled@0 {
                                compatible = "gpio-ir-tx";
                                gpios = <&pio 1 10 0>; /* PB10 GPIO_ACTIVE_HIGH */
                        };

                };
        };
};

root@cubieboard:~# modinfo gpio-ir-tx
filename:       /lib/modules/4.19.44-sunxi/kernel/drivers/media/rc/gpio-ir-tx.ko
license:        GPL
author:         Sean Young <sean@mess.org>
description:    GPIO IR Bit Banging Transmitter
alias:          of:N*T*Cgpio-ir-txC*
alias:          of:N*T*Cgpio-ir-tx
depends:        
intree:         Y
name:           gpio_ir_tx
vermagic:       4.19.44-sunxi SMP mod_unload ARMv7 thumb2 p2v8 

root@cubieboard:/home/dpavlin/linux-gpio-pinout# armbian-add-overlay device-tree/gpio-ir-tx.dts
Compiling the overlay
Copying the compiled overlay file to /boot/overlay-user/
Reboot is required to apply the changes

root@cubieboard:/home/dpavlin/linux-gpio-pinout# ./overlay-load.sh /boot/overlay-user/gpio-ir-tx.dtbo
+ dtb=/boot/overlay-user/gpio-ir-tx.dtbo
+ test -f /boot/overlay-user/gpio-ir-tx.dtbo
+ + awkmount { print $3 }
 -t configfs
+ config=/sys/kernel/config
+ basename /boot/overlay-user/gpio-ir-tx.dtbo
+ name=gpio-ir-tx.dtbo
+ dir=/sys/kernel/config/device-tree/overlays/gpio-ir-tx.dtbo
+ test -d /sys/kernel/config/device-tree/overlays/gpio-ir-tx.dtbo
+ mkdir /sys/kernel/config/device-tree/overlays/gpio-ir-tx.dtbo
+ cat /boot/overlay-user/gpio-ir-tx.dtbo
+ cat /sys/kernel/config/device-tree/overlays/gpio-ir-tx.dtbo/status
applied
root@cubieboard:/home/dpavlin/linux-gpio-pinout# [Sun Jun  2 19:51:10 2019] rc rc1: GPIO IR Bit Banging Transmitter as /devices/platform/irled@0/rc/rc1
[Sun Jun  2 19:51:10 2019] rc rc1: lirc_dev: driver gpio-ir-tx registered at minor = 1, no receiver, raw IR transmitter
[Sun Jun  2 19:51:10 2019] rc rc1: GPIO IR Bit Banging Transmitter as /devices/platform/irled@0/rc/rc1
[Sun Jun  2 19:51:10 2019] rc rc1: lirc_dev: driver gpio-ir-tx registered at minor = 1, no receiver, raw IR transmitter

root@cubieboard:~# apt-get install v4l-utils # to get ir-ctl

root@cubieboard:~# ir-ctl --device /dev/lirc1 --features
Receive features /dev/lirc1:
 - Device cannot receive
Send features /dev/lirc1:
 - Device can send raw IR
 - Set carrier
 - Set duty cycle

diff --git a/lirc/lirc_options.conf b/lirc/lirc_options.conf
index d6ddfcf..d5a6648 100644
--- a/lirc/lirc_options.conf
+++ b/lirc/lirc_options.conf
@@ -8,8 +8,8 @@
 
 [lircd]
 nodaemon        = False
-driver          = devinput
-device          = auto
+driver          = default
+device          = /dev/lirc0
 output          = /var/run/lirc/lircd
 pidfile         = /var/run/lirc/lircd.pid
 plugindir       = /usr/lib/arm-linux-gnueabihf/lirc/plugins

root@cubieboard:/etc/lirc# ls -al /etc/lirc/lircd.conf.d/
total 52
drwxr-xr-x 2 root root  4096 Jun  2 21:04 .
drwxr-xr-x 3 root root  4096 Jun  2 21:57 ..
-rw-r--r-- 1 root root 33704 Apr  6  2017 devinput.lircd.conf.disabled
-rw-r--r-- 1 root root  3383 Jun  2 18:52 lg.conf
-rw-r--r-- 1 root root   615 Apr  6  2017 README.conf.d

root@cubieboard:/etc/lirc# cat /etc/lirc/lircd.conf.d/lg.conf 
#
# this config file was automatically generated
# using lirc-0.8.2(iguanaIR) on Thu Jul 15 09:15:21 2010
#
# contributed by Stale Nestas
#
# brand:  LG
# model no. of remote control:
# devices being controlled by this remote: LG42H3000
#

begin remote

  name  LG_42H3000
  bits           16
  flags SPACE_ENC|CONST_LENGTH
  eps            30
  aeps          100

  header       9008  4442
  one           533  1652
  zero          533   533
  ptrail        535
  repeat       9001  2204
  pre_data_bits   16
  pre_data       0x20DF
  gap          107753
  toggle_bit_mask 0x0

      begin codes
          KEY_POWER                0x10EF                    #  Was: power
          input                    0xD02F
          energy                   0xA956
          tv/rad                   0x0FF0
          avmode                   0x0CF3
          KEY_1                    0x8877                    #  Was: 1
          KEY_2                    0x48B7                    #  Was: 2
          KEY_3                    0xC837                    #  Was: 3
          KEY_4                    0x28D7                    #  Was: 4
          KEY_5                    0xA857                    #  Was: 5
          KEY_6                    0x6897                    #  Was: 6
          KEY_7                    0xE817                    #  Was: 7
          KEY_8                    0x18E7                    #  Was: 8
          KEY_9                    0x9867                    #  Was: 9
          KEY_0                    0x08F7                    #  Was: 0
          KEY_LIST                 0xCA35                    #  Was: list
          qview                    0x58A7
          KEY_VOLUMEUP             0x40BF                    #  Was: vol+
          KEY_VOLUMEDOWN           0xC03F                    #  Was: vol-
          KEY_MUTE                 0x906F                    #  Was: mute
          KEY_CHANNELUP            0x00FF                    #  Was: p+
          KEY_CHANNELDOWN          0x807F                    #  Was: p-
          KEY_UP                   0x02FD                    #  Was: up
          KEY_DOWN                 0x827D                    #  Was: down
          KEY_LEFT                 0xE01F                    #  Was: left
          KEY_RIGHT                0x609F                    #  Was: right
          KEY_OK                   0x22DD                    #  Was: ok
          KEY_MENU                 0xC23D                    #  Was: menu
          KEY_EXIT                 0x14EB                    #  Was: return/exit
          KEY_RED                  0x4EB1                    #  Was: red
          KEY_GREEN                0x8E71                    #  Was: green
          KEY_YELLOW               0xC639                    #  Was: yellow
          KEY_BLUE                 0x8679                    #  Was: blue
          KEY_TEXT                 0x04FB                    #  Was: text
          topt                     0x847B
          KEY_SUBTITLE             0x9C63                    #  Was: subtitle
          simplink                 0x7E81
          qmenu                    0xA25D
          KEY_INFO                 0x55AA                    #  Was: info
#          KEY_INFO                 0xD52A                    #  Was: guide
          KEY_FAVORITES            0x7887                    #  Was: fav
      end codes

end remote

RaspberryPi 
https://www.raspberrypi.org/forums/viewtopic.php?t=235256 
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-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb

so, let's rebuild lircd
pi@rpi2 ~ $ sudo apt-get build-dep lirc
pi@rpi2 ~ $ sudo bash
root@rpi2:/home/pi# mkdir build-lirc
root@rpi2:/home/pi# cd build-lirc/

root@rpi2:/home/pi/build-lirc# apt source lirc

root@rpi2:/home/pi/build-lirc# wget https://raw.githubusercontent.com/neuralassembly/raspi/master/lirc-gpio-ir-0.10.patch

root@rpi2:/home/pi/build-lirc# patch -p0 -i lirc-gpio-ir-0.10.patch

root@rpi2:/home/pi/build-lirc# cd lirc-0.10.1/

root@rpi2:/home/pi/build-lirc/lirc-0.10.1# apt install devscripts # debuild

root@rpi2:/home/pi/build-lirc/lirc-0.10.1# debuild -uc -us -b