^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _VIDIOC_G_FREQUENCY:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ********************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ********************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) VIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. c:macro:: VIDIOC_G_FREQUENCY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) .. c:macro:: VIDIOC_S_FREQUENCY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Pointer to struct :c:type:`v4l2_frequency`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) To get the current tuner or modulator radio frequency applications set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) the ``tuner`` field of a struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) :c:type:`v4l2_frequency` to the respective tuner or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) modulator number (only input devices have tuners, only output devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) have modulators), zero out the ``reserved`` array and call the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) :ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) driver stores the current frequency in the ``frequency`` field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) To change the current tuner or modulator radio frequency applications
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) initialize the ``tuner``, ``type`` and ``frequency`` fields, and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) ``reserved`` array of a struct :c:type:`v4l2_frequency`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) and call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) structure. When the requested frequency is not possible the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) assumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) write-only ioctl, it does not return the actual new frequency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .. c:type:: v4l2_frequency
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) .. flat-table:: struct v4l2_frequency
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) :widths: 1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) - ``tuner``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) - The tuner or modulator index number. This is the same value as in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) the struct :c:type:`v4l2_input` ``tuner`` field and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) the struct :c:type:`v4l2_tuner` ``index`` field, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) the struct :c:type:`v4l2_output` ``modulator`` field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) and the struct :c:type:`v4l2_modulator` ``index``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) - ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) - The tuner type. This is the same value as in the struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) :c:type:`v4l2_tuner` ``type`` field. The type must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) ``V4L2_TUNER_RADIO`` for modulators (currently only radio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) modulators are supported). See :c:type:`v4l2_tuner_type`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) - ``frequency``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) - Tuning frequency in units of 62.5 kHz, or if the struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) :c:type:`v4l2_tuner` or struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) :c:type:`v4l2_modulator` ``capability`` flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) - ``reserved``\ [8]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) - Reserved for future extensions. Drivers and applications must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) the array to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) The ``tuner`` index is out of bounds or the value in the ``type``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) field is wrong.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) EBUSY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) A hardware seek is in progress.