요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_SUBDEV_QUERYCAP:
****************************
ioctl VIDIOC_SUBDEV_QUERYCAP
****************************
Name
====
VIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_QUERYCAP
``int ioctl(int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_capability`.
Description
===========
All V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to
identify kernel devices compatible with this specification and to obtain
information about driver and hardware capabilities. The ioctl takes a pointer to
a struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
the driver is not compatible with this specification the ioctl returns
``ENOTTY`` error code.
.. tabularcolumns:: |p{1.5cm}|p{2.9cm}|p{12.9cm}|
.. c:type:: v4l2_subdev_capability
.. flat-table:: struct v4l2_subdev_capability
:header-rows: 0
:stub-columns: 0
:widths: 3 4 20
* - __u32
- ``version``
- Version number of the driver.
The version reported is provided by the V4L2 subsystem following the
kernel numbering scheme. However, it may not always return the same
version as the kernel if, for example, a stable or
distribution-modified kernel uses the V4L2 stack from a newer kernel.
The version number is formatted using the ``KERNEL_VERSION()``
macro:
* - :cspan:`2`
``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
``__u32 version = KERNEL_VERSION(0, 8, 1);``
``printf ("Version: %u.%u.%u\\n",``
``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
* - __u32
- ``capabilities``
- Sub-device capabilities of the opened device, see
:ref:`subdevice-capabilities`.
* - __u32
- ``reserved``\ [14]
- Reserved for future extensions. Set to 0 by the V4L2 core.
.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.1cm}|
.. _subdevice-capabilities:
.. cssclass:: longtable
.. flat-table:: Sub-Device Capabilities Flags
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
* - V4L2_SUBDEV_CAP_RO_SUBDEV
- 0x00000001
- The sub-device device node is registered in read-only mode.
Access to the sub-device ioctls that modify the device state is
restricted. Refer to each individual subdevice ioctl documentation
for a description of which restrictions apply to a read-only sub-device.
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.
ENOTTY
The device node is not a V4L2 sub-device.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 인자
1-30`VIDIOC_SUBDEV_QUERYCAP`은 서브디바이스 장치가 이 V4L2 명세와 호환되는지 식별하고 드라이버·하드웨어 capability를 조회합니다. 모든 V4L2 서브디바이스가 지원해야 하며 `argp`는 `struct v4l2_subdev_capability`을 가리킵니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_SUBDEV_QUERYCAP:
****************************
ioctl VIDIOC_SUBDEV_QUERYCAP
****************************
Name
====
VIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
Synopsis
========
.. c:macro:: VIDIOC_SUBDEV_QUERYCAP
``int ioctl(int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_subdev_capability`.
호환 장치 식별
31-40드라이버는 전달받은 구조체를 채웁니다. 장치 노드의 드라이버가 이 명세와 호환되지 않으면 `ENOTTY`를 반환하므로, ioctl 성공 여부가 V4L2 서브디바이스 식별 절차가 됩니다.
장치 노드를 열고 QUERYCAP 결과로 종류를 판별합니다.
Description
===========
All V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to
identify kernel devices compatible with this specification and to obtain
information about driver and hardware capabilities. The ioctl takes a pointer to
a struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
the driver is not compatible with this specification the ioctl returns
``ENOTTY`` error code.
구조체와 드라이버 버전
41-76드라이버 버전과 열린 장치의 capability를 보고합니다.
보고된 `version`은 안정 버전이나 배포판 수정 커널이 더 새 V4L2 stack을 가져온 경우 실행 중인 커널 버전과 다를 수 있습니다. 따라서 이 값은 V4L2 subsystem이 보고하는 드라이버 버전으로 해석해야 합니다.
`KERNEL_VERSION(a,b,c)`가 32비트 값에 버전 요소를 넣는 위치입니다.
.. tabularcolumns:: |p{1.5cm}|p{2.9cm}|p{12.9cm}|
.. c:type:: v4l2_subdev_capability
.. flat-table:: struct v4l2_subdev_capability
:header-rows: 0
:stub-columns: 0
:widths: 3 4 20
* - __u32
- ``version``
- Version number of the driver.
The version reported is provided by the V4L2 subsystem following the
kernel numbering scheme. However, it may not always return the same
version as the kernel if, for example, a stable or
distribution-modified kernel uses the V4L2 stack from a newer kernel.
The version number is formatted using the ``KERNEL_VERSION()``
macro:
* - :cspan:`2`
``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
``__u32 version = KERNEL_VERSION(0, 8, 1);``
``printf ("Version: %u.%u.%u\\n",``
``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
* - __u32
- ``capabilities``
- Sub-device capabilities of the opened device, see
:ref:`subdevice-capabilities`.
* - __u32
- ``reserved``\ [14]
- Reserved for future extensions. Set to 0 by the V4L2 core.
서브디바이스 capability
77-95현재 정의된 읽기 전용 장치 노드 비트입니다.
읽기 전용 노드에서 어떤 제한이 적용되는지는 각 서브디바이스 ioctl 문서가 정의합니다. 일반적으로 TRY 상태 조회·협상은 허용될 수 있지만 ACTIVE 상태 변경은 제한됩니다.
.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.1cm}|
.. _subdevice-capabilities:
.. cssclass:: longtable
.. flat-table:: Sub-Device Capabilities Flags
:header-rows: 0
:stub-columns: 0
:widths: 3 1 4
* - V4L2_SUBDEV_CAP_RO_SUBDEV
- 0x00000001
- The sub-device device node is registered in read-only mode.
Access to the sub-device ioctls that modify the device state is
restricted. Refer to each individual subdevice ioctl documentation
for a description of which restrictions apply to a read-only sub-device.
반환값과 ENOTTY
96-104성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다.
장치 노드 종류를 판별하는 오류입니다.
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.
ENOTTY
The device node is not a V4L2 sub-device.
요약·해설
vidioc-subdev-querycap.rst:1-104QUERYCAP 성공 여부로 V4L2 서브디바이스를 식별하고, 읽기 전용 비트가 있으면 각 상태 변경 ioctl의 TRY·ACTIVE 제한을 개별 문서에서 확인해야 합니다.