← Documents Documentation/userspace-api/media/cec/cec-ioc-adap-g-caps.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / CEC

ioctl CEC_ADAP_G_CAPS

CEC adapter 식별 정보, logical address 수, Framework version과 capability flag 10개를 설명합니다.

Source pathDocumentation/userspace-api/media/cec/cec-ioc-adap-g-caps.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

cec-ioc-adap-g-caps.rst:1-152

모든 CEC device가 지원하는 capability 조회 ioctl입니다. capability bit에 따라 physical·logical address, transmit, monitoring, connector 정보의 담당 주체와 사용 가능 기능이 결정됩니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: CEC
3
4 .. _CEC_ADAP_G_CAPS:
5
6 *********************
7 ioctl CEC_ADAP_G_CAPS
8 *********************
9
10 Name
11 ====
12
13 CEC_ADAP_G_CAPS - Query device capabilities
14
15 Synopsis
16 ========
17
18 .. c:macro:: CEC_ADAP_G_CAPS
19
20 ``int ioctl(int fd, CEC_ADAP_G_CAPS, struct cec_caps *argp)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by :c:func:`open()`.
27
28 ``argp``
29
30 Description
31 ===========
32
33 All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. To query
34 device information, applications call the ioctl with a pointer to a
35 struct :c:type:`cec_caps`. The driver fills the structure and
36 returns the information to the application. The ioctl never fails.
37
38 .. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.6cm}|
39
40 .. c:type:: cec_caps
41
42 .. flat-table:: struct cec_caps
43 :header-rows: 0
44 :stub-columns: 0
45 :widths: 1 1 16
46
47 * - char
48 - ``driver[32]``
49 - The name of the cec adapter driver.
50 * - char
51 - ``name[32]``
52 - The name of this CEC adapter. The combination ``driver`` and
53 ``name`` must be unique.
54 * - __u32
55 - ``available_log_addrs``
56 - The maximum number of logical addresses that can be configured.
57 * - __u32
58 - ``capabilities``
59 - The capabilities of the CEC adapter, see
60 :ref:`cec-capabilities`.
61 * - __u32
62 - ``version``
63 - CEC Framework API version, formatted with the ``KERNEL_VERSION()``
64 macro.
65
66 .. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.4cm}|
67
68 .. _cec-capabilities:
69
70 .. flat-table:: CEC Capabilities Flags
71 :header-rows: 0
72 :stub-columns: 0
73 :widths: 3 1 8
74
75 * .. _`CEC-CAP-PHYS-ADDR`:
76
77 - ``CEC_CAP_PHYS_ADDR``
78 - 0x00000001
79 - Userspace has to configure the physical address by calling
80 :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`. If
81 this capability isn't set, then setting the physical address is
82 handled by the kernel whenever the EDID is set (for an HDMI
83 receiver) or read (for an HDMI transmitter).
84 * .. _`CEC-CAP-LOG-ADDRS`:
85
86 - ``CEC_CAP_LOG_ADDRS``
87 - 0x00000002
88 - Userspace has to configure the logical addresses by calling
89 :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`. If
90 this capability isn't set, then the kernel will have configured
91 this.
92 * .. _`CEC-CAP-TRANSMIT`:
93
94 - ``CEC_CAP_TRANSMIT``
95 - 0x00000004
96 - Userspace can transmit CEC messages by calling
97 :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. This implies that
98 userspace can be a follower as well, since being able to transmit
99 messages is a prerequisite of becoming a follower. If this
100 capability isn't set, then the kernel will handle all CEC
101 transmits and process all CEC messages it receives.
102 * .. _`CEC-CAP-PASSTHROUGH`:
103
104 - ``CEC_CAP_PASSTHROUGH``
105 - 0x00000008
106 - Userspace can use the passthrough mode by calling
107 :ref:`ioctl CEC_S_MODE <CEC_S_MODE>`.
108 * .. _`CEC-CAP-RC`:
109
110 - ``CEC_CAP_RC``
111 - 0x00000010
112 - This adapter supports the remote control protocol.
113 * .. _`CEC-CAP-MONITOR-ALL`:
114
115 - ``CEC_CAP_MONITOR_ALL``
116 - 0x00000020
117 - The CEC hardware can monitor all messages, not just directed and
118 broadcast messages.
119 * .. _`CEC-CAP-NEEDS-HPD`:
120
121 - ``CEC_CAP_NEEDS_HPD``
122 - 0x00000040
123 - The CEC hardware is only active if the HDMI Hotplug Detect pin is
124 high. This makes it impossible to use CEC to wake up displays that
125 set the HPD pin low when in standby mode, but keep the CEC bus
126 alive.
127 * .. _`CEC-CAP-MONITOR-PIN`:
128
129 - ``CEC_CAP_MONITOR_PIN``
130 - 0x00000080
131 - The CEC hardware can monitor CEC pin changes from low to high voltage
132 and vice versa. When in pin monitoring mode the application will
133 receive ``CEC_EVENT_PIN_CEC_LOW`` and ``CEC_EVENT_PIN_CEC_HIGH`` events.
134 * .. _`CEC-CAP-CONNECTOR-INFO`:
135
136 - ``CEC_CAP_CONNECTOR_INFO``
137 - 0x00000100
138 - If this capability is set, then :ref:`CEC_ADAP_G_CONNECTOR_INFO` can
139 be used.
140 * .. _`CEC-CAP-REPLY-VENDOR-ID`:
141
142 - ``CEC_CAP_REPLY_VENDOR_ID``
143 - 0x00000200
144 - If this capability is set, then
145 :ref:`CEC_MSG_FL_REPLY_VENDOR_ID <cec-msg-flags>` can be used.
146
147 Return Value
148 ============
149
150 On success 0 is returned, on error -1 and the ``errno`` variable is set
151 appropriately. The generic error codes are described at the
152 :ref:`Generic Error Codes <gen-errors>` chapter.
153

