← Documents Documentation/userspace-api/media/v4l/vidioc-g-edid.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_G_EDID·VIDIOC_S_EDID ioctl

V4L2 비디오·서브디바이스 노드에서 수신기 입력 또는 송신기 출력의 EDID를 조회하고, 수신기 EDID 전체를 설정·비활성화하는 ioctl과 블록 단위 버퍼·오류 규칙을 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/vidioc-g-edid.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

vidioc-g-edid.rst:1-146

V4L2 비디오·서브디바이스 노드에서 수신기 입력 또는 송신기 출력의 EDID를 조회하고, 수신기 EDID 전체를 설정·비활성화하는 ioctl과 블록 단위 버퍼·오류 규칙을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_G_EDID:
5
6 ******************************************************************************
7 ioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
8 ******************************************************************************
9
10 Name
11 ====
12
13 VIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_G_EDID
19
20 ``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``
21
22 .. c:macro:: VIDIOC_S_EDID
23
24 ``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``
25
26 .. c:macro:: VIDIOC_SUBDEV_G_EDID
27
28 ``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``
29
30 .. c:macro:: VIDIOC_SUBDEV_S_EDID
31
32 ``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``
33
34 Arguments
35 =========
36
37 ``fd``
38 File descriptor returned by :c:func:`open()`.
39
40 ``argp``
41 Pointer to struct :c:type:`v4l2_edid`.
42
43 Description
44 ===========
45
46 These ioctls can be used to get or set an EDID associated with an input
47 from a receiver or an output of a transmitter device. They can be used
48 with subdevice nodes (/dev/v4l-subdevX) or with video nodes
49 (/dev/videoX).
50
51 When used with video nodes the ``pad`` field represents the input (for
52 video capture devices) or output (for video output devices) index as is
53 returned by :ref:`VIDIOC_ENUMINPUT` and
54 :ref:`VIDIOC_ENUMOUTPUT` respectively. When used
55 with subdevice nodes the ``pad`` field represents the input or output
56 pad of the subdevice. If there is no EDID support for the given ``pad``
57 value, then the ``EINVAL`` error code will be returned.
58
59 To get the EDID data the application has to fill in the ``pad``,
60 ``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
61 array and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
62 ``start_block`` and of size ``blocks`` will be placed in the memory
63 ``edid`` points to. The ``edid`` pointer must point to memory at least
64 ``blocks`` * 128 bytes large (the size of one block is 128 bytes).
65
66 If there are fewer blocks than specified, then the driver will set
67 ``blocks`` to the actual number of blocks. If there are no EDID blocks
68 available at all, then the error code ``ENODATA`` is set.
69
70 If blocks have to be retrieved from the sink, then this call will block
71 until they have been read.
72
73 If ``start_block`` and ``blocks`` are both set to 0 when
74 :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
75 total number of available EDID blocks and it will return 0 without
76 copying any data. This is an easy way to discover how many EDID blocks
77 there are.
78
79 .. note::
80
81 If there are no EDID blocks available at all, then
82 the driver will set ``blocks`` to 0 and it returns 0.
83
84 To set the EDID blocks of a receiver the application has to fill in the
85 ``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
86 zero the ``reserved`` array. It is not possible to set part of an EDID,
87 it is always all or nothing. Setting the EDID data is only valid for
88 receivers as it makes no sense for a transmitter.
89
90 The driver assumes that the full EDID is passed in. If there are more
91 EDID blocks than the hardware can handle then the EDID is not written,
92 but instead the error code ``E2BIG`` is set and ``blocks`` is set to the
93 maximum that the hardware supports. If ``start_block`` is any value
94 other than 0 then the error code ``EINVAL`` is set.
95
96 To disable an EDID you set ``blocks`` to 0. Depending on the hardware
97 this will drive the hotplug pin low and/or block the source from reading
98 the EDID data in some way. In any case, the end result is the same: the
99 EDID is no longer available.
100
101 .. c:type:: v4l2_edid
102
103 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
104
105 .. flat-table:: struct v4l2_edid
106 :header-rows: 0
107 :stub-columns: 0
108 :widths: 1 1 2
109
110 * - __u32
111 - ``pad``
112 - Pad for which to get/set the EDID blocks. When used with a video
113 device node the pad represents the input or output index as
114 returned by :ref:`VIDIOC_ENUMINPUT` and
115 :ref:`VIDIOC_ENUMOUTPUT` respectively.
116 * - __u32
117 - ``start_block``
118 - Read the EDID from starting with this block. Must be 0 when
119 setting the EDID.
120 * - __u32
121 - ``blocks``
122 - The number of blocks to get or set. Must be less or equal to 256
123 (the maximum number of blocks as defined by the standard). When
124 you set the EDID and ``blocks`` is 0, then the EDID is disabled or
125 erased.
126 * - __u32
127 - ``reserved``\ [5]
128 - Reserved for future extensions. Applications and drivers must set
129 the array to zero.
130 * - __u8 *
131 - ``edid``
132 - Pointer to memory that contains the EDID. The minimum size is
133 ``blocks`` * 128.
134
135 Return Value
136 ============
137
138 On success 0 is returned, on error -1 and the ``errno`` variable is set
139 appropriately. The generic error codes are described at the
140 :ref:`Generic Error Codes <gen-errors>` chapter.
141
142 ``ENODATA``
143 The EDID data is not available.
144
145 ``E2BIG``
146 The EDID data you provided is more than the hardware can handle.
147

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-42

