Thanks to @vpeter for adding irblaster support to CE (available starting CE-NG 20.1 nightly 2024/08/03). These are my notes on how to setup and use an irblaster.
Device Tree
Update the DTB with an irblaster node. This configuration works with any g12a/b SOC, change the pinctrl-0 to match the GPIO used by irblaster.
meson-ir-tx {
compatible = "amlogic,meson-g12a-ir-tx";
reg = <0x00 0xff80014c 0x00 0x10>;
pinctrl-names = "default";
pinctrl-0 = <&irblaster_pins>;
interrupts = <0x00 0xc6 0x01>;
clocks = <&clkc CLKID_CLK81>, <&xtal>;
clock-names = "sysclk", "xtal";
status = "okay";
};
Update Lircd to work with both IR receiver & transmitter, by placing the attached lirc_options.conf' in
/storage/.config/lirc_options.conf` (Samba ConfigFiles).
lirc_options.conf (1.6 KB)
Sending IR scancodes
CE includes ir-ctl and irsend for irblaster control.
ir-ctl
is easier to use and doesn’t require a running lirc daemon. Supported protocols:
rc5, rc5x_20, rc5_sz, jvc, sony12, sony15, sony20, nec, necx, nec32, sanyo, rc6_0, rc6_6a_20, rc6_6a_24, rc6_6a_32, rc6_mce, sharp, imon, rc_mm_12, rc_mm_24, rc_mm_32
To use ir-ctl
, specify irblaster device, the protocol & send code, example:
CoreELEC:~ # ir-ctl -d /dev/lirc-tx -S nec:0x456
ir-ctl
can also read and send codes from remote toml files, example:
CoreELEC:~ # ir-ctl -d /dev/lirc-tx -k /storage/.config/rc_keymaps/hisense.toml -K KEY_DOWN
Corresponding toml file
[[protocols]]
name = “hisense”
protocol = “nec”
[protocols.scancodes]
0x45a = “KEY_ENTER”
0x456 = “KEY_UP”
0x457 = “KEY_DOWN”
0x458 = “KEY_LEFT”
0x459 = “KEY_RIGHT”
How to obtain the IR code from any remote
Requires temporarily disabling amremote (remote.conf).
CoreELEC:~ # systemctl stop kodi
CoreELEC:~ # systemctl stop eventlircd
Enable all meson-ir protocols, press any button on the remote to look for a response.
CoreELEC:~ # ir-keytable -p NEC,RC-5,RC-6,JVC,SONY,SANYO,SHARP -t
Narrow down the protocol to find the one that matches the remote.
CoreELEC:~ # ir-keytable -p NEC -t
If the remote is using an unknown protocol and no IR events are detected, record the raw pulses:
CoreELEC:~ # mode2 -d /dev/lirc-rx | sed 's/pulse //g; s/space //g'
Copy & paste the output into IrScrutinizer (Windows, MAC, Linux).
Create a toml file, use ‘pulse_distance’ as the protocol and manually specify the unknown protocol parameters, example:
[[protocols]]
name = ‘mystery_device’
protocol = ‘pulse_distance’
trailer_pulse = 563
header_pulse = 9000
header_space = 4500
repeat_pulse = 9000
repeat_space = 4500
bits = 32
bit_pulse = 563
bit_1_space = 1687
bit_0_space = 562
carrier = 38000
[protocols.scancodes]
0x20df5aa5 = ‘KEY_ENTER’
0x20df6a95 = ‘KEY_UP’
0x20dfea15 = ‘KEY_DOWN’
0x20df9a65 = ‘KEY_RIGHT’
0x20df1ae5 = ‘KEY_LEFT’
List of Lircd remote files. Convert any Lircd remote file to toml format with lircd2toml.py. Can be helpful to get the protocol parameters when using the pulse_distance protocol.
irsend
can be used instread of ir-ctl
to read IR Lircd remote files directly. However, irsend
is only available when using meson-ir, not amremote. Place all Lircd remote configurations in /storage/.config/lircd.conf, and to run:
CoreELEC:~ # irsend -d /run/lirc/lircd.socket send_once hisense KEY_POWER