1a79a0e71SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2a79a0e71SMauro Carvalho Chehab
3a79a0e71SMauro Carvalho Chehab======================================================
4a79a0e71SMauro Carvalho ChehabInfrared remote control support in video4linux drivers
5a79a0e71SMauro Carvalho Chehab======================================================
6a79a0e71SMauro Carvalho Chehab
7a79a0e71SMauro Carvalho ChehabAuthors: Gerd Hoffmann, Mauro Carvalho Chehab
8a79a0e71SMauro Carvalho Chehab
9a79a0e71SMauro Carvalho ChehabBasics
10a79a0e71SMauro Carvalho Chehab======
11a79a0e71SMauro Carvalho Chehab
12a79a0e71SMauro Carvalho ChehabMost analog and digital TV boards support remote controllers. Several of
13a79a0e71SMauro Carvalho Chehabthem have a microprocessor that receives the IR carriers, convert into
14a79a0e71SMauro Carvalho Chehabpulse/space sequences and then to scan codes, returning such codes to
15a79a0e71SMauro Carvalho Chehabuserspace ("scancode mode"). Other boards return just the pulse/space
16a79a0e71SMauro Carvalho Chehabsequences ("raw mode").
17a79a0e71SMauro Carvalho Chehab
18a79a0e71SMauro Carvalho ChehabThe support for remote controller in scancode mode is provided by the
19a79a0e71SMauro Carvalho Chehabstandard Linux input layer. The support for raw mode is provided via LIRC.
20a79a0e71SMauro Carvalho Chehab
21a79a0e71SMauro Carvalho ChehabIn order to check the support and test it, it is suggested to download
22a79a0e71SMauro Carvalho Chehabthe `v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_. It provides
23a79a0e71SMauro Carvalho Chehabtwo tools to handle remote controllers:
24a79a0e71SMauro Carvalho Chehab
25a79a0e71SMauro Carvalho Chehab- ir-keytable: provides a way to query the remote controller, list the
26a79a0e71SMauro Carvalho Chehab  protocols it supports, enable in-kernel support for IR decoder or
27a79a0e71SMauro Carvalho Chehab  switch the protocol and to test the reception of scan codes;
28a79a0e71SMauro Carvalho Chehab
29a79a0e71SMauro Carvalho Chehab- ir-ctl: provide tools to handle remote controllers that support raw mode
30a79a0e71SMauro Carvalho Chehab  via LIRC interface.
31a79a0e71SMauro Carvalho Chehab
32a79a0e71SMauro Carvalho ChehabUsually, the remote controller module is auto-loaded when the TV card is
33a79a0e71SMauro Carvalho Chehabdetected. However, for a few devices, you need to manually load the
34a79a0e71SMauro Carvalho Chehabir-kbd-i2c module.
35a79a0e71SMauro Carvalho Chehab
36a79a0e71SMauro Carvalho ChehabHow it works
37a79a0e71SMauro Carvalho Chehab============
38a79a0e71SMauro Carvalho Chehab
39a79a0e71SMauro Carvalho ChehabThe modules register the remote as keyboard within the linux input
40a79a0e71SMauro Carvalho Chehablayer, i.e. you'll see the keys of the remote as normal key strokes
41a79a0e71SMauro Carvalho Chehab(if CONFIG_INPUT_KEYBOARD is enabled).
42a79a0e71SMauro Carvalho Chehab
43a79a0e71SMauro Carvalho ChehabUsing the event devices (CONFIG_INPUT_EVDEV) it is possible for
44a79a0e71SMauro Carvalho Chehabapplications to access the remote via /dev/input/event<n> devices.
45a79a0e71SMauro Carvalho ChehabThe udev/systemd will automatically create the devices. If you install
46a79a0e71SMauro Carvalho Chehabthe `v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_, it may also
47a79a0e71SMauro Carvalho Chehabautomatically load a different keytable than the default one. Please see
48a79a0e71SMauro Carvalho Chehab`v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_ ir-keytable.1
49a79a0e71SMauro Carvalho Chehabman page for details.
50a79a0e71SMauro Carvalho Chehab
51a79a0e71SMauro Carvalho ChehabThe ir-keytable tool is nice for trouble shooting, i.e. to check
52a79a0e71SMauro Carvalho Chehabwhenever the input device is really present, which of the devices it
53a79a0e71SMauro Carvalho Chehabis, check whenever pressing keys on the remote actually generates
54a79a0e71SMauro Carvalho Chehabevents and the like.  You can also use any other input utility that changes
55a79a0e71SMauro Carvalho Chehabthe keymaps, like the input kbd utility.
56a79a0e71SMauro Carvalho Chehab
57a79a0e71SMauro Carvalho Chehab
58a79a0e71SMauro Carvalho ChehabUsing with lircd
59a79a0e71SMauro Carvalho Chehab----------------
60a79a0e71SMauro Carvalho Chehab
61a79a0e71SMauro Carvalho ChehabThe latest versions of the lircd daemon supports reading events from the
62a79a0e71SMauro Carvalho Chehablinux input layer (via event device). It also supports receiving IR codes
63a79a0e71SMauro Carvalho Chehabin lirc mode.
64a79a0e71SMauro Carvalho Chehab
65a79a0e71SMauro Carvalho Chehab
66a79a0e71SMauro Carvalho ChehabUsing without lircd
67a79a0e71SMauro Carvalho Chehab-------------------
68a79a0e71SMauro Carvalho Chehab
69a79a0e71SMauro Carvalho ChehabXorg recognizes several IR keycodes that have its numerical value lower
70a79a0e71SMauro Carvalho Chehabthan 247. With the advent of Wayland, the input driver got updated too,
71a79a0e71SMauro Carvalho Chehaband should now accept all keycodes. Yet, you may want to just reasign
72a79a0e71SMauro Carvalho Chehabthe keycodes to something that your favorite media application likes.
73a79a0e71SMauro Carvalho Chehab
74a79a0e71SMauro Carvalho ChehabThis can be done by setting
75a79a0e71SMauro Carvalho Chehab`v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_ to load your own
76a79a0e71SMauro Carvalho Chehabkeytable in runtime. Please read  ir-keytable.1 man page for details.
77