3. 한국어 전문 번역

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

이름, 선언과 인자

1-29

`CEC_ADAP_G_CAPS`는 CEC device capability를 조회하는 ioctl입니다. 모든 CEC device가 반드시 지원해야 하는 기본 request입니다.

함수 형태는 `int ioctl(int fd, CEC_ADAP_G_CAPS, struct cec_caps *argp)`입니다. `fd`는 `open()`이 반환한 file descriptor이고 `argp`는 결과를 받을 `struct cec_caps` pointer입니다.

CEC_ADAP_G_CAPS 호출
항목설명
requestCEC_ADAP_G_CAPS
fdopen()이 반환한 CEC device descriptor
argpstruct cec_caps *
지원 의무모든 CEC device가 구현

열린 CEC adapter의 식별 정보와 지원 기능을 가져옵니다.

.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: CEC

.. _CEC_ADAP_G_CAPS:

*********************
ioctl CEC_ADAP_G_CAPS
*********************

Name
====

CEC_ADAP_G_CAPS - Query device capabilities

Synopsis
========

.. c:macro:: CEC_ADAP_G_CAPS

``int ioctl(int fd, CEC_ADAP_G_CAPS, struct cec_caps *argp)``

Arguments
=========

``fd``
    File descriptor returned by :c:func:`open()`.

``argp``

조회 동작

30-41

응용 프로그램은 device 정보를 조회하기 위해 `struct cec_caps` pointer로 이 ioctl을 호출합니다.

driver가 구조체를 채워 응용 프로그램에 반환합니다. 원문은 이 ioctl이 실패하지 않는다고 명시합니다.

CEC capability 조회
CEC device opencec_caps buffer 준비CEC_ADAP_G_CAPS ioctldriver가 구조체 채움userspace가 capability bit 검사

driver가 adapter 정보 구조체 전체를 채웁니다.

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

All cec devices must support :ref:`ioctl CEC_ADAP_G_CAPS <CEC_ADAP_G_CAPS>`. To query
device information, applications call the ioctl with a pointer to a
struct :c:type:`cec_caps`. The driver fills the structure and
returns the information to the application. The ioctl never fails.

.. tabularcolumns:: |p{1.2cm}|p{2.5cm}|p{13.6cm}|

.. c:type:: cec_caps

struct cec_caps

42-65

`driver[32]`는 CEC adapter driver 이름이고 `name[32]`은 이 CEC adapter의 이름입니다. `driver`와 `name`의 조합은 고유해야 합니다.

`available_log_addrs`는 설정할 수 있는 logical address의 최대 개수입니다. `capabilities`는 adapter capability bit 집합입니다.

`version`은 CEC Framework API version이며 `KERNEL_VERSION()` macro 형식으로 저장됩니다.

struct cec_caps 필드
형식·필드의미
char driver[32]CEC adapter driver 이름
char name[32]CEC adapter 이름, driver+name 조합은 고유
__u32 available_log_addrs설정 가능한 logical address 최대 수
__u32 capabilitiesCEC capability flag bitmask
__u32 versionKERNEL_VERSION() 형식의 Framework API version

