Infrared

From postmarketOS

Infrared, or Consumer IR specifically, is widely used in televisions, set-top boxes, air conditioners and other home appliances for remote controls. It is supported in Linux through Linux Infrared Remote Control (LIRC), which consists of a kernel subsystem and a userspace daemon.

Devices fitted with an IR blaster can be used to control appliances that use infrared remote controls. Through userspace drivers, LIRC can also make use of external IR blasters and receivers over USB, or even home-brew ones connected to a serial port or audio jack.

Devices with infrared transmission support

These devices support infrared transmission through built-in IR blasters:

Device Codename Category
Nokia N900 nokia-n900 community
Xiaomi Mi Note 2 xiaomi-scorpio community
Xiaomi Redmi Note 4 xiaomi-mido community
OLIMEX Teres 1 teres_i testing
Xiaomi 12 xiaomi-cupid testing

Testing

v4l-utils includes an ir-ctl utility to send and receive raw pulse/space sequences without needing the LIRC daemon. It is also able to send scancodes in specific protocols, like sending 0x1e01 encoded in the RC-5 protocol for example:

ir-ctl -d /dev/lircX -S rc5:0x1e01

With a receiver available on the system, a sequence can be recorded as well:

ir-ctl -d /dev/lircX -r

LIRC Daemon

lircd is used to manage infrared devices in userspace. It includes several userspace drivers for legacy hardware as well as home-brew devices, and has a large remote database which it uses to match received signals, as well as to encode keys sent by clients connected to it using the client API it provides.

It also provides a set of tools, such as irrecord, which is an interactive tool used to generate configuration files for remote control units. With a receiver attached to the system, it can record scancodes from a remote control so that they can be later used either to control its original device with an IR blaster, or to use the remote control as an input device.

irsend is another tool provided by LIRC, used to send pre-configured key codes.

This sends a KEY_POWER code as defined in the Sony RMT-D115P remote configuration:

irsend SEND_ONCE Sony_RMT-D115P KEY_POWER

See also

- ir-ctl man page


LIRC on linux meson (It had alot of info about ir receiver in linux