blob: 613e1e79fc965214f5450955c95698ca8fac2456 [file] [log] [blame]
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -03001Infrared remote control support in video4linux drivers
Linus Torvalds1da177e2005-04-16 15:20:36 -07002======================================================
3
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -03004Authors: Gerd Hoffmann, Mauro Carvalho Chehab
Mauro Carvalho Chehab31cae7c2016-07-17 22:11:47 -03005
6Basics
Linus Torvalds1da177e2005-04-16 15:20:36 -07007------
8
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -03009Most analog and digital TV boards support remote controllers. Several of
10them have a microprocessor that receives the IR carriers, convert into
11pulse/space sequences and then to scan codes, returning such codes to
12userspace ("scancode mode"). Other boards return just the pulse/space
13sequences ("raw mode").
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030015The support for remote controller in scancode mode is provided by the
16standard Linux input layer. The support for raw mode is provided via LIRC.
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030018In order to check the support and test it, it is suggested to download
19the `v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_. It provides
20two tools to handle remote controllers:
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030022- ir-keytable: provides a way to query the remote controller, list the
23 protocols it supports, enable in-kernel support for IR decoder or
24 switch the protocol and to test the reception of scan codes;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030026- ir-ctl: provide tools to handle remote controllers that support raw mode
27 via LIRC interface.
28
29Usually, the remote controller module is auto-loaded when the TV card is
30detected. However, for a few devices, you need to manually load the
31ir-kbd-i2c module.
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Mauro Carvalho Chehab31cae7c2016-07-17 22:11:47 -030033How it works
Linus Torvalds1da177e2005-04-16 15:20:36 -070034------------
35
36The modules register the remote as keyboard within the linux input
37layer, i.e. you'll see the keys of the remote as normal key strokes
38(if CONFIG_INPUT_KEYBOARD is enabled).
39
40Using the event devices (CONFIG_INPUT_EVDEV) it is possible for
41applications to access the remote via /dev/input/event<n> devices.
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030042The udev/systemd will automatically create the devices. If you install
43the `v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_, it may also
44automatically load a different keytable than the default one. Please see
45`v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_ ir-keytable.1
46man page for details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030048The ir-keytable tool is nice for trouble shooting, i.e. to check
Linus Torvalds1da177e2005-04-16 15:20:36 -070049whenever the input device is really present, which of the devices it
50is, check whenever pressing keys on the remote actually generates
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030051events and the like. You can also use any other input utility that changes
52the keymaps, like the input kbd utility.
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54
Mauro Carvalho Chehab31cae7c2016-07-17 22:11:47 -030055Using with lircd
Linus Torvalds1da177e2005-04-16 15:20:36 -070056================
57
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030058The latest versions of the lircd daemon supports reading events from the
59linux input layer (via event device). It also supports receiving IR codes
60in lirc mode.
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
62
Mauro Carvalho Chehab31cae7c2016-07-17 22:11:47 -030063Using without lircd
Linus Torvalds1da177e2005-04-16 15:20:36 -070064===================
65
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030066Xorg recognizes several IR keycodes that have its numerical value lower
67than 247. With the advent of Wayland, the input driver got updated too,
68and should now accept all keycodes. Yet, you may want to just reasign
69the keycodes to something that your favorite media application likes.
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
Mauro Carvalho Chehab2e97d6d2016-07-17 22:34:51 -030071This can be done by setting
72`v4l-utils <https://git.linuxtv.org/v4l-utils.git/>`_ to load your own
73keytable in runtime. Please read ir-keytable.1 man page for details.