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

Linux 6.18.37 · Userspace API / Media / CEC

ioctl CEC_ADAP_G_PHYS_ADDR와 CEC_ADAP_S_PHYS_ADDR

CEC physical address 조회·설정, EDID 기반 a.b.c.d topology와 오류를 설명합니다.

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

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

1. 요약·해설

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

요약·해설

cec-ioc-adap-g-phys-addr.rst:1-94

16-bit CEC physical address의 조회·설정 API입니다. 각 nibble은 HDMI topology 한 단계를 나타내며 address 변경은 logical address claim과 state-change event에 연결됩니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: CEC
3
4 .. _CEC_ADAP_PHYS_ADDR:
5 .. _CEC_ADAP_G_PHYS_ADDR:
6 .. _CEC_ADAP_S_PHYS_ADDR:
7
8 ****************************************************
9 ioctls CEC_ADAP_G_PHYS_ADDR and CEC_ADAP_S_PHYS_ADDR
10 ****************************************************
11
12 Name
13 ====
14
15 CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address
16
17 Synopsis
18 ========
19
20 .. c:macro:: CEC_ADAP_G_PHYS_ADDR
21
22 ``int ioctl(int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp)``
23
24 .. c:macro:: CEC_ADAP_S_PHYS_ADDR
25
26 ``int ioctl(int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp)``
27
28 Arguments
29 =========
30
31 ``fd``
32 File descriptor returned by :c:func:`open()`.
33
34 ``argp``
35 Pointer to the CEC address.
36
37 Description
38 ===========
39
40 To query the current physical address applications call
41 :ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the
42 driver stores the physical address.
43
44 To set a new physical address applications store the physical address in
45 a __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` with a pointer to
46 this integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` is only available if
47 ``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned
48 otherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called
49 by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
50 the ``EBUSY`` error code will be returned.
51
52 To clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``.
53 The adapter will go to the unconfigured state.
54
55 If logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`),
56 then this ioctl will block until all
57 requested logical addresses have been claimed. If the file descriptor is in non-blocking mode
58 then it will not wait for the logical addresses to be claimed, instead it just returns 0.
59
60 A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the physical address
61 changes.
62
63 The physical address is a 16-bit number where each group of 4 bits
64 represent a digit of the physical address a.b.c.d where the most
65 significant 4 bits represent 'a'. The CEC root device (usually the TV)
66 has address 0.0.0.0. Every device that is hooked up to an input of the
67 TV has address a.0.0.0 (where 'a' is ≥ 1), devices hooked up to those in
68 turn have addresses a.b.0.0, etc. So a topology of up to 5 devices deep
69 is supported. The physical address a device shall use is stored in the
70 EDID of the sink.
71
72 For example, the EDID for each HDMI input of the TV will have a
73 different physical address of the form a.0.0.0 that the sources will
74 read out and use as their physical address.
75
76 Return Value
77 ============
78
79 On success 0 is returned, on error -1 and the ``errno`` variable is set
80 appropriately. The generic error codes are described at the
81 :ref:`Generic Error Codes <gen-errors>` chapter.
82
83 The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can return the following
84 error codes:
85
86 ENOTTY
87 The ``CEC_CAP_PHYS_ADDR`` capability wasn't set, so this ioctl is not supported.
88
89 EBUSY
90 Another filehandle is in exclusive follower or initiator mode, or the filehandle
91 is in mode ``CEC_MODE_NO_INITIATOR``.
92
93 EINVAL
94 The physical address is malformed.
95

3. 한국어 전문 번역

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

이름, 선언과 인자

1-36

`CEC_ADAP_G_PHYS_ADDR`와 `CEC_ADAP_S_PHYS_ADDR`는 CEC adapter의 physical address를 각각 가져오고 설정하는 ioctl입니다.

조회 함수 형태는 `int ioctl(int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp)`이고 설정은 request만 `CEC_ADAP_S_PHYS_ADDR`로 바뀝니다.

`fd`는 `open()`이 반환한 file descriptor이고 `argp`는 16-bit CEC address를 가리키는 pointer입니다.

Physical address ioctl
항목설명
CEC_ADAP_G_PHYS_ADDR현재 physical address 조회
CEC_ADAP_S_PHYS_ADDR새 physical address 설정
fd열린 CEC device descriptor
argp__u16 *

같은 __u16 값을 조회 결과 또는 설정 입력으로 사용합니다.

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

.. _CEC_ADAP_PHYS_ADDR:
.. _CEC_ADAP_G_PHYS_ADDR:
.. _CEC_ADAP_S_PHYS_ADDR:

****************************************************
ioctls CEC_ADAP_G_PHYS_ADDR and CEC_ADAP_S_PHYS_ADDR
****************************************************

Name
====

CEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address

Synopsis
========

.. c:macro:: CEC_ADAP_G_PHYS_ADDR

``int ioctl(int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp)``

.. c:macro:: CEC_ADAP_S_PHYS_ADDR

``int ioctl(int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp)``

Arguments
=========

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

``argp``
    Pointer to the CEC address.

조회·설정과 상태 변경

37-61

조회 시 응용 프로그램은 `__u16` pointer로 `CEC_ADAP_G_PHYS_ADDR`를 호출하고 driver가 현재 physical address를 저장합니다.

설정 시 응용 프로그램은 `__u16`에 새 address를 저장해 `CEC_ADAP_S_PHYS_ADDR`를 호출합니다. `CEC_CAP_PHYS_ADDR` capability가 없으면 `ENOTTY`를 반환합니다.

설정 ioctl은 initiator mode인 descriptor에서만 호출할 수 있으며 그렇지 않으면 `EBUSY`입니다.

기존 physical address를 지우려면 `CEC_PHYS_ADDR_INVALID`를 설정합니다. 그러면 adapter는 unconfigured state가 됩니다.

logical address type이 정의된 상태라면 설정 ioctl은 요청된 logical address를 모두 claim할 때까지 block합니다. nonblocking descriptor에서는 기다리지 않고 0을 반환합니다.

physical address가 변경되면 `CEC_EVENT_STATE_CHANGE` event를 보냅니다.

Physical address 설정
항목설명
필수 capabilityCEC_CAP_PHYS_ADDR
필수 modeinitiator mode
주소 제거CEC_PHYS_ADDR_INVALID
blockinglogical address claim까지 대기
nonblocking기다리지 않고 0 반환
변경 eventCEC_EVENT_STATE_CHANGE

capability와 descriptor mode, logical address claim 상태가 동작을 결정합니다.

Physical address 변경
CEC_CAP_PHYS_ADDR 확인initiator mode 확인__u16 address 준비CEC_ADAP_S_PHYS_ADDR필요 시 logical address claimCEC_EVENT_STATE_CHANGE

설정 뒤 logical address claim과 state event가 연동될 수 있습니다.

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

To query the current physical address applications call
:ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the
driver stores the physical address.

To set a new physical address applications store the physical address in
a __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` with a pointer to
this integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` is only available if
``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned
otherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called
by a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
the ``EBUSY`` error code will be returned.

To clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``.
The adapter will go to the unconfigured state.

If logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`),
then this ioctl will block until all
requested logical addresses have been claimed. If the file descriptor is in non-blocking mode
then it will not wait for the logical addresses to be claimed, instead it just returns 0.

