← Documents Documentation/userspace-api/media/v4l/vidioc-s-hw-freq-seek.rst GitHub 원문 ↗

Linux 6.18.37 · 사용자 공간 API

VIDIOC_S_HW_FREQ_SEEK ioctl

튜너의 하드웨어 주파수 탐색 범위, 방향, 간격, capability와 실패 시 복원 규칙을 설명합니다.

Source pathDocumentation/userspace-api/media/v4l/vidioc-s-hw-freq-seek.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

vidioc-s-hw-freq-seek.rst:1-137

검색 대역 제한을 프로그래밍할 수 있는 장치와 정확한 대역 경계만 받는 장치를 구분하고, 단위 capability까지 확인해야 안전한 탐색 요청을 만들 수 있습니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2 .. c:namespace:: V4L
3
4 .. _VIDIOC_S_HW_FREQ_SEEK:
5
6 ***************************
7 ioctl VIDIOC_S_HW_FREQ_SEEK
8 ***************************
9
10 Name
11 ====
12
13 VIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek
14
15 Synopsis
16 ========
17
18 .. c:macro:: VIDIOC_S_HW_FREQ_SEEK
19
20 ``int ioctl(int fd, VIDIOC_S_HW_FREQ_SEEK, struct v4l2_hw_freq_seek *argp)``
21
22 Arguments
23 =========
24
25 ``fd``
26 File descriptor returned by :c:func:`open()`.
27
28 ``argp``
29 Pointer to struct :c:type:`v4l2_hw_freq_seek`.
30
31 Description
32 ===========
33
34 Start a hardware frequency seek from the current frequency. To do this
35 applications initialize the ``tuner``, ``type``, ``seek_upward``,
36 ``wrap_around``, ``spacing``, ``rangelow`` and ``rangehigh`` fields, and
37 zero out the ``reserved`` array of a struct
38 :c:type:`v4l2_hw_freq_seek` and call the
39 ``VIDIOC_S_HW_FREQ_SEEK`` ioctl with a pointer to this structure.
40
41 The ``rangelow`` and ``rangehigh`` fields can be set to a non-zero value
42 to tell the driver to search a specific band. If the struct
43 :c:type:`v4l2_tuner` ``capability`` field has the
44 ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag set, these values must fall
45 within one of the bands returned by
46 :ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
47 ``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag is not set, then these values
48 must exactly match those of one of the bands returned by
49 :ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
50 current frequency of the tuner does not fall within the selected band it
51 will be clamped to fit in the band before the seek is started.
52
53 If an error is returned, then the original frequency will be restored.
54
55 This ioctl is supported if the ``V4L2_CAP_HW_FREQ_SEEK`` capability is
56 set.
57
58 If this ioctl is called from a non-blocking filehandle, then ``EAGAIN``
59 error code is returned and no seek takes place.
60
61 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
62
63 .. c:type:: v4l2_hw_freq_seek
64
65 .. flat-table:: struct v4l2_hw_freq_seek
66 :header-rows: 0
67 :stub-columns: 0
68 :widths: 1 1 2
69
70 * - __u32
71 - ``tuner``
72 - The tuner index number. This is the same value as in the struct
73 :c:type:`v4l2_input` ``tuner`` field and the struct
74 :c:type:`v4l2_tuner` ``index`` field.
75 * - __u32
76 - ``type``
77 - The tuner type. This is the same value as in the struct
78 :c:type:`v4l2_tuner` ``type`` field. See
79 :c:type:`v4l2_tuner_type`
80 * - __u32
81 - ``seek_upward``
82 - If non-zero, seek upward from the current frequency, else seek
83 downward.
84 * - __u32
85 - ``wrap_around``
86 - If non-zero, wrap around when at the end of the frequency range,
87 else stop seeking. The struct :c:type:`v4l2_tuner`
88 ``capability`` field will tell you what the hardware supports.
89 * - __u32
90 - ``spacing``
91 - If non-zero, defines the hardware seek resolution in Hz. The
92 driver selects the nearest value that is supported by the device.
93 If spacing is zero a reasonable default value is used.
94 * - __u32
95 - ``rangelow``
96 - If non-zero, the lowest tunable frequency of the band to search in
97 units of 62.5 kHz, or if the struct
98 :c:type:`v4l2_tuner` ``capability`` field has the
99 ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
100 struct :c:type:`v4l2_tuner` ``capability`` field has
101 the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
102 ``rangelow`` is zero a reasonable default value is used.
103 * - __u32
104 - ``rangehigh``
105 - If non-zero, the highest tunable frequency of the band to search
106 in units of 62.5 kHz, or if the struct
107 :c:type:`v4l2_tuner` ``capability`` field has the
108 ``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
109 struct :c:type:`v4l2_tuner` ``capability`` field has
110 the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
111 ``rangehigh`` is zero a reasonable default value is used.
112 * - __u32
113 - ``reserved``\ [5]
114 - Reserved for future extensions. Applications must set the array to
115 zero.
116
117 Return Value
118 ============
119
120 On success 0 is returned, on error -1 and the ``errno`` variable is set
121 appropriately. The generic error codes are described at the
122 :ref:`Generic Error Codes <gen-errors>` chapter.
123
124 EINVAL
125 The ``tuner`` index is out of bounds, the ``wrap_around`` value is
126 not supported or one of the values in the ``type``, ``rangelow`` or
127 ``rangehigh`` fields is wrong.
128
129 EAGAIN
130 Attempted to call ``VIDIOC_S_HW_FREQ_SEEK`` with the filehandle in
131 non-blocking mode.
132
133 ENODATA
134 The hardware seek found no channels.
135
136 EBUSY
137 Another hardware seek is already in progress.
138

