New comment by Anachron on void-packages repository https://github.com/void-linux/void-packages/issues/10905#issuecomment-1131306568 Comment: Turns out v4l is used nowadays for IR communication, the package should already be installed (`v4l-utils`). Based on https://www.instructables.com/Setup-IR-Remote-Control-Using-LIRC-for-the-Raspber/ one needs to add the following options to /boot/config.txt: ``` dtoverlay=gpio-ir,gpio_pin=17 ``` Where gpio_pin is the Pin used for communication with the IR. Example: https://miro.medium.com/max/1400/1*A2gpUDLyOx903dVUStHFTA.jpeg I've connected mine to the GPIO number 17, so that's what I enabled. Reboot, then you have /dev/lirc0 and can run `# rc-keytable` and receive: ``` # LC_ALL=C ir-keytable Found /sys/class/rc/rc1/ with: Name: vc4 Driver: cec Default keymap: rc-cec Input device: /dev/input/event1 Supported kernel protocols: cec Enabled kernel protocols: cec bus: 30, vendor/product: 0000:0000, version: 0x0001 Repeat delay = 0 ms, repeat period = 125 ms Found /sys/class/rc/rc0/ with: Name: gpio_ir_recv Driver: gpio_ir_recv Default keymap: rc-rc6-mce Input device: /dev/input/event0 LIRC device: /dev/lirc0 Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon Enabled kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms ``` Now you can test your remote via `sudo ir-keytable -c -p all -t`. ``` LC_ALL=C ir-keytable -c -p all -t Old keytable cleared Protocols changed to unknown other lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp cec imon rc-mm Can't find xbox-dvd bpf protocol in /etc/rc_keymaps/protocols or /usr/lib/udev/rc_keymaps/protocols Testing events. Please, press CTRL-C to abort. 623.497051: lirc protocol(necx): scancode = 0x404008 repeat 623.497098: event type EV_MSC(0x04): scancode = 0x404008 623.497098: event type EV_SYN(0x00). 624.302063: lirc protocol(necx): scancode = 0x404010 624.302096: event type EV_MSC(0x04): scancode = 0x404010 624.302096: event type EV_SYN(0x00). 624.361055: lirc protocol(necx): scancode = 0x404010 repeat 624.361088: event type EV_MSC(0x04): scancode = 0x404010 624.361088: event type EV_SYN(0x00). 624.867071: lirc protocol(necx): scancode = 0x40400b 624.867102: event type EV_MSC(0x04): scancode = 0x40400b 624.867102: event type EV_SYN(0x00). 624.926056: lirc protocol(necx): scancode = 0x40400b repeat 624.926090: event type EV_MSC(0x04): scancode = 0x40400b 624.926090: event type EV_SYN(0x00). 625.408074: lirc protocol(necx): scancode = 0x40400e 625.408103: event type EV_MSC(0x04): scancode = 0x40400e 625.408103: event type EV_SYN(0x00). 625.467074: lirc protocol(necx): scancode = 0x40400e repeat 625.467109: event type EV_MSC(0x04): scancode = 0x40400e 625.467109: event type EV_SYN(0x00). ``` (Part 2) `/usr/share/lirc/contrib/60-lirc.rules` contains: ``` KERNEL=="lirc[0-9]*", SUBSYSTEM=="lirc", GROUP="lirc", MODE="0660" ``` Adding lirc group: `groupadd lirc` Reloading udev: ```sh # udevadm control -R # udevadm trigger ``` Checking permissions: ```sh # ls -lisah /dev/lirc0 164 0 crw-rw---- 1 root lirc 251, 0 19. Mai 10:26 /dev/lirc0 ``` Adding group to user: `usermod -aG lirc ` Hint: Your user also needs to be inside the `input` group to use /dev/input/* devices (`usermod -aG input `). (Logging out & in) Checking groups: ```sh $ groups ... lirc ``` Check features with normal user: ``` $ LC_ALL=C ir-ctl --features Receive features /dev/lirc0: - Device can receive raw IR - Can report decoded scancodes and protocol - Receiving timeout 12664 microseconds - Can set receiving timeout min 1 microseconds, max 1250000 microseconds Send features /dev/lirc0: - Device cannot send ``` (Part 3) As per https://mauricius.dev/configure-an-infrared-remote-control-with-linux/ we now need to map the events to the correct keys manually. I have a (Pine64 IR Remote)[https://pine64.com/product/pine64-ir-remote-with-ir-receiver-sensor/] which means I should have a file `pine64.toml` inside `/lib/udev/rc_keymaps`. By reloading the keytable with this mappings, it should now read the events correctly. ``` # ir-keytable -c -w /lib/udev/rc_keymaps/pine64.toml ``` ``` $ LC_ALL=C ir-keytable -t Testing events. Please, press CTRL-C to abort. 784.668064: lirc protocol(necx): scancode = 0x40404d 784.668107: event type EV_MSC(0x04): scancode = 0x40404d 784.668107: event type EV_KEY(0x01) key_down: KEY_POWER(0x0074) 784.668107: event type EV_SYN(0x00). 784.727063: lirc protocol(necx): scancode = 0x40404d repeat 784.727098: event type EV_MSC(0x04): scancode = 0x40404d 784.727098: event type EV_SYN(0x00). 784.856040: event type EV_KEY(0x01) key_up: KEY_POWER(0x0074) 784.856040: event type EV_SYN(0x00). ``` Success! It now prints `key_down` and `key_up` events for the remote. You can probably add the command `ir-keytable -c -w /lib/udev/rc_keymaps/pine64.toml` to `/etc/rc.local` or similiar to automate this on boot.