요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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.
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.
.. _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>`.
.. _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.
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.
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를 먼저 확인해야 합니다.
열린 장치와 결과 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`를 사용합니다.
호환용 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 전환을 지원합니다.
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-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 절을 따릅니다.
지원하지 않는 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.
요약·해설
lirc-get-features.rst:1-174Feature bit가 없는 대응 ioctl 호출은 동작이 정의되지 않으므로 모든 LIRC 설정의 출발점입니다. 미사용 호환 bit와 실제 capability를 구분해 application이 안전한 호출만 선택해야 합니다.