요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
Remote Controller devices
-------------------------
Remote Controller core
~~~~~~~~~~~~~~~~~~~~~~
The remote controller core implements infrastructure to receive and send
remote controller keyboard keystrokes and mouse events.
Every time a key is pressed on a remote controller, a scan code is produced.
Also, on most hardware, keeping a key pressed for more than a few dozens of
milliseconds produce a repeat key event. That's somewhat similar to what
a normal keyboard or mouse is handled internally on Linux\ [#f1]_. So, the
remote controller core is implemented on the top of the linux input/evdev
interface.
.. [#f1]
The main difference is that, on keyboard events, the keyboard controller
produces one event for a key press and another one for key release. On
infrared-based remote controllers, there's no key release event. Instead,
an extra code is produced to indicate key repeats.
However, most of the remote controllers use infrared (IR) to transmit signals.
As there are several protocols used to modulate infrared signals, one
important part of the core is dedicated to adjust the driver and the core
system to support the infrared protocol used by the emitter.
The infrared transmission is done by blinking a infrared emitter using a
carrier. The carrier can be switched on or off by the IR transmitter
hardware. When the carrier is switched on, it is called *PULSE*.
When the carrier is switched off, it is called *SPACE*.
In other words, a typical IR transmission can be viewed as a sequence of
*PULSE* and *SPACE* events, each with a given duration.
The carrier parameters (frequency, duty cycle) and the intervals for
*PULSE* and *SPACE* events depend on the protocol.
For example, the NEC protocol uses a carrier of 38kHz, and transmissions
start with a 9ms *PULSE* and a 4.5ms SPACE. It then transmits 16 bits of
scan code, being 8 bits for address (usually it is a fixed number for a
given remote controller), followed by 8 bits of code. A bit "1" is modulated
with 560µs *PULSE* followed by 1690µs *SPACE* and a bit "0" is modulated
with 560µs *PULSE* followed by 560µs *SPACE*.
At receiver, a simple low-pass filter can be used to convert the received
signal in a sequence of *PULSE/SPACE* events, filtering out the carrier
frequency. Due to that, the receiver doesn't care about the carrier's
actual frequency parameters: all it has to do is to measure the amount
of time it receives *PULSE/SPACE* events.
So, a simple IR receiver hardware will just provide a sequence of timings
for those events to the Kernel. The drivers for hardware with such kind of
receivers are identified by ``RC_DRIVER_IR_RAW``, as defined by
:c:type:`rc_driver_type`\ [#f2]_. Other hardware come with a
microcontroller that decode the *PULSE/SPACE* sequence and return scan
codes to the Kernel. Such kind of receivers are identified
by ``RC_DRIVER_SCANCODE``.
.. [#f2]
The RC core also supports devices that have just IR emitters,
without any receivers. Right now, all such devices work only in
raw TX mode. Such kind of hardware is identified as
``RC_DRIVER_IR_RAW_TX``.
When the RC core receives events produced by ``RC_DRIVER_IR_RAW`` IR
receivers, it needs to decode the IR protocol, in order to obtain the
corresponding scan code. The protocols supported by the RC core are
defined at enum :c:type:`rc_proto`.
When the RC code receives a scan code (either directly, by a driver
of the type ``RC_DRIVER_SCANCODE``, or via its IR decoders), it needs
to convert into a Linux input event code. This is done via a mapping
table.
The Kernel has support for mapping tables available on most media
devices. It also supports loading a table in runtime, via some
sysfs nodes. See the :ref:`RC userspace API <Remote_controllers_Intro>`
for more details.
Remote controller data structures and functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. kernel-doc:: include/media/rc-core.h
.. kernel-doc:: include/media/rc-map.h
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Remote Controller input 기반 구조
1-17이 `GPL-2.0` 문서는 Remote Controller core를 설명합니다. RC core는 remote controller의 keyboard keystroke와 mouse event를 수신하고 송신하는 기반 구조를 구현합니다.
Remote controller에서 key를 누를 때마다 scan code가 생성됩니다. 대부분의 hardware에서는 key를 수십 ms 이상 계속 누르면 repeat key event도 발생합니다. 일반 keyboard나 mouse의 Linux 내부 처리와 비슷하므로 RC core는 Linux input/evdev interface 위에 구현됩니다.
Remote keystroke와 pointer event를 Linux input event로 전달합니다.
.. SPDX-License-Identifier: GPL-2.0
Remote Controller devices
-------------------------
Remote Controller core
~~~~~~~~~~~~~~~~~~~~~~
The remote controller core implements infrastructure to receive and send
remote controller keyboard keystrokes and mouse events.
Every time a key is pressed on a remote controller, a scan code is produced.
Also, on most hardware, keeping a key pressed for more than a few dozens of
milliseconds produce a repeat key event. That's somewhat similar to what
a normal keyboard or mouse is handled internally on Linux\ [#f1]_. So, the
remote controller core is implemented on the top of the linux input/evdev
interface.
IR key repeat와 PULSE/SPACE
18-40일반 keyboard controller는 key press event와 key release event를 각각 생성합니다. Infrared remote controller에는 key release event가 없고 대신 별도 code로 key repeat를 표시한다는 점이 가장 큰 차이입니다.
대부분의 remote controller는 infrared, 즉 IR로 신호를 전송합니다. IR 신호를 변조하는 protocol이 여러 가지이므로 core의 중요한 역할은 emitter가 사용하는 protocol을 driver와 core가 지원하도록 조정하는 것입니다.
IR transmitter hardware는 carrier를 켜고 끄며 infrared emitter를 깜빡여 전송합니다. Carrier가 켜진 구간을 `PULSE`, 꺼진 구간을 `SPACE`라고 합니다. 전형적인 IR 전송은 각각 duration을 가진 `PULSE`와 `SPACE` event의 연속입니다.
Carrier frequency와 duty cycle, `PULSE`·`SPACE` interval은 protocol에 따라 달라집니다.
Protocol은 carrier on/off 구간의 길이와 carrier parameter를 정의합니다.
.. [#f1]
The main difference is that, on keyboard events, the keyboard controller
produces one event for a key press and another one for key release. On
infrared-based remote controllers, there's no key release event. Instead,
an extra code is produced to indicate key repeats.
However, most of the remote controllers use infrared (IR) to transmit signals.
As there are several protocols used to modulate infrared signals, one
important part of the core is dedicated to adjust the driver and the core
system to support the infrared protocol used by the emitter.
The infrared transmission is done by blinking a infrared emitter using a
carrier. The carrier can be switched on or off by the IR transmitter
hardware. When the carrier is switched on, it is called *PULSE*.
When the carrier is switched off, it is called *SPACE*.
In other words, a typical IR transmission can be viewed as a sequence of
*PULSE* and *SPACE* events, each with a given duration.
The carrier parameters (frequency, duty cycle) and the intervals for
*PULSE* and *SPACE* events depend on the protocol.
NEC timing과 receiver driver type
41-66NEC protocol은 38kHz carrier를 사용하고 9ms `PULSE`와 4.5ms `SPACE`로 전송을 시작합니다. 이어서 보통 remote별 고정값인 8bit address와 8bit code로 구성된 16bit scan code를 보냅니다.
Bit `1`은 560μs `PULSE` 뒤 1690μs `SPACE`로, bit `0`은 560μs `PULSE` 뒤 560μs `SPACE`로 변조합니다.
Receiver에서는 간단한 low-pass filter로 carrier frequency를 제거하고 수신 신호를 `PULSE/SPACE` event sequence로 바꿀 수 있습니다. 따라서 receiver는 실제 carrier frequency보다 각 `PULSE/SPACE`를 받은 시간을 측정하면 됩니다.
이런 단순 IR receiver는 event timing sequence를 Kernel에 전달하며 `rc_driver_type`의 `RC_DRIVER_IR_RAW`로 식별합니다. Microcontroller가 `PULSE/SPACE` sequence를 직접 decode해 scan code를 Kernel에 반환하는 receiver는 `RC_DRIVER_SCANCODE`입니다.
RC core는 receiver 없이 IR emitter만 있는 장치도 지원합니다. 현재 이 장치들은 모두 raw TX mode로만 동작하며 `RC_DRIVER_IR_RAW_TX`로 식별합니다.
For example, the NEC protocol uses a carrier of 38kHz, and transmissions
start with a 9ms *PULSE* and a 4.5ms SPACE. It then transmits 16 bits of
scan code, being 8 bits for address (usually it is a fixed number for a
given remote controller), followed by 8 bits of code. A bit "1" is modulated
with 560µs *PULSE* followed by 1690µs *SPACE* and a bit "0" is modulated
with 560µs *PULSE* followed by 560µs *SPACE*.
At receiver, a simple low-pass filter can be used to convert the received
signal in a sequence of *PULSE/SPACE* events, filtering out the carrier
frequency. Due to that, the receiver doesn't care about the carrier's
actual frequency parameters: all it has to do is to measure the amount
of time it receives *PULSE/SPACE* events.
So, a simple IR receiver hardware will just provide a sequence of timings
for those events to the Kernel. The drivers for hardware with such kind of
receivers are identified by ``RC_DRIVER_IR_RAW``, as defined by
:c:type:`rc_driver_type`\ [#f2]_. Other hardware come with a
microcontroller that decode the *PULSE/SPACE* sequence and return scan
codes to the Kernel. Such kind of receivers are identified
by ``RC_DRIVER_SCANCODE``.
.. [#f2]
The RC core also supports devices that have just IR emitters,
without any receivers. Right now, all such devices work only in
raw TX mode. Such kind of hardware is identified as
``RC_DRIVER_IR_RAW_TX``.
Protocol decode와 input mapping
67-82RC core가 `RC_DRIVER_IR_RAW` receiver의 event를 받으면 해당 scan code를 얻기 위해 IR protocol을 decode해야 합니다. Core가 지원하는 protocol은 `enum rc_proto`에 정의됩니다.
`RC_DRIVER_SCANCODE` driver에서 직접 받거나 IR decoder가 만든 scan code를 Linux input event code로 변환할 때 mapping table을 사용합니다.
Kernel은 대부분의 media device에 대한 mapping table을 내장하고 있으며 일부 sysfs node를 통해 runtime에 table을 불러올 수도 있습니다. 자세한 내용은 `RC userspace API <Remote_controllers_Intro>`를 참고해야 합니다.
Raw timing과 hardware-decoded scan code는 공통 mapping 단계를 거칩니다.
When the RC core receives events produced by ``RC_DRIVER_IR_RAW`` IR
receivers, it needs to decode the IR protocol, in order to obtain the
corresponding scan code. The protocols supported by the RC core are
defined at enum :c:type:`rc_proto`.
When the RC code receives a scan code (either directly, by a driver
of the type ``RC_DRIVER_SCANCODE``, or via its IR decoders), it needs
to convert into a Linux input event code. This is done via a mapping
table.
The Kernel has support for mapping tables available on most media
devices. It also supports loading a table in runtime, via some
sysfs nodes. See the :ref:`RC userspace API <Remote_controllers_Intro>`
for more details.
RC data structure와 함수
83-88Remote Controller core의 data structure와 함수는 `include/media/rc-core.h`와 `include/media/rc-map.h`의 kernel-doc에서 가져옵니다.
Remote controller data structures and functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. kernel-doc:: include/media/rc-core.h
.. kernel-doc:: include/media/rc-map.h
요약과 해설
rc-core.rst:1-88Remote Controller core는 IR timing 또는 hardware-decoded scan code를 받아 Linux input event로 바꿉니다. Raw receiver는 protocol decoder를 거치고 scancode receiver는 직접 mapping table로 들어갑니다.