adapter 식별, logical address 수와 기능·API version을 제공합니다.

.. flat-table:: struct cec_caps
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 16

    * - char
      - ``driver[32]``
      - The name of the cec adapter driver.
    * - char
      - ``name[32]``
      - The name of this CEC adapter. The combination ``driver`` and
	``name`` must be unique.
    * - __u32
      - ``available_log_addrs``
      - The maximum number of logical addresses that can be configured.
    * - __u32
      - ``capabilities``
      - The capabilities of the CEC adapter, see
	:ref:`cec-capabilities`.
    * - __u32
      - ``version``
      - CEC Framework API version, formatted with the ``KERNEL_VERSION()``
	macro.

물리·논리 주소와 전송 capability

66-101

`CEC_CAP_PHYS_ADDR` 값은 `0x00000001`입니다. 설정되어 있으면 사용자 공간이 `CEC_ADAP_S_PHYS_ADDR`로 physical address를 구성해야 합니다.

이 bit가 없으면 kernel이 HDMI receiver의 EDID를 설정하거나 HDMI transmitter의 EDID를 읽을 때 physical address를 설정합니다.

`CEC_CAP_LOG_ADDRS` 값은 `0x00000002`입니다. 설정되어 있으면 사용자 공간이 `CEC_ADAP_S_LOG_ADDRS`로 logical address를 구성해야 하며, 없으면 kernel이 이미 구성합니다.

`CEC_CAP_TRANSMIT` 값은 `0x00000004`입니다. 설정되어 있으면 사용자 공간이 `CEC_TRANSMIT`으로 CEC message를 전송할 수 있습니다.

message 전송은 follower가 되기 위한 전제이므로 이 bit는 사용자 공간 follower 지원도 함축합니다. bit가 없으면 kernel이 모든 CEC 전송과 수신 message 처리를 담당합니다.

주소·전송 capability
Flag의미
CEC_CAP_PHYS_ADDR0x00000001userspace가 physical address 설정
CEC_CAP_LOG_ADDRS0x00000002userspace가 logical address 설정
CEC_CAP_TRANSMIT0x00000004userspace message 전송·follower 가능

bit 유무에 따라 userspace와 kernel의 책임이 달라집니다.

주소 설정 책임
CEC_ADAP_G_CAPS 조회PHYS_ADDR bit 검사있으면 CEC_ADAP_S_PHYS_ADDRLOG_ADDRS bit 검사있으면 CEC_ADAP_S_LOG_ADDRS없으면 kernel 설정 사용

capability bit가 있으면 userspace가, 없으면 kernel이 해당 설정을 담당합니다.

.. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.4cm}|

.. _cec-capabilities:

.. flat-table:: CEC Capabilities Flags
    :header-rows:  0
    :stub-columns: 0
    :widths:       3 1 8

    * .. _`CEC-CAP-PHYS-ADDR`:

      - ``CEC_CAP_PHYS_ADDR``
      - 0x00000001
      - Userspace has to configure the physical address by calling
	:ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`. If
	this capability isn't set, then setting the physical address is
	handled by the kernel whenever the EDID is set (for an HDMI
	receiver) or read (for an HDMI transmitter).
    * .. _`CEC-CAP-LOG-ADDRS`:

      - ``CEC_CAP_LOG_ADDRS``
      - 0x00000002
      - Userspace has to configure the logical addresses by calling
	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`. If
	this capability isn't set, then the kernel will have configured
	this.
    * .. _`CEC-CAP-TRANSMIT`:

      - ``CEC_CAP_TRANSMIT``
      - 0x00000004
      - Userspace can transmit CEC messages by calling
	:ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. This implies that
	userspace can be a follower as well, since being able to transmit
	messages is a prerequisite of becoming a follower. If this
	capability isn't set, then the kernel will handle all CEC
	transmits and process all CEC messages it receives.

Passthrough, remote control과 monitoring

102-126

`CEC_CAP_PASSTHROUGH` 값은 `0x00000008`이며 사용자 공간이 `CEC_S_MODE` ioctl로 passthrough mode를 사용할 수 있음을 뜻합니다.

`CEC_CAP_RC` 값은 `0x00000010`이며 adapter가 remote control protocol을 지원함을 뜻합니다.

`CEC_CAP_MONITOR_ALL` 값은 `0x00000020`입니다. CEC hardware가 directed message와 broadcast message뿐 아니라 모든 message를 monitor할 수 있습니다.

