요약·해설과 원문, 전문 번역을 서로 분리했습니다. 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_FREQUENCY:
********************************************
ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
********************************************
Name
====
VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency
Synopsis
========
.. c:macro:: VIDIOC_G_FREQUENCY
``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)``
.. c:macro:: VIDIOC_S_FREQUENCY
``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_frequency`.
Description
===========
To get the current tuner or modulator radio frequency applications set
the ``tuner`` field of a struct
:c:type:`v4l2_frequency` to the respective tuner or
modulator number (only input devices have tuners, only output devices
have modulators), zero out the ``reserved`` array and call the
:ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The
driver stores the current frequency in the ``frequency`` field.
To change the current tuner or modulator radio frequency applications
initialize the ``tuner``, ``type`` and ``frequency`` fields, and the
``reserved`` array of a struct :c:type:`v4l2_frequency`
and call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this
structure. When the requested frequency is not possible the driver
assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a
write-only ioctl, it does not return the actual new frequency.
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. c:type:: v4l2_frequency
.. flat-table:: struct v4l2_frequency
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``tuner``
- The tuner or modulator index number. This is the same value as in
the struct :c:type:`v4l2_input` ``tuner`` field and
the struct :c:type:`v4l2_tuner` ``index`` field, or
the struct :c:type:`v4l2_output` ``modulator`` field
and the struct :c:type:`v4l2_modulator` ``index``
field.
* - __u32
- ``type``
- The tuner type. This is the same value as in the struct
:c:type:`v4l2_tuner` ``type`` field. The type must be
set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
``V4L2_TUNER_RADIO`` for modulators (currently only radio
modulators are supported). See :c:type:`v4l2_tuner_type`
* - __u32
- ``frequency``
- Tuning frequency in units of 62.5 kHz, or if the struct
:c:type:`v4l2_tuner` or struct
:c:type:`v4l2_modulator` ``capability`` flag
``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is
used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
* - __u32
- ``reserved``\ [8]
- Reserved for future extensions. Drivers and applications must set
the array to zero.
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.
EINVAL
The ``tuner`` index is out of bounds or the value in the ``type``
field is wrong.
EBUSY
A hardware seek is in progress.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
목적, 호출 형식과 인자
1-34`VIDIOC_G_FREQUENCY`와 `VIDIOC_S_FREQUENCY`는 tuner 또는 modulator의 무선 주파수를 조회하거나 설정합니다. 입력 장치에는 tuner만 있고 출력 장치에는 modulator만 있습니다.
두 ioctl은 `struct v4l2_frequency`를 사용합니다. 조회는 수정 가능한 포인터를, 설정은 `const struct v4l2_frequency *argp`를 받으며 `fd`는 `open()`이 반환한 파일 디스크립터입니다.
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. _VIDIOC_G_FREQUENCY:
********************************************
ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
********************************************
Name
====
VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency
Synopsis
========
.. c:macro:: VIDIOC_G_FREQUENCY
``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)``
.. c:macro:: VIDIOC_S_FREQUENCY
``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)``
Arguments
=========
``fd``
File descriptor returned by :c:func:`open()`.
``argp``
Pointer to struct :c:type:`v4l2_frequency`.
현재 주파수 조회와 설정
35-53현재 주파수를 읽으려면 `tuner`를 대상 tuner 또는 modulator 번호로 설정하고 `reserved` 배열을 0으로 만든 뒤 `VIDIOC_G_FREQUENCY`를 호출합니다. 드라이버가 현재 값을 `frequency`에 저장합니다.
주파수를 바꾸려면 `tuner`, `type`, `frequency`와 `reserved`를 초기화한 뒤 `VIDIOC_S_FREQUENCY`를 호출합니다. 요청값이 불가능하면 드라이버가 가장 가까운 가능한 주파수를 사용합니다.
S_FREQUENCY는 write-only ioctl이므로 실제로 선택된 새 주파수를 구조체에 돌려주지 않습니다. 조정된 값을 알아야 하면 설정 후 G_FREQUENCY로 다시 조회해야 합니다.
설정 호출의 입력 구조체를 결과로 해석하지 않고 별도 조회합니다.
Description
===========
To get the current tuner or modulator radio frequency applications set
the ``tuner`` field of a struct
:c:type:`v4l2_frequency` to the respective tuner or
modulator number (only input devices have tuners, only output devices
have modulators), zero out the ``reserved`` array and call the
:ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The
driver stores the current frequency in the ``frequency`` field.
To change the current tuner or modulator radio frequency applications
initialize the ``tuner``, ``type`` and ``frequency`` fields, and the
``reserved`` array of a struct :c:type:`v4l2_frequency`
and call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this
structure. When the requested frequency is not possible the driver
assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a
write-only ioctl, it does not return the actual new frequency.
struct v4l2_frequency
54-90대상 index, tuner 종류와 capability별 단위를 전달합니다.
tuner 또는 modulator capability flag가 단위를 선택합니다.
현재 지원되는 modulator는 radio modulator뿐이므로 modulator의 `type`은 `V4L2_TUNER_RADIO`입니다. 단위는 `v4l2_tuner` 또는 `v4l2_modulator.capability`를 먼저 확인해 해석해야 합니다.
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
.. c:type:: v4l2_frequency
.. flat-table:: struct v4l2_frequency
:header-rows: 0
:stub-columns: 0
:widths: 1 1 2
* - __u32
- ``tuner``
- The tuner or modulator index number. This is the same value as in
the struct :c:type:`v4l2_input` ``tuner`` field and
the struct :c:type:`v4l2_tuner` ``index`` field, or
the struct :c:type:`v4l2_output` ``modulator`` field
and the struct :c:type:`v4l2_modulator` ``index``
field.
* - __u32
- ``type``
- The tuner type. This is the same value as in the struct
:c:type:`v4l2_tuner` ``type`` field. The type must be
set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
``V4L2_TUNER_RADIO`` for modulators (currently only radio
modulators are supported). See :c:type:`v4l2_tuner_type`
* - __u32
- ``frequency``
- Tuning frequency in units of 62.5 kHz, or if the struct
:c:type:`v4l2_tuner` or struct
:c:type:`v4l2_modulator` ``capability`` flag
``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is
used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
* - __u32
- ``reserved``\ [8]
- Reserved for future extensions. Drivers and applications must set
the array to zero.
반환값과 오류
91-103성공하면 0을 반환합니다. 오류가 발생하면 -1을 반환하고 `errno`를 설정하며 Generic Error Codes 장의 공통 오류도 적용됩니다.
index·type과 하드웨어 seek 상태에 따른 오류입니다.
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.
EINVAL
The ``tuner`` index is out of bounds or the value in the ``type``
field is wrong.
EBUSY
A hardware seek is in progress.
요약·해설
vidioc-g-frequency.rst:1-103tuner 또는 modulator의 주파수와 단위를 다루며 설정 뒤 실제 조정값은 별도 조회해야 합니다.