vidioc-g-frequency.rst 3.3 KB

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