Support for keymap with raw IR and sending key from keymap

kernel v5.3 will introduce a new BPF feature: loops. This makes it possible to decode IR based on raw IR. This means the keymap does not list a specific protocol or protocol decoder; for each key it simply list the pulses and spaces that make up that key.

Here is an example based on the blaupunkt remote.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[[protocols]]
name = 'BLAUPUNKT'
protocol = 'raw'
[[protocols.raw]]
keycode = 'KEY_VIDEO_PREV'
raw = '+6875 -6850 +660'
[[protocols.raw]]
keycode = 'KEY_VIDEO_NEXT'
raw = '+8050 -8050 +660'
[[protocols.raw]]
keycode = 'KEY_UP'
raw = '+3850 -3850 +660'
[[protocols.raw]]
keycode = 'KEY_OK'
raw = '+7500 -7400 +660'
[[protocols.raw]]
keycode = 'KEY_DOWN'
raw = '+4450 -4400 +660'
[[protocols.raw]]
keycode = 'KEY_RIGHT'
raw = '+5660 -5630 +660'
[[protocols.raw]]
keycode = 'KEY_LEFT'
raw = '+6280 -6200 +660'
[[protocols.raw]]
keycode = 'KEY_VOLUMEUP'
raw = '+2650 -2580 +660'
[[protocols.raw]]
keycode = 'KEY_VOLUMEDOWN'
raw = '+3250 -3200 +660'
[[protocols.raw]]
keycode = 'KEY_MUTE'
raw = '+5050 -5000 +660'
[[protocols.raw]]
keycode = 'KEY_DOT'
raw = '+2050 -2000 +660'

So for each key, in the raw string the + denotes a pulse and the - a space. The + and - prefixes are actually optional, since the position in the string determines whether it is pulse or space. To load these keymaps, you’ll need a git ir-keytable and kernel v5.3 or later.

The script lircd2toml.py to convert lircd remote conf into ir-keytable toml formats now also supports raw_codes. I’m very excited that this now means we support the vast majority of lirc remotes.

Having raw IR in keymaps makes them much more useful for sending IR too. So, ir-ctl now supports sending keys from keymaps. Save the above keymap to blaupunkt.toml, and you send keys like so:

1
ir-ctl -k blaupunkt.toml -K KEY_VOLUMEUP

This means that – as far as I know – we have feature parity with the lirc framework. However no daemon is required at all and it’s a much more modern setup.