3. 한국어 전문 번역

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

목적, 호출 형식과 인자

1-30

`VIDIOC_S_HW_FREQ_SEEK`는 현재 튜너 주파수에서 하드웨어 주파수 탐색을 시작합니다. `fd`는 `open()`이 반환한 파일 디스크립터이고, `argp`는 탐색 조건을 담은 `struct v4l2_hw_freq_seek`를 가리킵니다.

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

.. _VIDIOC_S_HW_FREQ_SEEK:

***************************
ioctl VIDIOC_S_HW_FREQ_SEEK
***************************

Name
====

VIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek

Synopsis
========

.. c:macro:: VIDIOC_S_HW_FREQ_SEEK

``int ioctl(int fd, VIDIOC_S_HW_FREQ_SEEK, struct v4l2_hw_freq_seek *argp)``

Arguments
=========

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

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

탐색 범위와 실행 조건

31-60

응용 프로그램은 `tuner`, `type`, `seek_upward`, `wrap_around`, `spacing`, `rangelow`, `rangehigh`를 설정하고 `reserved` 배열을 0으로 만든 뒤 ioctl을 호출합니다.

`rangelow`와 `rangehigh`가 0이 아니면 검색할 주파수 대역을 제한합니다. `V4L2_TUNER_CAP_HWSEEK_PROG_LIM`이 있으면 두 값은 `VIDIOC_ENUM_FREQ_BANDS`가 반환한 어느 한 대역 안에 있으면 되지만, 이 기능이 없으면 대역의 하한과 상한에 정확히 일치해야 합니다.

현재 주파수가 선택한 대역 밖이면 드라이버는 탐색 전에 가장 가까운 대역 경계로 보정합니다. 탐색이 오류로 끝나면 원래 주파수를 복원하므로 실패한 호출이 튜너의 기존 조정을 남기지 않습니다.

장치가 이 ioctl을 제공하려면 `V4L2_CAP_HW_FREQ_SEEK` capability가 설정되어 있어야 합니다. 비차단 파일 핸들에서는 탐색을 시작하지 않고 `EAGAIN`을 반환합니다.

하드웨어 주파수 탐색 흐름
튜너와 방향, 간격, 검색 범위를 설정선택한 대역과 하드웨어 capability를 검증필요하면 현재 주파수를 대역 경계로 보정하드웨어 탐색 실행채널을 찾으면 새 주파수 유지, 오류면 원래 주파수 복원

범위 검증부터 성공 또는 복원까지의 순서입니다.

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

Start a hardware frequency seek from the current frequency. To do this
applications initialize the ``tuner``, ``type``, ``seek_upward``,
``wrap_around``, ``spacing``, ``rangelow`` and ``rangehigh`` fields, and
zero out the ``reserved`` array of a struct
:c:type:`v4l2_hw_freq_seek` and call the
``VIDIOC_S_HW_FREQ_SEEK`` ioctl with a pointer to this structure.

The ``rangelow`` and ``rangehigh`` fields can be set to a non-zero value
to tell the driver to search a specific band. If the struct
:c:type:`v4l2_tuner` ``capability`` field has the
``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag set, these values must fall
within one of the bands returned by
:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag is not set, then these values
must exactly match those of one of the bands returned by
:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
current frequency of the tuner does not fall within the selected band it
will be clamped to fit in the band before the seek is started.

If an error is returned, then the original frequency will be restored.

This ioctl is supported if the ``V4L2_CAP_HW_FREQ_SEEK`` capability is
set.

