€• Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ ”Œchildren”]”(Œtranslations”Œ
LanguagesNode”“”)�”}”(hhh]”(h Œpending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ
attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ9/translations/zh_CN/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuŒtagname”hhhubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/zh_TW/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/it_IT/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/ja_JP/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/ko_KR/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/pt_BR/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ9/translations/sp_SP/userspace-api/media/rc/lirc-dev-intro”Œmodname”NŒ classname”NŒrefexplicit”ˆuh1hhhubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h
hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒCSPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later”h]”hŒCSPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒS/var/lib/git/docbuild/linux/Documentation/userspace-api/media/rc/lirc-dev-intro.rst”h´KubhŒtarget”“”)�”}”(hŒ.. _lirc_dev_intro:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œlirc-dev-intro”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒIntroduction”h]”hŒIntroduction”…”�”}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hX¸ LIRC stands for Linux Infrared Remote Control. The LIRC device interface is
a bi-directional interface for transporting raw IR and decoded scancodes
data between userspace and kernelspace. Fundamentally, it is just a chardev
(/dev/lircX, for X = 0, 1, 2, ...), with a number of standard struct
file_operations defined on it. With respect to transporting raw IR and
decoded scancodes to and fro, the essential fops are read, write and ioctl.”h]”hX¸ LIRC stands for Linux Infrared Remote Control. The LIRC device interface is
a bi-directional interface for transporting raw IR and decoded scancodes
data between userspace and kernelspace. Fundamentally, it is just a chardev
(/dev/lircX, for X = 0, 1, 2, ...), with a number of standard struct
file_operations defined on it. With respect to transporting raw IR and
decoded scancodes to and fro, the essential fops are read, write and ioctl.”…”�”}”(hhíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K hhØh²hubhì)�”}”(hŒ`It is also possible to attach a BPF program to a LIRC device for decoding
raw IR into scancodes.”h]”hŒ`It is also possible to attach a BPF program to a LIRC device for decoding
raw IR into scancodes.”…”�”}”(hhûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubhì)�”}”(hŒ6Example dmesg output upon a driver registering w/LIRC:”h]”hŒ6Example dmesg output upon a driver registering w/LIRC:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubhŒ
literal_block”“”)�”}”(hŒs$ dmesg |grep lirc_dev
rc rc0: lirc_dev: driver mceusb registered at minor = 0, raw IR receiver, raw IR transmitter”h]”hŒs$ dmesg |grep lirc_dev
rc rc0: lirc_dev: driver mceusb registered at minor = 0, raw IR receiver, raw IR transmitter”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œnone”Œhighlight_args”}”uh1j h³hÇh´KhhØh²hubhì)�”}”(hŒ"What you should see for a chardev:”h]”hŒ"What you should see for a chardev:”…”�”}”(hj, h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´KhhØh²hubj )�”}”(hŒG$ ls -l /dev/lirc*
crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0”h]”hŒG$ ls -l /dev/lirc*
crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0”…”�”}”hj: sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆj' ‰j( Œnone”j* }”uh1j h³hÇh´KhhØh²hubhì)�”}”(hŒyNote that the package `v4l-utils `_
contains tools for working with LIRC devices:”h]”(hŒNote that the package ”…”�”}”(hjJ h²hh³Nh´NubhŒ reference”“”)�”}”(hŒ5`v4l-utils `_”h]”hŒ v4l-utils”…”�”}”(hjT h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ v4l-utils”Œrefuri”Œ&https://git.linuxtv.org/v4l-utils.git/”uh1jR hjJ ubhÉ)�”}”(hŒ) ”h]”h}”(h]”Œ v4l-utils”ah ]”h"]”Œ v4l-utils”ah$]”h&]”Œrefuri”je uh1hÈŒ
referenced”KhjJ ubhŒ.
contains tools for working with LIRC devices:”…”�”}”(hjJ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K!hhØh²hubhŒblock_quote”“”)�”}”(hŒ÷- ir-ctl: can receive raw IR and transmit IR, as well as query LIRC
device features.
- ir-keytable: can load keymaps; allows you to set IR kernel protocols; load
BPF IR decoders and test IR decoding. Some BPF IR decoders are also
provided.
”h]”hŒbullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒSir-ctl: can receive raw IR and transmit IR, as well as query LIRC
device features.
”h]”hì)�”}”(hŒRir-ctl: can receive raw IR and transmit IR, as well as query LIRC
device features.”h]”hŒRir-ctl: can receive raw IR and transmit IR, as well as query LIRC
device features.”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K$hj‹ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‰ hj† ubjŠ )�”}”(hŒ™ir-keytable: can load keymaps; allows you to set IR kernel protocols; load
BPF IR decoders and test IR decoding. Some BPF IR decoders are also
provided.
”h]”hì)�”}”(hŒ˜ir-keytable: can load keymaps; allows you to set IR kernel protocols; load
BPF IR decoders and test IR decoding. Some BPF IR decoders are also
provided.”h]”hŒ˜ir-keytable: can load keymaps; allows you to set IR kernel protocols; load
BPF IR decoders and test IR decoding. Some BPF IR decoders are also
provided.”…”�”}”(hj§ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K'hj£ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‰ hj† ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j„ h³hÇh´K$hj€ ubah}”(h]”h ]”h"]”h$]”h&]”uh1j~ h³hÇh´K$hhØh²hubhÉ)�”}”(hŒ.. _lirc_modes:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÔŒ
lirc-modes”uh1hÈh´K+hhØh²hh³hÇubeh}”(h]”(Œintroduction”hÕeh ]”h"]”(Œintroduction”Œlirc_dev_intro”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”jÚ hÊsŒexpect_referenced_by_id”}”hÕhÊsubh×)�”}”(hhh]”(hÜ)�”}”(hŒ
LIRC modes”h]”hŒ
LIRC modes”…”�”}”(hjä h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjá h²hh³hÇh´K/ubhì)�”}”(hŒ\LIRC supports some modes of receiving and sending IR codes, as shown
on the following table.”h]”hŒ\LIRC supports some modes of receiving and sending IR codes, as shown
on the following table.”…”�”}”(hjò h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K1hjá h²hubhÉ)�”}”(hŒ.. _lirc-mode-scancode:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÔŒlirc-mode-scancode”uh1hÈh´K4hjá h²hh³hÇubhÉ)�”}”(hŒ.. _lirc-scancode-flag-toggle:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÔŒlirc-scancode-flag-toggle”uh1hÈh´K5hjá h²hh³hÇjÝ }”Œlirc-mode-scancode”j sjß }”j
j subhÉ)�”}”(hŒ.. _lirc-scancode-flag-repeat:”h]”h}”(h]”h ]”h"]”h$]”h&]”hÔŒlirc-scancode-flag-repeat”uh1hÈh´K6hjá h²hh³hÇjÝ }”(Œlirc-scancode-flag-toggle”j j j ujß }”(j j j
j uubhì)�”}”(hŒ``LIRC_MODE_SCANCODE``”h]”hŒliteral”“”)�”}”(hj) h]”hŒLIRC_MODE_SCANCODE”…”�”}”(hj- h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+ hj' ubah}”(h]”(j# j j
eh ]”h"]”(Œlirc-scancode-flag-repeat”j% j eh$]”h&]”uh1hëh³hÇh´K8hjá h²hjÝ }”(j> j j% j j j ujß }”(j# j j j j
j uubj )�”}”(hXB This mode is for both sending and receiving IR.
For transmitting (aka sending), create a struct lirc_scancode with
the desired scancode set in the ``scancode`` member, :c:type:`rc_proto`
set to the :ref:`IR protocol `, and all other
members set to 0. Write this struct to the lirc device.
For receiving, you read struct lirc_scancode from the LIRC device.
The ``scancode`` field is set to the received scancode and the
:ref:`IR protocol ` is set in
:c:type:`rc_proto`. If the scancode maps to a valid key code, this is set
in the ``keycode`` field, else it is set to ``KEY_RESERVED``.
The ``flags`` can have ``LIRC_SCANCODE_FLAG_TOGGLE`` set if the toggle
bit is set in protocols that support it (e.g. rc-5 and rc-6), or
``LIRC_SCANCODE_FLAG_REPEAT`` for when a repeat is received for protocols
that support it (e.g. nec).
In the Sanyo and NEC protocol, if you hold a button on remote, rather than
repeating the entire scancode, the remote sends a shorter message with
no scancode, which just means button is held, a "repeat". When this is
received, the ``LIRC_SCANCODE_FLAG_REPEAT`` is set and the scancode and
keycode is repeated.
With nec, there is no way to distinguish "button hold" from "repeatedly
pressing the same button". The rc-5 and rc-6 protocols have a toggle bit.
When a button is released and pressed again, the toggle bit is inverted.
If the toggle bit is set, the ``LIRC_SCANCODE_FLAG_TOGGLE`` is set.
The ``timestamp`` field is filled with the time nanoseconds
(in ``CLOCK_MONOTONIC``) when the scancode was decoded.
”h]”(hì)�”}”(hŒ/This mode is for both sending and receiving IR.”h]”hŒ/This mode is for both sending and receiving IR.”…”�”}”(hjG h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hëh³hÇh´K:hjC ubhì)�”}”(hX For transmitting (aka sending), create a struct lirc_scancode with
the desired scancode set in the ``scancode`` member, :c:type:`rc_proto`
set to the :ref:`IR protocol `, and all other
members set to 0. Write this struct to the lirc device.”h]”(hŒcFor transmitting (aka sending), create a struct lirc_scancode with
the desired scancode set in the ”…”�”}”(hjU h²hh³Nh´Nubj, )�”}”(hŒ``scancode``”h]”hŒscancode”…”�”}”(hj] h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+ hjU ubhŒ member, ”…”�”}”(hjU h²hh³Nh´Nubh)�”}”(hŒ:c:type:`rc_proto`”h]”j, )�”}”(hjq h]”hŒrc_proto”…”�”}”(hjs h²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œc”Œc-type”eh"]”h$]”h&]”uh1j+ hjo ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œ%userspace-api/media/rc/lirc-dev-intro”Œ refdomain”j~ Œreftype”Œtype”Œrefexplicit”‰Œrefwarn”‰Œ reftarget”Œrc_proto”uh1hh³hÇh´K