`VIDIOC_G_EDID`, `VIDIOC_S_EDID`, `VIDIOC_SUBDEV_G_EDID`, `VIDIOC_SUBDEV_S_EDID`는 비디오 수신기의 입력 또는 송신기의 출력에 연결된 EDID를 조회하거나 설정합니다. 앞의 두 명령은 비디오 노드, `SUBDEV` 명령은 서브디바이스 노드에 대응합니다.

네 ioctl은 모두 `struct v4l2_edid *argp`를 받습니다. `fd`는 `open()`이 반환한 파일 디스크립터이고, `argp`는 대상 pad와 EDID 블록 범위 및 데이터 버퍼를 지정하는 `v4l2_edid` 구조체를 가리킵니다.

EDID ioctl 집합
명령동작대상
`VIDIOC_G_EDID`EDID 조회비디오 노드
`VIDIOC_S_EDID`EDID 설정비디오 노드
`VIDIOC_SUBDEV_G_EDID`EDID 조회서브디바이스 노드
`VIDIOC_SUBDEV_S_EDID`EDID 설정서브디바이스 노드

노드 종류와 조회·설정 방향에 따라 사용할 명령을 구분합니다.

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

.. _VIDIOC_G_EDID:

******************************************************************************
ioctl VIDIOC_G_EDID, VIDIOC_S_EDID, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_S_EDID
******************************************************************************

Name
====

VIDIOC_G_EDID - VIDIOC_S_EDID - VIDIOC_SUBDEV_G_EDID - VIDIOC_SUBDEV_S_EDID - Get or set the EDID of a video receiver/transmitter

Synopsis
========

.. c:macro:: VIDIOC_G_EDID

``int ioctl(int fd, VIDIOC_G_EDID, struct v4l2_edid *argp)``

.. c:macro:: VIDIOC_S_EDID

``int ioctl(int fd, VIDIOC_S_EDID, struct v4l2_edid *argp)``

.. c:macro:: VIDIOC_SUBDEV_G_EDID

``int ioctl(int fd, VIDIOC_SUBDEV_G_EDID, struct v4l2_edid *argp)``

.. c:macro:: VIDIOC_SUBDEV_S_EDID

``int ioctl(int fd, VIDIOC_SUBDEV_S_EDID, struct v4l2_edid *argp)``

Arguments
=========

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

``argp``
   Pointer to struct :c:type:`v4l2_edid`.

노드별 pad 의미와 지원 여부

43-58

이 명령은 `/dev/v4l-subdevX` 서브디바이스 노드와 `/dev/videoX` 비디오 노드에서 사용할 수 있습니다. 수신 장치에서는 입력에 연결된 EDID를, 송신 장치에서는 출력에 연결된 EDID를 다룹니다.

비디오 캡처 노드에서 `pad`는 `VIDIOC_ENUMINPUT`이 반환하는 입력 인덱스이고, 비디오 출력 노드에서는 `VIDIOC_ENUMOUTPUT`이 반환하는 출력 인덱스입니다. 서브디바이스 노드에서는 해당 서브디바이스의 실제 입력 또는 출력 pad 번호입니다.

지정한 `pad`가 EDID를 지원하지 않으면 드라이버는 `EINVAL`을 반환합니다. 따라서 애플리케이션은 노드 종류에 맞는 인덱스 의미를 적용하고, 지원되지 않는 pad를 정상적인 기능 부재로 처리해야 합니다.

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