`CEC_CAP_NEEDS_HPD` 값은 `0x00000040`입니다. HDMI Hotplug Detect pin이 high일 때만 CEC hardware가 활성화됩니다.

standby mode에서 HPD를 low로 내리면서 CEC bus는 유지하는 display는 이 hardware에서 CEC로 깨울 수 없습니다.

Mode·monitor capability
Flag의미
CEC_CAP_PASSTHROUGH0x00000008CEC_S_MODE passthrough
CEC_CAP_RC0x00000010remote control protocol
CEC_CAP_MONITOR_ALL0x00000020모든 CEC message 감시
CEC_CAP_NEEDS_HPD0x00000040HPD high일 때만 활성

passthrough, remote control, 전체 message 감시와 HPD 의존성을 나타냅니다.

    * .. _`CEC-CAP-PASSTHROUGH`:

      - ``CEC_CAP_PASSTHROUGH``
      - 0x00000008
      - Userspace can use the passthrough mode by calling
	:ref:`ioctl CEC_S_MODE <CEC_S_MODE>`.
    * .. _`CEC-CAP-RC`:

      - ``CEC_CAP_RC``
      - 0x00000010
      - This adapter supports the remote control protocol.
    * .. _`CEC-CAP-MONITOR-ALL`:

      - ``CEC_CAP_MONITOR_ALL``
      - 0x00000020
      - The CEC hardware can monitor all messages, not just directed and
	broadcast messages.
    * .. _`CEC-CAP-NEEDS-HPD`:

      - ``CEC_CAP_NEEDS_HPD``
      - 0x00000040
      - The CEC hardware is only active if the HDMI Hotplug Detect pin is
        high. This makes it impossible to use CEC to wake up displays that
	set the HPD pin low when in standby mode, but keep the CEC bus
	alive.

Pin, connector와 vendor reply capability

127-146

`CEC_CAP_MONITOR_PIN` 값은 `0x00000080`입니다. CEC hardware가 CEC pin의 low-to-high 및 high-to-low voltage 변화를 monitor할 수 있습니다.

pin monitoring mode에서는 응용 프로그램이 `CEC_EVENT_PIN_CEC_LOW`와 `CEC_EVENT_PIN_CEC_HIGH` event를 받습니다.

`CEC_CAP_CONNECTOR_INFO` 값은 `0x00000100`이며 설정되어 있을 때 `CEC_ADAP_G_CONNECTOR_INFO`를 사용할 수 있습니다.

`CEC_CAP_REPLY_VENDOR_ID` 값은 `0x00000200`이며 설정되어 있을 때 `CEC_MSG_FL_REPLY_VENDOR_ID` message flag를 사용할 수 있습니다.

Pin·connector capability
Flag의미
CEC_CAP_MONITOR_PIN0x00000080CEC pin voltage 변화 event
CEC_CAP_CONNECTOR_INFO0x00000100CEC_ADAP_G_CONNECTOR_INFO 사용
CEC_CAP_REPLY_VENDOR_ID0x00000200CEC_MSG_FL_REPLY_VENDOR_ID 사용

event와 후속 ioctl·message flag 사용 가능 여부를 표시합니다.

    * .. _`CEC-CAP-MONITOR-PIN`:

      - ``CEC_CAP_MONITOR_PIN``
      - 0x00000080
      - The CEC hardware can monitor CEC pin changes from low to high voltage
        and vice versa. When in pin monitoring mode the application will
	receive ``CEC_EVENT_PIN_CEC_LOW`` and ``CEC_EVENT_PIN_CEC_HIGH`` events.
    * .. _`CEC-CAP-CONNECTOR-INFO`:

      - ``CEC_CAP_CONNECTOR_INFO``
      - 0x00000100
      - If this capability is set, then :ref:`CEC_ADAP_G_CONNECTOR_INFO` can
        be used.
    * .. _`CEC-CAP-REPLY-VENDOR-ID`:

      - ``CEC_CAP_REPLY_VENDOR_ID``
      - 0x00000200
      - If this capability is set, then
        :ref:`CEC_MSG_FL_REPLY_VENDOR_ID <cec-msg-flags>` can be used.

반환값

147-152

성공하면 0을 반환하고 오류이면 -1을 반환하면서 `errno`를 설정합니다. 일반 오류 code는 Generic Error Codes 장을 참조합니다.

반환값
항목설명
성공0
오류-1, errno 설정
오류 설명Generic Error Codes 참조

CEC ioctl 공통 반환 규칙입니다.

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.