If this ioctl is called from a non-blocking filehandle, then ``EAGAIN``
error code is returned and no seek takes place.

struct v4l2_hw_freq_seek

61-115
하드웨어 탐색 구조체 필드
형식필드의미
`__u32``tuner``v4l2_input.tuner` 및 `v4l2_tuner.index`와 같은 튜너 인덱스
`__u32``type``v4l2_tuner.type`과 같은 튜너 형식
`__u32``seek_upward`0이 아니면 상향 탐색, 0이면 하향 탐색
`__u32``wrap_around`범위 끝에서 반대쪽 끝으로 이어서 탐색할지 여부
`__u32``spacing`Hz 단위 탐색 해상도. 드라이버가 가장 가까운 지원값을 선택하며 0이면 합리적인 기본값 사용
`__u32``rangelow`검색 대역의 최저 주파수. 0이면 기본 하한 사용
`__u32``rangehigh`검색 대역의 최고 주파수. 0이면 기본 상한 사용
`__u32[5]``reserved[5]`향후 확장용이며 응용 프로그램이 모두 0으로 설정

탐색 방향, 반복 방식, 해상도와 주파수 범위를 지정합니다.

`rangelow`와 `rangehigh`의 단위는 기본적으로 62.5 kHz입니다. `V4L2_TUNER_CAP_LOW`가 설정되면 62.5 Hz, `V4L2_TUNER_CAP_1HZ`가 설정되면 1 Hz 단위를 사용합니다.

`wrap_around` 지원 여부는 `v4l2_tuner.capability`에서 확인해야 합니다. 장치가 지원하지 않는 값을 요청하면 탐색을 시작하지 않고 `EINVAL`을 반환합니다.

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

.. c:type:: v4l2_hw_freq_seek

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

    * - __u32
      - ``tuner``
      - The tuner 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.
    * - __u32
      - ``type``
      - The tuner type. This is the same value as in the struct
	:c:type:`v4l2_tuner` ``type`` field. See
	:c:type:`v4l2_tuner_type`
    * - __u32
      - ``seek_upward``
      - If non-zero, seek upward from the current frequency, else seek
	downward.
    * - __u32
      - ``wrap_around``
      - If non-zero, wrap around when at the end of the frequency range,
	else stop seeking. The struct :c:type:`v4l2_tuner`
	``capability`` field will tell you what the hardware supports.
    * - __u32
      - ``spacing``
      - If non-zero, defines the hardware seek resolution in Hz. The
	driver selects the nearest value that is supported by the device.
	If spacing is zero a reasonable default value is used.
    * - __u32
      - ``rangelow``
      - If non-zero, the lowest tunable frequency of the band to search in
	units of 62.5 kHz, or if the struct
	:c:type:`v4l2_tuner` ``capability`` field has the
	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
	struct :c:type:`v4l2_tuner` ``capability`` field has
	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
	``rangelow`` is zero a reasonable default value is used.
    * - __u32
      - ``rangehigh``
      - If non-zero, the highest tunable frequency of the band to search
	in units of 62.5 kHz, or if the struct
	:c:type:`v4l2_tuner` ``capability`` field has the
	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
	struct :c:type:`v4l2_tuner` ``capability`` field has
	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
	``rangehigh`` is zero a reasonable default value is used.
    * - __u32
      - ``reserved``\ [5]
      - Reserved for future extensions. Applications must set the array to
	zero.

반환값과 오류

116-137

성공하면 0, 오류이면 -1을 반환하고 `errno`를 설정합니다. 오류가 반환된 탐색은 원래 주파수를 복원합니다.

VIDIOC_S_HW_FREQ_SEEK 오류
errno조건
`EINVAL`튜너 인덱스가 범위를 벗어나거나 `wrap_around`가 미지원이거나 `type`, `rangelow`, `rangehigh` 값이 잘못됨
`EAGAIN`비차단 파일 핸들로 호출함. 탐색은 시작되지 않음
`ENODATA`하드웨어 탐색이 채널을 찾지 못함
`EBUSY`다른 하드웨어 탐색이 이미 진행 중임

입력 검증, 실행 모드와 탐색 결과에 따른 전용 오류입니다.


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, the ``wrap_around`` value is
    not supported or one of the values in the ``type``, ``rangelow`` or
    ``rangehigh`` fields is wrong.

EAGAIN
    Attempted to call ``VIDIOC_S_HW_FREQ_SEEK`` with the filehandle in
    non-blocking mode.

ENODATA
    The hardware seek found no channels.

EBUSY
    Another hardware seek is already in progress.