요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. 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`.
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.
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.
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.
.. 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.
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.
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` 구조체를 가리킵니다.
노드 종류와 조회·설정 방향에 따라 사용할 명령을 구분합니다.
.. 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-83EDID 데이터를 읽으려면 `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`와 구별해야 합니다.
필요한 블록 수를 먼저 확인한 뒤 정확한 크기의 버퍼로 데이터를 읽을 수 있습니다.
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가 더 이상 제공되지 않는다는 점으로 같습니다.
부분 쓰기를 허용하지 않는 전체 단위 갱신입니다.
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조회와 설정에서 각 필드의 방향과 제약을 확인합니다.
`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 장의 공통 오류가 적용됩니다.
반환 표와 본문에서 명시한 조건을 함께 정리합니다.
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.
요약·해설
vidioc-g-edid.rst:1-146V4L2 비디오·서브디바이스 노드에서 수신기 입력 또는 송신기 출력의 EDID를 조회하고, 수신기 EDID 전체를 설정·비활성화하는 ioctl과 블록 단위 버퍼·오류 규칙을 설명합니다.