Commit | Line | Data |
---|---|---|
5377d91f MH |
1 | .. -*- coding: utf-8; mode: rst -*- |
2 | ||
af4a4d0d | 3 | .. _VIDIOC_G_FREQUENCY: |
5377d91f MH |
4 | |
5 | ******************************************** | |
6 | ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY | |
7 | ******************************************** | |
8 | ||
15e7d615 | 9 | Name |
586027ce | 10 | ==== |
5377d91f | 11 | |
586027ce | 12 | VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency |
5377d91f | 13 | |
15e7d615 MCC |
14 | |
15 | Synopsis | |
5377d91f MH |
16 | ======== |
17 | ||
41d80465 MCC |
18 | .. c:function:: int ioctl( int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp ) |
19 | :name: VIDIOC_G_FREQUENCY | |
5377d91f | 20 | |
41d80465 MCC |
21 | .. c:function:: int ioctl( int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp ) |
22 | :name: VIDIOC_S_FREQUENCY | |
5377d91f | 23 | |
586027ce | 24 | |
15e7d615 | 25 | Arguments |
5377d91f MH |
26 | ========= |
27 | ||
28 | ``fd`` | |
29 | File descriptor returned by :ref:`open() <func-open>`. | |
30 | ||
5377d91f MH |
31 | ``argp`` |
32 | ||
33 | ||
15e7d615 | 34 | Description |
5377d91f MH |
35 | =========== |
36 | ||
37 | To get the current tuner or modulator radio frequency applications set | |
38 | the ``tuner`` field of a struct | |
e8be7e97 | 39 | :c:type:`v4l2_frequency` to the respective tuner or |
5377d91f MH |
40 | modulator number (only input devices have tuners, only output devices |
41 | have modulators), zero out the ``reserved`` array and call the | |
4e03cb76 | 42 | :ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The |
5377d91f MH |
43 | driver stores the current frequency in the ``frequency`` field. |
44 | ||
45 | To change the current tuner or modulator radio frequency applications | |
46 | initialize the ``tuner``, ``type`` and ``frequency`` fields, and the | |
e8be7e97 | 47 | ``reserved`` array of a struct :c:type:`v4l2_frequency` |
2212ff25 | 48 | and call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this |
5377d91f | 49 | structure. When the requested frequency is not possible the driver |
2212ff25 | 50 | assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a |
5377d91f MH |
51 | write-only ioctl, it does not return the actual new frequency. |
52 | ||
53 | ||
5bd4bb78 MCC |
54 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| |
55 | ||
e8be7e97 | 56 | .. c:type:: v4l2_frequency |
fa92b04d | 57 | |
5377d91f MH |
58 | .. flat-table:: struct v4l2_frequency |
59 | :header-rows: 0 | |
60 | :stub-columns: 0 | |
61 | :widths: 1 1 2 | |
62 | ||
63 | ||
64 | - .. row 1 | |
65 | ||
66 | - __u32 | |
67 | ||
68 | - ``tuner`` | |
69 | ||
70 | - The tuner or modulator index number. This is the same value as in | |
e8be7e97 MCC |
71 | the struct :c:type:`v4l2_input` ``tuner`` field and |
72 | the struct :c:type:`v4l2_tuner` ``index`` field, or | |
73 | the struct :c:type:`v4l2_output` ``modulator`` field | |
74 | and the struct :c:type:`v4l2_modulator` ``index`` | |
0579e6e3 | 75 | field. |
5377d91f MH |
76 | |
77 | - .. row 2 | |
78 | ||
79 | - __u32 | |
80 | ||
81 | - ``type`` | |
82 | ||
83 | - The tuner type. This is the same value as in the struct | |
e8be7e97 | 84 | :c:type:`v4l2_tuner` ``type`` field. The type must be |
0579e6e3 MCC |
85 | set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and |
86 | to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to | |
87 | ``V4L2_TUNER_RADIO`` for modulators (currently only radio | |
56683d7d | 88 | modulators are supported). See :c:type:`v4l2_tuner_type` |
5377d91f MH |
89 | |
90 | - .. row 3 | |
91 | ||
92 | - __u32 | |
93 | ||
94 | - ``frequency`` | |
95 | ||
96 | - Tuning frequency in units of 62.5 kHz, or if the struct | |
e8be7e97 MCC |
97 | :c:type:`v4l2_tuner` or struct |
98 | :c:type:`v4l2_modulator` ``capability`` flag | |
0579e6e3 MCC |
99 | ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is |
100 | used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. | |
5377d91f MH |
101 | |
102 | - .. row 4 | |
103 | ||
104 | - __u32 | |
105 | ||
8968da9b | 106 | - ``reserved``\ [8] |
5377d91f MH |
107 | |
108 | - Reserved for future extensions. Drivers and applications must set | |
0579e6e3 | 109 | the array to zero. |
5377d91f MH |
110 | |
111 | ||
15e7d615 | 112 | Return Value |
5377d91f MH |
113 | ============ |
114 | ||
115 | On success 0 is returned, on error -1 and the ``errno`` variable is set | |
116 | appropriately. The generic error codes are described at the | |
117 | :ref:`Generic Error Codes <gen-errors>` chapter. | |
118 | ||
119 | EINVAL | |
120 | The ``tuner`` index is out of bounds or the value in the ``type`` | |
121 | field is wrong. | |
122 | ||
123 | EBUSY | |
124 | A hardware seek is in progress. |