A :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the physical address
changes.

16-bit physical address topology

62-75

CEC physical address는 16-bit 값이며 각 4-bit group이 `a.b.c.d`의 한 digit을 나타냅니다. 가장 높은 4 bit가 `a`입니다.

CEC root device, 보통 TV의 address는 `0.0.0.0`입니다. TV input에 직접 연결된 device는 `a.0.0.0`이며 `a`는 1 이상입니다.

그 아래 device는 `a.b.0.0`, 다음은 `a.b.c.0` 방식으로 계층을 표현하므로 최대 5개 device 깊이의 topology를 지원합니다.

device가 사용할 physical address는 sink의 EDID에 저장됩니다. 예를 들어 TV의 각 HDMI input EDID에는 서로 다른 `a.0.0.0` address가 들어 있고 source가 이를 읽어 자신의 address로 사용합니다.

CEC topology 주소
항목설명
0.0.0.0root device, 보통 TV
a.0.0.0TV input에 직접 연결
a.b.0.0그 아래 두 번째 계층
a.b.c.d16-bit의 네 nibble
주소 sourcesink EDID

각 nibble이 HDMI 연결 계층의 한 단계를 나타냅니다.

EDID에서 address 획득
TV HDMI inputinput별 EDIDa.0.0.0 physical addresssource가 EDID 읽기CEC adapter address 설정

source는 연결된 HDMI input의 EDID에 기록된 주소를 사용합니다.


The physical address is a 16-bit number where each group of 4 bits
represent a digit of the physical address a.b.c.d where the most
significant 4 bits represent 'a'. The CEC root device (usually the TV)
has address 0.0.0.0. Every device that is hooked up to an input of the
TV has address a.0.0.0 (where 'a' is ≥ 1), devices hooked up to those in
turn have addresses a.b.0.0, etc. So a topology of up to 5 devices deep
is supported. The physical address a device shall use is stored in the
EDID of the sink.

For example, the EDID for each HDMI input of the TV will have a
different physical address of the form a.0.0.0 that the sources will
read out and use as their physical address.

반환값과 오류

76-94

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

`ENOTTY`는 `CEC_CAP_PHYS_ADDR` capability가 없어 설정 ioctl을 지원하지 않음을 뜻합니다.

`EBUSY`는 다른 filehandle이 exclusive follower 또는 initiator mode이거나 현재 filehandle이 `CEC_MODE_NO_INITIATOR`인 경우입니다.

`EINVAL`은 physical address 형식이 잘못됐음을 뜻합니다.

CEC_ADAP_S_PHYS_ADDR 오류
항목설명
ENOTTYCEC_CAP_PHYS_ADDR 없음
EBUSYexclusive mode 충돌 또는 CEC_MODE_NO_INITIATOR
EINVAL잘못된 physical address

지원 여부, mode 충돌과 address 형식을 구분합니다.

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.

The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can return the following
error codes:

ENOTTY
    The ``CEC_CAP_PHYS_ADDR`` capability wasn't set, so this ioctl is not supported.

EBUSY
    Another filehandle is in exclusive follower or initiator mode, or the filehandle
    is in mode ``CEC_MODE_NO_INITIATOR``.

EINVAL
    The physical address is malformed.