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