These ioctls can be used to get or set an EDID associated with an input
from a receiver or an output of a transmitter device. They can be used
with subdevice nodes (/dev/v4l-subdevX) or with video nodes
(/dev/videoX).

When used with video nodes the ``pad`` field represents the input (for
video capture devices) or output (for video output devices) index as is
returned by :ref:`VIDIOC_ENUMINPUT` and
:ref:`VIDIOC_ENUMOUTPUT` respectively. When used
with subdevice nodes the ``pad`` field represents the input or output
pad of the subdevice. If there is no EDID support for the given ``pad``
value, then the ``EINVAL`` error code will be returned.

EDID 조회와 블록 수 탐색

59-83

EDID 데이터를 읽으려면 `pad`, `start_block`, `blocks`, `edid`를 채우고 `reserved` 배열을 0으로 만든 뒤 `VIDIOC_G_EDID`를 호출합니다. 드라이버는 `start_block`에서 시작하는 최대 `blocks`개의 블록을 `edid`가 가리키는 메모리에 기록합니다.

EDID 한 블록은 128바이트이므로 버퍼는 적어도 `blocks * 128`바이트여야 합니다. 실제 남은 블록 수가 요청보다 적으면 드라이버가 `blocks`를 실제 반환 블록 수로 줄입니다. 일반 조회에서 사용 가능한 블록이 전혀 없으면 `ENODATA`입니다.

블록을 sink에서 새로 가져와야 한다면 ioctl은 읽기가 끝날 때까지 블록될 수 있습니다. 호출 스레드의 지연 가능성을 고려해야 합니다.

블록 수만 알아보려면 `start_block = 0`, `blocks = 0`으로 호출합니다. 이 특수 탐색은 데이터를 복사하지 않고 전체 블록 수를 `blocks`에 기록한 뒤 0을 반환합니다. EDID가 없어도 오류가 아니라 `blocks = 0`과 성공 반환이므로, 일반 조회의 `ENODATA`와 구별해야 합니다.

EDID 조회 절차
pad 지정, reserved[5]를 0으로 초기화start_block=0, blocks=0으로 전체 블록 수 탐색반환된 blocks * 128바이트 버퍼 준비start_block, blocks, edid를 채워 VIDIOC_G_EDID 호출줄어든 blocks 또는 ENODATA 처리

필요한 블록 수를 먼저 확인한 뒤 정확한 크기의 버퍼로 데이터를 읽을 수 있습니다.

