18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_ENUMINPUT:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci**********************
78c2ecf20Sopenharmony_ciioctl VIDIOC_ENUMINPUT
88c2ecf20Sopenharmony_ci**********************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_ENUMINPUT - Enumerate video inputs
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_ENUMINPUT
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUMINPUT, struct v4l2_input *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_input`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciTo query the attributes of a video input applications initialize the
358c2ecf20Sopenharmony_ci``index`` field of struct :c:type:`v4l2_input` and call the
368c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUMINPUT` with a pointer to this structure. Drivers
378c2ecf20Sopenharmony_cifill the rest of the structure or return an ``EINVAL`` error code when the
388c2ecf20Sopenharmony_ciindex is out of bounds. To enumerate all inputs applications shall begin
398c2ecf20Sopenharmony_ciat index zero, incrementing by one until the driver returns ``EINVAL``.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci.. c:type:: v4l2_input
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_input
468c2ecf20Sopenharmony_ci    :header-rows:  0
478c2ecf20Sopenharmony_ci    :stub-columns: 0
488c2ecf20Sopenharmony_ci    :widths:       1 1 2
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci    * - __u32
518c2ecf20Sopenharmony_ci      - ``index``
528c2ecf20Sopenharmony_ci      - Identifies the input, set by the application.
538c2ecf20Sopenharmony_ci    * - __u8
548c2ecf20Sopenharmony_ci      - ``name``\ [32]
558c2ecf20Sopenharmony_ci      - Name of the video input, a NUL-terminated ASCII string, for
568c2ecf20Sopenharmony_ci	example: "Vin (Composite 2)". This information is intended for the
578c2ecf20Sopenharmony_ci	user, preferably the connector label on the device itself.
588c2ecf20Sopenharmony_ci    * - __u32
598c2ecf20Sopenharmony_ci      - ``type``
608c2ecf20Sopenharmony_ci      - Type of the input, see :ref:`input-type`.
618c2ecf20Sopenharmony_ci    * - __u32
628c2ecf20Sopenharmony_ci      - ``audioset``
638c2ecf20Sopenharmony_ci      - Drivers can enumerate up to 32 video and audio inputs. This field
648c2ecf20Sopenharmony_ci	shows which audio inputs were selectable as audio source if this
658c2ecf20Sopenharmony_ci	was the currently selected video input. It is a bit mask. The LSB
668c2ecf20Sopenharmony_ci	corresponds to audio input 0, the MSB to input 31. Any number of
678c2ecf20Sopenharmony_ci	bits can be set, or none.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	When the driver does not enumerate audio inputs no bits must be
708c2ecf20Sopenharmony_ci	set. Applications shall not interpret this as lack of audio
718c2ecf20Sopenharmony_ci	support. Some drivers automatically select audio sources and do
728c2ecf20Sopenharmony_ci	not enumerate them since there is no choice anyway.
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	For details on audio inputs and how to select the current input
758c2ecf20Sopenharmony_ci	see :ref:`audio`.
768c2ecf20Sopenharmony_ci    * - __u32
778c2ecf20Sopenharmony_ci      - ``tuner``
788c2ecf20Sopenharmony_ci      - Capture devices can have zero or more tuners (RF demodulators).
798c2ecf20Sopenharmony_ci	When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an
808c2ecf20Sopenharmony_ci	RF connector and this field identifies the tuner. It corresponds
818c2ecf20Sopenharmony_ci	to struct :c:type:`v4l2_tuner` field ``index``. For
828c2ecf20Sopenharmony_ci	details on tuners see :ref:`tuner`.
838c2ecf20Sopenharmony_ci    * - :ref:`v4l2_std_id <v4l2-std-id>`
848c2ecf20Sopenharmony_ci      - ``std``
858c2ecf20Sopenharmony_ci      - Every video input supports one or more different video standards.
868c2ecf20Sopenharmony_ci	This field is a set of all supported standards. For details on
878c2ecf20Sopenharmony_ci	video standards and how to switch see :ref:`standard`.
888c2ecf20Sopenharmony_ci    * - __u32
898c2ecf20Sopenharmony_ci      - ``status``
908c2ecf20Sopenharmony_ci      - This field provides status information about the input. See
918c2ecf20Sopenharmony_ci	:ref:`input-status` for flags. With the exception of the sensor
928c2ecf20Sopenharmony_ci	orientation bits ``status`` is only valid when this is the current
938c2ecf20Sopenharmony_ci	input.
948c2ecf20Sopenharmony_ci    * - __u32
958c2ecf20Sopenharmony_ci      - ``capabilities``
968c2ecf20Sopenharmony_ci      - This field provides capabilities for the input. See
978c2ecf20Sopenharmony_ci	:ref:`input-capabilities` for flags.
988c2ecf20Sopenharmony_ci    * - __u32
998c2ecf20Sopenharmony_ci      - ``reserved``\ [3]
1008c2ecf20Sopenharmony_ci      - Reserved for future extensions. Drivers must set the array to
1018c2ecf20Sopenharmony_ci	zero.
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci.. _input-type:
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci.. flat-table:: Input Types
1098c2ecf20Sopenharmony_ci    :header-rows:  0
1108c2ecf20Sopenharmony_ci    :stub-columns: 0
1118c2ecf20Sopenharmony_ci    :widths:       3 1 4
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_TUNER``
1148c2ecf20Sopenharmony_ci      - 1
1158c2ecf20Sopenharmony_ci      - This input uses a tuner (RF demodulator).
1168c2ecf20Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_CAMERA``
1178c2ecf20Sopenharmony_ci      - 2
1188c2ecf20Sopenharmony_ci      - Any non-tuner video input, for example Composite Video,
1198c2ecf20Sopenharmony_ci	S-Video, HDMI, camera sensor. The naming as ``_TYPE_CAMERA`` is historical,
1208c2ecf20Sopenharmony_ci	today we would have called it ``_TYPE_VIDEO``.
1218c2ecf20Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_TOUCH``
1228c2ecf20Sopenharmony_ci      - 3
1238c2ecf20Sopenharmony_ci      - This input is a touch device for capturing raw touch data.
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.8cm}|p{2.6cm}|p{10.1cm}|
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci.. _input-status:
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci.. flat-table:: Input Status Flags
1318c2ecf20Sopenharmony_ci    :header-rows:  0
1328c2ecf20Sopenharmony_ci    :stub-columns: 0
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci    * - :cspan:`2` General
1358c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_POWER``
1368c2ecf20Sopenharmony_ci      - 0x00000001
1378c2ecf20Sopenharmony_ci      - Attached device is off.
1388c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_SIGNAL``
1398c2ecf20Sopenharmony_ci      - 0x00000002
1408c2ecf20Sopenharmony_ci      -
1418c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_COLOR``
1428c2ecf20Sopenharmony_ci      - 0x00000004
1438c2ecf20Sopenharmony_ci      - The hardware supports color decoding, but does not detect color
1448c2ecf20Sopenharmony_ci	modulation in the signal.
1458c2ecf20Sopenharmony_ci    * - :cspan:`2` Sensor Orientation
1468c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_HFLIP``
1478c2ecf20Sopenharmony_ci      - 0x00000010
1488c2ecf20Sopenharmony_ci      - The input is connected to a device that produces a signal that is
1498c2ecf20Sopenharmony_ci	flipped horizontally and does not correct this before passing the
1508c2ecf20Sopenharmony_ci	signal to userspace.
1518c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_VFLIP``
1528c2ecf20Sopenharmony_ci      - 0x00000020
1538c2ecf20Sopenharmony_ci      - The input is connected to a device that produces a signal that is
1548c2ecf20Sopenharmony_ci	flipped vertically and does not correct this before passing the
1558c2ecf20Sopenharmony_ci	signal to userspace.
1568c2ecf20Sopenharmony_ci	.. note:: A 180 degree rotation is the same as HFLIP | VFLIP
1578c2ecf20Sopenharmony_ci    * - :cspan:`2` Analog Video
1588c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_H_LOCK``
1598c2ecf20Sopenharmony_ci      - 0x00000100
1608c2ecf20Sopenharmony_ci      - No horizontal sync lock.
1618c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_COLOR_KILL``
1628c2ecf20Sopenharmony_ci      - 0x00000200
1638c2ecf20Sopenharmony_ci      - A color killer circuit automatically disables color decoding when
1648c2ecf20Sopenharmony_ci	it detects no color modulation. When this flag is set the color
1658c2ecf20Sopenharmony_ci	killer is enabled *and* has shut off color decoding.
1668c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_V_LOCK``
1678c2ecf20Sopenharmony_ci      - 0x00000400
1688c2ecf20Sopenharmony_ci      - No vertical sync lock.
1698c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_STD_LOCK``
1708c2ecf20Sopenharmony_ci      - 0x00000800
1718c2ecf20Sopenharmony_ci      - No standard format lock in case of auto-detection format
1728c2ecf20Sopenharmony_ci	by the component.
1738c2ecf20Sopenharmony_ci    * - :cspan:`2` Digital Video
1748c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_SYNC``
1758c2ecf20Sopenharmony_ci      - 0x00010000
1768c2ecf20Sopenharmony_ci      - No synchronization lock.
1778c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_EQU``
1788c2ecf20Sopenharmony_ci      - 0x00020000
1798c2ecf20Sopenharmony_ci      - No equalizer lock.
1808c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_CARRIER``
1818c2ecf20Sopenharmony_ci      - 0x00040000
1828c2ecf20Sopenharmony_ci      - Carrier recovery failed.
1838c2ecf20Sopenharmony_ci    * - :cspan:`2` VCR and Set-Top Box
1848c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_MACROVISION``
1858c2ecf20Sopenharmony_ci      - 0x01000000
1868c2ecf20Sopenharmony_ci      - Macrovision is an analog copy prevention system mangling the video
1878c2ecf20Sopenharmony_ci	signal to confuse video recorders. When this flag is set
1888c2ecf20Sopenharmony_ci	Macrovision has been detected.
1898c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_NO_ACCESS``
1908c2ecf20Sopenharmony_ci      - 0x02000000
1918c2ecf20Sopenharmony_ci      - Conditional access denied.
1928c2ecf20Sopenharmony_ci    * - ``V4L2_IN_ST_VTR``
1938c2ecf20Sopenharmony_ci      - 0x04000000
1948c2ecf20Sopenharmony_ci      - VTR time constant. [?]
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci.. _input-capabilities:
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci.. flat-table:: Input capabilities
2028c2ecf20Sopenharmony_ci    :header-rows:  0
2038c2ecf20Sopenharmony_ci    :stub-columns: 0
2048c2ecf20Sopenharmony_ci    :widths:       3 1 4
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci    * - ``V4L2_IN_CAP_DV_TIMINGS``
2078c2ecf20Sopenharmony_ci      - 0x00000002
2088c2ecf20Sopenharmony_ci      - This input supports setting video timings by using
2098c2ecf20Sopenharmony_ci	``VIDIOC_S_DV_TIMINGS``.
2108c2ecf20Sopenharmony_ci    * - ``V4L2_IN_CAP_STD``
2118c2ecf20Sopenharmony_ci      - 0x00000004
2128c2ecf20Sopenharmony_ci      - This input supports setting the TV standard by using
2138c2ecf20Sopenharmony_ci	``VIDIOC_S_STD``.
2148c2ecf20Sopenharmony_ci    * - ``V4L2_IN_CAP_NATIVE_SIZE``
2158c2ecf20Sopenharmony_ci      - 0x00000008
2168c2ecf20Sopenharmony_ci      - This input supports setting the native size using the
2178c2ecf20Sopenharmony_ci	``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see
2188c2ecf20Sopenharmony_ci	:ref:`v4l2-selections-common`.
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ciReturn Value
2218c2ecf20Sopenharmony_ci============
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
2248c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
2258c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ciEINVAL
2288c2ecf20Sopenharmony_ci    The struct :c:type:`v4l2_input` ``index`` is out of
2298c2ecf20Sopenharmony_ci    bounds.
230