1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _VIDIOC_ENUM_FREQ_BANDS:
4
5****************************
6ioctl VIDIOC_ENUM_FREQ_BANDS
7****************************
8
9Name
10====
11
12VIDIOC_ENUM_FREQ_BANDS - Enumerate supported frequency bands
13
14
15Synopsis
16========
17
18.. c:function:: int ioctl( int fd, VIDIOC_ENUM_FREQ_BANDS, struct v4l2_frequency_band *argp )
19    :name: VIDIOC_ENUM_FREQ_BANDS
20
21
22Arguments
23=========
24
25``fd``
26    File descriptor returned by :ref:`open() <func-open>`.
27
28``argp``
29    Pointer to struct :c:type:`v4l2_frequency_band`.
30
31
32Description
33===========
34
35Enumerates the frequency bands that a tuner or modulator supports. To do
36this applications initialize the ``tuner``, ``type`` and ``index``
37fields, and zero out the ``reserved`` array of a struct
38:c:type:`v4l2_frequency_band` and call the
39:ref:`VIDIOC_ENUM_FREQ_BANDS` ioctl with a pointer to this structure.
40
41This ioctl is supported if the ``V4L2_TUNER_CAP_FREQ_BANDS`` capability
42of the corresponding tuner/modulator is set.
43
44
45.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}|
46
47.. c:type:: v4l2_frequency_band
48
49.. flat-table:: struct v4l2_frequency_band
50    :header-rows:  0
51    :stub-columns: 0
52    :widths:       1 1 2 1 1
53
54    * - __u32
55      - ``tuner``
56      - The tuner or modulator index number. This is the same value as in
57	the struct :c:type:`v4l2_input` ``tuner`` field and
58	the struct :c:type:`v4l2_tuner` ``index`` field, or
59	the struct :c:type:`v4l2_output` ``modulator`` field
60	and the struct :c:type:`v4l2_modulator` ``index``
61	field.
62    * - __u32
63      - ``type``
64      - The tuner type. This is the same value as in the struct
65	:c:type:`v4l2_tuner` ``type`` field. The type must be
66	set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
67	to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
68	``V4L2_TUNER_RADIO`` for modulators (currently only radio
69	modulators are supported). See :c:type:`v4l2_tuner_type`
70    * - __u32
71      - ``index``
72      - Identifies the frequency band, set by the application.
73    * - __u32
74      - ``capability``
75      - :cspan:`2` The tuner/modulator capability flags for this
76	frequency band, see :ref:`tuner-capability`. The
77	``V4L2_TUNER_CAP_LOW`` or ``V4L2_TUNER_CAP_1HZ`` capability must
78	be the same for all frequency bands of the selected
79	tuner/modulator. So either all bands have that capability set, or
80	none of them have that capability.
81    * - __u32
82      - ``rangelow``
83      - :cspan:`2` The lowest tunable frequency in units of 62.5 kHz, or
84	if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units
85	of 62.5 Hz, for this frequency band. A 1 Hz unit is used when the
86	``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
87    * - __u32
88      - ``rangehigh``
89      - :cspan:`2` The highest tunable frequency in units of 62.5 kHz,
90	or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in
91	units of 62.5 Hz, for this frequency band. A 1 Hz unit is used
92	when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
93    * - __u32
94      - ``modulation``
95      - :cspan:`2` The supported modulation systems of this frequency
96	band. See :ref:`band-modulation`.
97
98	.. note::
99
100	   Currently only one modulation system per frequency band
101	   is supported. More work will need to be done if multiple
102	   modulation systems are possible. Contact the linux-media
103	   mailing list
104	   (`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__)
105	   if you need such functionality.
106    * - __u32
107      - ``reserved``\ [9]
108      - Reserved for future extensions.
109
110	Applications and drivers must set the array to zero.
111
112
113
114.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
115
116.. _band-modulation:
117
118.. flat-table:: Band Modulation Systems
119    :header-rows:  0
120    :stub-columns: 0
121    :widths:       3 1 4
122
123    * - ``V4L2_BAND_MODULATION_VSB``
124      - 0x02
125      - Vestigial Sideband modulation, used for analog TV.
126    * - ``V4L2_BAND_MODULATION_FM``
127      - 0x04
128      - Frequency Modulation, commonly used for analog radio.
129    * - ``V4L2_BAND_MODULATION_AM``
130      - 0x08
131      - Amplitude Modulation, commonly used for analog radio.
132
133
134Return Value
135============
136
137On success 0 is returned, on error -1 and the ``errno`` variable is set
138appropriately. The generic error codes are described at the
139:ref:`Generic Error Codes <gen-errors>` chapter.
140
141EINVAL
142    The ``tuner`` or ``index`` is out of bounds or the ``type`` field is
143    wrong.
144