To get the EDID data the application has to fill in the ``pad``,
``start_block``, ``blocks`` and ``edid`` fields, zero the ``reserved``
array and call :ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>`. The current EDID from block
``start_block`` and of size ``blocks`` will be placed in the memory
``edid`` points to. The ``edid`` pointer must point to memory at least
``blocks`` * 128 bytes large (the size of one block is 128 bytes).

If there are fewer blocks than specified, then the driver will set
``blocks`` to the actual number of blocks. If there are no EDID blocks
available at all, then the error code ``ENODATA`` is set.

If blocks have to be retrieved from the sink, then this call will block
until they have been read.

If ``start_block`` and ``blocks`` are both set to 0 when
:ref:`VIDIOC_G_EDID <VIDIOC_G_EDID>` is called, then the driver will set ``blocks`` to the
total number of available EDID blocks and it will return 0 without
copying any data. This is an easy way to discover how many EDID blocks
there are.

.. note::

   If there are no EDID blocks available at all, then
   the driver will set ``blocks`` to 0 and it returns 0.

EDID 전체 설정과 비활성화

84-100

수신기의 EDID를 설정하려면 `pad`, `blocks`, `edid`를 채우고 `start_block`을 0으로 설정하며 `reserved`를 모두 0으로 만듭니다. EDID 일부만 갱신할 수는 없고 항상 전체 EDID를 한 번에 전달해야 합니다. 설정은 수신기에만 유효하며 송신기에는 의미가 없습니다.

드라이버는 전달된 데이터가 완전한 EDID라고 가정합니다. 블록 수가 하드웨어 한도를 넘으면 EDID를 전혀 기록하지 않고 `E2BIG`을 반환하며, `blocks`를 하드웨어가 지원하는 최대값으로 바꿉니다. 설정 호출에서 `start_block`이 0이 아니면 `EINVAL`입니다.

EDID를 비활성화하거나 지우려면 설정 호출에서 `blocks`를 0으로 둡니다. 하드웨어에 따라 hotplug 핀을 low로 내리거나 source가 EDID를 읽지 못하게 막을 수 있지만, 최종 결과는 EDID가 더 이상 제공되지 않는다는 점으로 같습니다.

EDID 설정 절차
대상이 receiver인지 확인pad와 전체 EDID 버퍼 준비start_block=0, reserved[5]=0 설정blocks와 edid를 채워 설정 ioctl 호출E2BIG이면 blocks에 돌아온 하드웨어 한도 확인비활성화할 때는 blocks=0으로 다시 호출

부분 쓰기를 허용하지 않는 전체 단위 갱신입니다.

To set the EDID blocks of a receiver the application has to fill in the
``pad``, ``blocks`` and ``edid`` fields, set ``start_block`` to 0 and
zero the ``reserved`` array. It is not possible to set part of an EDID,
it is always all or nothing. Setting the EDID data is only valid for
receivers as it makes no sense for a transmitter.

The driver assumes that the full EDID is passed in. If there are more
EDID blocks than the hardware can handle then the EDID is not written,
but instead the error code ``E2BIG`` is set and ``blocks`` is set to the
maximum that the hardware supports. If ``start_block`` is any value
other than 0 then the error code ``EINVAL`` is set.

To disable an EDID you set ``blocks`` to 0. Depending on the hardware
this will drive the hotplug pin low and/or block the source from reading
the EDID data in some way. In any case, the end result is the same: the
EDID is no longer available.

struct v4l2_edid

101-134
struct v4l2_edid 필드
형식필드의미와 제약
`__u32``pad`EDID를 조회·설정할 pad. 비디오 노드에서는 `VIDIOC_ENUMINPUT` 또는 `VIDIOC_ENUMOUTPUT` 인덱스
`__u32``start_block`읽기를 시작할 EDID 블록. 설정할 때는 반드시 0
`__u32``blocks`조회·설정할 블록 수. 표준상 최대 256이며, 설정에서 0이면 EDID 비활성화 또는 삭제
`__u32[5]``reserved[5]`미래 확장용. 애플리케이션과 드라이버 모두 전체 배열을 0으로 설정
`__u8 *``edid`EDID 메모리 포인터. 최소 크기는 `blocks * 128`바이트

조회와 설정에서 각 필드의 방향과 제약을 확인합니다.

`blocks`는 256 이하여야 합니다. 조회에서는 요청량이자 실제 반환량이며, 설정에서는 전달량 또는 비활성화 지시로 쓰입니다. 같은 필드가 입출력 양쪽 역할을 하므로 ioctl 뒤의 값을 다시 확인해야 합니다.

.. c:type:: v4l2_edid

.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|

.. flat-table:: struct v4l2_edid
    :header-rows:  0
    :stub-columns: 0
    :widths:       1 1 2

    * - __u32
      - ``pad``
      - Pad for which to get/set the EDID blocks. When used with a video
	device node the pad represents the input or output index as
	returned by :ref:`VIDIOC_ENUMINPUT` and
	:ref:`VIDIOC_ENUMOUTPUT` respectively.
    * - __u32
      - ``start_block``
      - Read the EDID from starting with this block. Must be 0 when
	setting the EDID.
    * - __u32
      - ``blocks``
      - The number of blocks to get or set. Must be less or equal to 256
	(the maximum number of blocks as defined by the standard). When
	you set the EDID and ``blocks`` is 0, then the EDID is disabled or
	erased.
    * - __u32
      - ``reserved``\ [5]
      - Reserved for future extensions. Applications and drivers must set
	the array to zero.
    * - __u8 *
      - ``edid``
      - Pointer to memory that contains the EDID. The minimum size is
	``blocks`` * 128.

반환값과 오류

135-146

성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 설정하며, 이 문서에 적힌 전용 오류 외에도 Generic Error Codes 장의 공통 오류가 적용됩니다.

EDID 전용 및 본문 오류
errno조건후속 확인
`ENODATA`일반 조회에서 EDID 데이터를 사용할 수 없음0/0 블록 수 탐색의 성공 반환과 구별
`E2BIG`제공한 EDID가 하드웨어 처리 한도를 초과`blocks`에 기록된 최대 지원 블록 수 확인
`EINVAL`pad가 EDID를 지원하지 않거나 설정 시 start_block이 0이 아님pad 의미와 설정 인자 재검사

반환 표와 본문에서 명시한 조건을 함께 정리합니다.

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.

``ENODATA``
    The EDID data is not available.

``E2BIG``
    The EDID data you provided is more than the hardware can handle.