← Documents Documentation/userspace-api/media/rc/lirc-get-features.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / Remote Controller

ioctl LIRC_GET_FEATURES

LIRC hardware가 지원하는 수신·송신 mode와 설정 기능을 bitmask로 조회합니다.

Source pathDocumentation/userspace-api/media/rc/lirc-get-features.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

lirc-get-features.rst:1-174

Feature bit가 없는 대응 ioctl 호출은 동작이 정의되지 않으므로 모든 LIRC 설정의 출발점입니다. 미사용 호환 bit와 실제 capability를 구분해 application이 안전한 호출만 선택해야 합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: RC
3
4 .. _lirc_get_features:
5
6 ***********************
7 ioctl LIRC_GET_FEATURES
8 ***********************
9
10 Name
11 ====
12
13 LIRC_GET_FEATURES - Get the underlying hardware device's features
14
15 Synopsis
16 ========
17
18 .. c:macro:: LIRC_GET_FEATURES
19
20 ``int ioctl(int fd, LIRC_GET_FEATURES, __u32 *features)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by open().
27
28 ``features``
29 Bitmask with the LIRC features.
30
31 Description
32 ===========
33
34 Get the underlying hardware device's features. If a driver does not
35 announce support of certain features, calling of the corresponding ioctls
36 is undefined.
37
38 LIRC features
39 =============
40
41 .. _LIRC-CAN-REC-RAW:
42
43 ``LIRC_CAN_REC_RAW``
44
45 Unused. Kept just to avoid breaking uAPI.
46
47 .. _LIRC-CAN-REC-PULSE:
48
49 ``LIRC_CAN_REC_PULSE``
50
51 Unused. Kept just to avoid breaking uAPI.
52 :ref:`LIRC_MODE_PULSE <lirc-mode-pulse>` can only be used for transmitting.
53
54 .. _LIRC-CAN-REC-MODE2:
55
56 ``LIRC_CAN_REC_MODE2``
57
58 This is raw IR driver for receiving. This means that
59 :ref:`LIRC_MODE_MODE2 <lirc-mode-MODE2>` is used. This also implies
60 that :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is also supported,
61 as long as the kernel is recent enough. Use the
62 :ref:`lirc_set_rec_mode` to switch modes.
63
64 .. _LIRC-CAN-REC-LIRCCODE:
65
66 ``LIRC_CAN_REC_LIRCCODE``
67
68 Unused. Kept just to avoid breaking uAPI.
69
70 .. _LIRC-CAN-REC-SCANCODE:
71
72 ``LIRC_CAN_REC_SCANCODE``
73
74 This is a scancode driver for receiving. This means that
75 :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is used.
76
77 .. _LIRC-CAN-SET-SEND-CARRIER:
78
79 ``LIRC_CAN_SET_SEND_CARRIER``
80
81 The driver supports changing the modulation frequency via
82 :ref:`ioctl LIRC_SET_SEND_CARRIER <LIRC_SET_SEND_CARRIER>`.
83
84 .. _LIRC-CAN-SET-SEND-DUTY-CYCLE:
85
86 ``LIRC_CAN_SET_SEND_DUTY_CYCLE``
87
88 The driver supports changing the duty cycle using
89 :ref:`ioctl LIRC_SET_SEND_DUTY_CYCLE <LIRC_SET_SEND_DUTY_CYCLE>`.
90
91 .. _LIRC-CAN-SET-TRANSMITTER-MASK:
92
93 ``LIRC_CAN_SET_TRANSMITTER_MASK``
94
95 The driver supports changing the active transmitter(s) using
96 :ref:`ioctl LIRC_SET_TRANSMITTER_MASK <LIRC_SET_TRANSMITTER_MASK>`.
97
98 .. _LIRC-CAN-SET-REC-CARRIER:
99
100 ``LIRC_CAN_SET_REC_CARRIER``
101
102 The driver supports setting the receive carrier frequency using
103 :ref:`ioctl LIRC_SET_REC_CARRIER <LIRC_SET_REC_CARRIER>`.
104
105 .. _LIRC-CAN-SET-REC-CARRIER-RANGE:
106
107 ``LIRC_CAN_SET_REC_CARRIER_RANGE``
108
109 The driver supports
110 :ref:`ioctl LIRC_SET_REC_CARRIER_RANGE <LIRC_SET_REC_CARRIER_RANGE>`.
111
112 .. _LIRC-CAN-GET-REC-RESOLUTION:
113
114 ``LIRC_CAN_GET_REC_RESOLUTION``
115
116 The driver supports
117 :ref:`ioctl LIRC_GET_REC_RESOLUTION <LIRC_GET_REC_RESOLUTION>`.
118
119 .. _LIRC-CAN-SET-REC-TIMEOUT:
120
121 ``LIRC_CAN_SET_REC_TIMEOUT``
122
123 The driver supports
124 :ref:`ioctl LIRC_SET_REC_TIMEOUT <LIRC_SET_REC_TIMEOUT>`.
125
126 .. _LIRC-CAN-MEASURE-CARRIER:
127
128 ``LIRC_CAN_MEASURE_CARRIER``
129
130 The driver supports measuring of the modulation frequency using
131 :ref:`ioctl LIRC_SET_MEASURE_CARRIER_MODE <LIRC_SET_MEASURE_CARRIER_MODE>`.
132
133 .. _LIRC-CAN-USE-WIDEBAND-RECEIVER:
134
135 ``LIRC_CAN_USE_WIDEBAND_RECEIVER``
136
137 The driver supports learning mode using
138 :ref:`ioctl LIRC_SET_WIDEBAND_RECEIVER <LIRC_SET_WIDEBAND_RECEIVER>`.
139
140 .. _LIRC-CAN-SEND-RAW:
141
142 ``LIRC_CAN_SEND_RAW``
143
144 Unused. Kept just to avoid breaking uAPI.
145
146 .. _LIRC-CAN-SEND-PULSE:
147
148 ``LIRC_CAN_SEND_PULSE``
149
150 The driver supports sending (also called as IR blasting or IR TX) using
151 :ref:`LIRC_MODE_PULSE <lirc-mode-pulse>`. This implies that
152 :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is also supported for
153 transmit, as long as the kernel is recent enough. Use the
154 :ref:`lirc_set_send_mode` to switch modes.
155
156 .. _LIRC-CAN-SEND-MODE2:
157
158 ``LIRC_CAN_SEND_MODE2``
159
160 Unused. Kept just to avoid breaking uAPI.
161 :ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>` can only be used for receiving.
162
163 .. _LIRC-CAN-SEND-LIRCCODE:
164
165 ``LIRC_CAN_SEND_LIRCCODE``
166
167 Unused. Kept just to avoid breaking uAPI.
168
169 Return Value
170 ============
171
172 On success 0 is returned, on error -1 and the ``errno`` variable is set
173 appropriately. The generic error codes are described at the
174 :ref:`Generic Error Codes <gen-errors>` chapter.
175

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

이름, 선언과 인자

1-36

`LIRC_GET_FEATURES`는 LIRC 장치 아래의 hardware가 제공하는 기능을 조회합니다. `open()`이 반환한 `fd`와 `__u32` feature bitmask를 받을 pointer를 `ioctl()`에 전달합니다.

int ioctl(int fd, LIRC_GET_FEATURES, __u32 *features);

Driver가 어떤 feature의 지원을 알리지 않았다면 그 feature에 대응하는 ioctl을 호출했을 때의 동작은 정의되지 않습니다. Application은 항상 이 bitmask를 먼저 확인해야 합니다.

LIRC_GET_FEATURES 인자
인자설명
fdopen()이 반환한 LIRC 장치 file descriptor
featuresDriver가 지원한다고 알린 LIRC feature bitmask

열린 장치와 결과 bitmask를 전달합니다.

.. SPDX-License-Identifier: GPL-2.0 OR GFDL-1.1-no-invariants-or-later
.. c:namespace:: RC

.. _lirc_get_features:

***********************
ioctl LIRC_GET_FEATURES
***********************

Name
====

LIRC_GET_FEATURES - Get the underlying hardware device's features

Synopsis
========

.. c:macro:: LIRC_GET_FEATURES

``int ioctl(int fd, LIRC_GET_FEATURES, __u32 *features)``

Arguments
=========

``fd``
    File descriptor returned by open().

``features``
    Bitmask with the LIRC features.

Description
===========

Get the underlying hardware device's features. If a driver does not
announce support of certain features, calling of the corresponding ioctls
is undefined.

수신 data mode feature

37-76

`LIRC_CAN_REC_RAW`, `LIRC_CAN_REC_PULSE`, `LIRC_CAN_REC_LIRCCODE`는 현재 사용하지 않지만 기존 uAPI를 깨뜨리지 않기 위해 값이 유지됩니다. 특히 `LIRC_MODE_PULSE`는 송신 전용이므로 수신 pulse feature로 해석해서는 안 됩니다.

`LIRC_CAN_REC_MODE2`는 raw IR 수신 driver임을 뜻하며 `LIRC_MODE_MODE2`를 사용할 수 있습니다. 충분히 최근 kernel에서는 scan code 수신도 함께 지원하므로 `LIRC_MODE_SCANCODE`로 전환할 수 있습니다.

`LIRC_CAN_REC_SCANCODE`는 decode된 scan code를 직접 받는 driver임을 뜻합니다. 지원 mode 전환에는 `LIRC_SET_REC_MODE`를 사용합니다.

LIRC 수신 feature
feature의미
LIRC_CAN_REC_RAW미사용, uAPI 호환을 위해 유지
LIRC_CAN_REC_PULSE미사용, PULSE mode는 송신 전용
LIRC_CAN_REC_MODE2Raw IR MODE2 수신, 최근 kernel에서는 SCANCODE도 지원
LIRC_CAN_REC_LIRCCODE미사용, uAPI 호환을 위해 유지
LIRC_CAN_REC_SCANCODEDecode된 scan code 수신

호환용 bit와 실제 mode 지원 bit를 구분합니다.


LIRC features
=============

.. _LIRC-CAN-REC-RAW:

``LIRC_CAN_REC_RAW``

    Unused. Kept just to avoid breaking uAPI.

.. _LIRC-CAN-REC-PULSE:

``LIRC_CAN_REC_PULSE``

    Unused. Kept just to avoid breaking uAPI.
    :ref:`LIRC_MODE_PULSE <lirc-mode-pulse>` can only be used for transmitting.

.. _LIRC-CAN-REC-MODE2:

``LIRC_CAN_REC_MODE2``

    This is raw IR driver for receiving. This means that
    :ref:`LIRC_MODE_MODE2 <lirc-mode-MODE2>` is used. This also implies
    that :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is also supported,
    as long as the kernel is recent enough. Use the
    :ref:`lirc_set_rec_mode` to switch modes.

.. _LIRC-CAN-REC-LIRCCODE:

``LIRC_CAN_REC_LIRCCODE``

    Unused. Kept just to avoid breaking uAPI.

.. _LIRC-CAN-REC-SCANCODE:

``LIRC_CAN_REC_SCANCODE``

    This is a scancode driver for receiving. This means that
    :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is used.

Carrier, timeout과 receiver 설정 feature

77-138

송신 쪽 `LIRC_CAN_SET_SEND_CARRIER`와 `LIRC_CAN_SET_SEND_DUTY_CYCLE`은 각각 modulation frequency와 duty cycle 변경을, `LIRC_CAN_SET_TRANSMITTER_MASK`는 활성 transmitter 선택을 지원한다는 뜻입니다.

수신 쪽 `LIRC_CAN_SET_REC_CARRIER`는 receive carrier frequency 설정, `LIRC_CAN_SET_REC_CARRIER_RANGE`는 carrier range 설정, `LIRC_CAN_GET_REC_RESOLUTION`은 receiver 시간 resolution 조회를 지원합니다.

`LIRC_CAN_SET_REC_TIMEOUT`은 receive timeout 설정, `LIRC_CAN_MEASURE_CARRIER`는 modulation frequency 측정, `LIRC_CAN_USE_WIDEBAND_RECEIVER`는 learning mode용 wideband receiver 전환을 지원합니다.

LIRC 설정 feature와 대응 ioctl
feature대응 ioctl
LIRC_CAN_SET_SEND_CARRIERLIRC_SET_SEND_CARRIER
LIRC_CAN_SET_SEND_DUTY_CYCLELIRC_SET_SEND_DUTY_CYCLE
LIRC_CAN_SET_TRANSMITTER_MASKLIRC_SET_TRANSMITTER_MASK
LIRC_CAN_SET_REC_CARRIERLIRC_SET_REC_CARRIER
LIRC_CAN_SET_REC_CARRIER_RANGELIRC_SET_REC_CARRIER_RANGE
LIRC_CAN_GET_REC_RESOLUTIONLIRC_GET_REC_RESOLUTION
LIRC_CAN_SET_REC_TIMEOUTLIRC_SET_REC_TIMEOUT
LIRC_CAN_MEASURE_CARRIERLIRC_SET_MEASURE_CARRIER_MODE
LIRC_CAN_USE_WIDEBAND_RECEIVERLIRC_SET_WIDEBAND_RECEIVER

Bit가 설정된 경우에만 해당 제어 ioctl을 사용합니다.

.. _LIRC-CAN-SET-SEND-CARRIER:

``LIRC_CAN_SET_SEND_CARRIER``

    The driver supports changing the modulation frequency via
    :ref:`ioctl LIRC_SET_SEND_CARRIER <LIRC_SET_SEND_CARRIER>`.

.. _LIRC-CAN-SET-SEND-DUTY-CYCLE:

``LIRC_CAN_SET_SEND_DUTY_CYCLE``

    The driver supports changing the duty cycle using
    :ref:`ioctl LIRC_SET_SEND_DUTY_CYCLE <LIRC_SET_SEND_DUTY_CYCLE>`.

.. _LIRC-CAN-SET-TRANSMITTER-MASK:

``LIRC_CAN_SET_TRANSMITTER_MASK``

    The driver supports changing the active transmitter(s) using
    :ref:`ioctl LIRC_SET_TRANSMITTER_MASK <LIRC_SET_TRANSMITTER_MASK>`.

.. _LIRC-CAN-SET-REC-CARRIER:

``LIRC_CAN_SET_REC_CARRIER``

    The driver supports setting the receive carrier frequency using
    :ref:`ioctl LIRC_SET_REC_CARRIER <LIRC_SET_REC_CARRIER>`.

.. _LIRC-CAN-SET-REC-CARRIER-RANGE:

``LIRC_CAN_SET_REC_CARRIER_RANGE``

    The driver supports
    :ref:`ioctl LIRC_SET_REC_CARRIER_RANGE <LIRC_SET_REC_CARRIER_RANGE>`.

.. _LIRC-CAN-GET-REC-RESOLUTION:

``LIRC_CAN_GET_REC_RESOLUTION``

    The driver supports
    :ref:`ioctl LIRC_GET_REC_RESOLUTION <LIRC_GET_REC_RESOLUTION>`.

.. _LIRC-CAN-SET-REC-TIMEOUT:

``LIRC_CAN_SET_REC_TIMEOUT``

    The driver supports
    :ref:`ioctl LIRC_SET_REC_TIMEOUT <LIRC_SET_REC_TIMEOUT>`.

.. _LIRC-CAN-MEASURE-CARRIER:

``LIRC_CAN_MEASURE_CARRIER``

    The driver supports measuring of the modulation frequency using
    :ref:`ioctl LIRC_SET_MEASURE_CARRIER_MODE <LIRC_SET_MEASURE_CARRIER_MODE>`.

.. _LIRC-CAN-USE-WIDEBAND-RECEIVER:

``LIRC_CAN_USE_WIDEBAND_RECEIVER``

    The driver supports learning mode using
    :ref:`ioctl LIRC_SET_WIDEBAND_RECEIVER <LIRC_SET_WIDEBAND_RECEIVER>`.

송신 data mode feature

139-168

`LIRC_CAN_SEND_RAW`, `LIRC_CAN_SEND_MODE2`, `LIRC_CAN_SEND_LIRCCODE`는 미사용 feature이며 uAPI 호환성을 위해 남아 있습니다. `LIRC_MODE_MODE2`는 수신 전용이므로 SEND_MODE2 bit가 있어도 실제 송신 mode로 사용하지 않습니다.

`LIRC_CAN_SEND_PULSE`는 IR blasting 또는 IR TX라고도 하는 pulse sequence 송신을 지원합니다. 충분히 최근 kernel에서는 `LIRC_MODE_SCANCODE` 송신도 함께 지원하며 `LIRC_SET_SEND_MODE`로 mode를 전환합니다.

LIRC 송신 feature
feature의미
LIRC_CAN_SEND_RAW미사용, uAPI 호환을 위해 유지
LIRC_CAN_SEND_PULSEPULSE 송신과 최근 kernel의 SCANCODE 송신
LIRC_CAN_SEND_MODE2미사용, MODE2는 수신 전용
LIRC_CAN_SEND_LIRCCODE미사용, uAPI 호환을 위해 유지

현재 유효한 송신 기능과 호환용 값을 구분합니다.


.. _LIRC-CAN-SEND-RAW:

``LIRC_CAN_SEND_RAW``

    Unused. Kept just to avoid breaking uAPI.

.. _LIRC-CAN-SEND-PULSE:

``LIRC_CAN_SEND_PULSE``

    The driver supports sending (also called as IR blasting or IR TX) using
    :ref:`LIRC_MODE_PULSE <lirc-mode-pulse>`. This implies that
    :ref:`LIRC_MODE_SCANCODE <lirc-mode-SCANCODE>` is also supported for
    transmit, as long as the kernel is recent enough. Use the
    :ref:`lirc_set_send_mode` to switch modes.

.. _LIRC-CAN-SEND-MODE2:

``LIRC_CAN_SEND_MODE2``

    Unused. Kept just to avoid breaking uAPI.
    :ref:`LIRC_MODE_MODE2 <lirc-mode-mode2>` can only be used for receiving.

.. _LIRC-CAN-SEND-LIRCCODE:

``LIRC_CAN_SEND_LIRCCODE``

    Unused. Kept just to avoid breaking uAPI.

반환값

169-174

성공하면 0을 반환하고 `features`에 bitmask를 씁니다. 실패하면 -1을 반환하고 `errno`를 설정하며, 공통 오류는 Generic Error Codes 절을 따릅니다.

Feature 기반 안전한 제어
LIRC_GET_FEATURES 호출필요한 feature bit 확인지원되는 data mode 또는 설정 ioctl만 선택호출 결과와 errno 확인

지원하지 않는 ioctl의 undefined behavior를 피하는 순서입니다.

Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.