162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_ENUMINPUT:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci**********************
762306a36Sopenharmony_ciioctl VIDIOC_ENUMINPUT
862306a36Sopenharmony_ci**********************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_ENUMINPUT - Enumerate video inputs
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_ENUMINPUT
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUMINPUT, struct v4l2_input *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciArguments
2362306a36Sopenharmony_ci=========
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci``fd``
2662306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci``argp``
2962306a36Sopenharmony_ci    Pointer to struct :c:type:`v4l2_input`.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciDescription
3262306a36Sopenharmony_ci===========
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciTo query the attributes of a video input applications initialize the
3562306a36Sopenharmony_ci``index`` field of struct :c:type:`v4l2_input` and call the
3662306a36Sopenharmony_ci:ref:`VIDIOC_ENUMINPUT` with a pointer to this structure. Drivers
3762306a36Sopenharmony_cifill the rest of the structure or return an ``EINVAL`` error code when the
3862306a36Sopenharmony_ciindex is out of bounds. To enumerate all inputs applications shall begin
3962306a36Sopenharmony_ciat index zero, incrementing by one until the driver returns ``EINVAL``.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci.. tabularcolumns:: |p{3.0cm}|p{3.5cm}|p{10.8cm}|
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci.. c:type:: v4l2_input
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci.. flat-table:: struct v4l2_input
4662306a36Sopenharmony_ci    :header-rows:  0
4762306a36Sopenharmony_ci    :stub-columns: 0
4862306a36Sopenharmony_ci    :widths:       1 1 2
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci    * - __u32
5162306a36Sopenharmony_ci      - ``index``
5262306a36Sopenharmony_ci      - Identifies the input, set by the application.
5362306a36Sopenharmony_ci    * - __u8
5462306a36Sopenharmony_ci      - ``name``\ [32]
5562306a36Sopenharmony_ci      - Name of the video input, a NUL-terminated ASCII string, for
5662306a36Sopenharmony_ci	example: "Vin (Composite 2)". This information is intended for the
5762306a36Sopenharmony_ci	user, preferably the connector label on the device itself.
5862306a36Sopenharmony_ci    * - __u32
5962306a36Sopenharmony_ci      - ``type``
6062306a36Sopenharmony_ci      - Type of the input, see :ref:`input-type`.
6162306a36Sopenharmony_ci    * - __u32
6262306a36Sopenharmony_ci      - ``audioset``
6362306a36Sopenharmony_ci      - Drivers can enumerate up to 32 video and audio inputs. This field
6462306a36Sopenharmony_ci	shows which audio inputs were selectable as audio source if this
6562306a36Sopenharmony_ci	was the currently selected video input. It is a bit mask. The LSB
6662306a36Sopenharmony_ci	corresponds to audio input 0, the MSB to input 31. Any number of
6762306a36Sopenharmony_ci	bits can be set, or none.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	When the driver does not enumerate audio inputs no bits must be
7062306a36Sopenharmony_ci	set. Applications shall not interpret this as lack of audio
7162306a36Sopenharmony_ci	support. Some drivers automatically select audio sources and do
7262306a36Sopenharmony_ci	not enumerate them since there is no choice anyway.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci	For details on audio inputs and how to select the current input
7562306a36Sopenharmony_ci	see :ref:`audio`.
7662306a36Sopenharmony_ci    * - __u32
7762306a36Sopenharmony_ci      - ``tuner``
7862306a36Sopenharmony_ci      - Capture devices can have zero or more tuners (RF demodulators).
7962306a36Sopenharmony_ci	When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an
8062306a36Sopenharmony_ci	RF connector and this field identifies the tuner. It corresponds
8162306a36Sopenharmony_ci	to struct :c:type:`v4l2_tuner` field ``index``. For
8262306a36Sopenharmony_ci	details on tuners see :ref:`tuner`.
8362306a36Sopenharmony_ci    * - :ref:`v4l2_std_id <v4l2-std-id>`
8462306a36Sopenharmony_ci      - ``std``
8562306a36Sopenharmony_ci      - Every video input supports one or more different video standards.
8662306a36Sopenharmony_ci	This field is a set of all supported standards. For details on
8762306a36Sopenharmony_ci	video standards and how to switch see :ref:`standard`.
8862306a36Sopenharmony_ci    * - __u32
8962306a36Sopenharmony_ci      - ``status``
9062306a36Sopenharmony_ci      - This field provides status information about the input. See
9162306a36Sopenharmony_ci	:ref:`input-status` for flags. With the exception of the sensor
9262306a36Sopenharmony_ci	orientation bits ``status`` is only valid when this is the current
9362306a36Sopenharmony_ci	input.
9462306a36Sopenharmony_ci    * - __u32
9562306a36Sopenharmony_ci      - ``capabilities``
9662306a36Sopenharmony_ci      - This field provides capabilities for the input. See
9762306a36Sopenharmony_ci	:ref:`input-capabilities` for flags.
9862306a36Sopenharmony_ci    * - __u32
9962306a36Sopenharmony_ci      - ``reserved``\ [3]
10062306a36Sopenharmony_ci      - Reserved for future extensions. Drivers must set the array to
10162306a36Sopenharmony_ci	zero.
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{1.0cm}|p{9.7cm}|
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci.. _input-type:
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci.. flat-table:: Input Types
10962306a36Sopenharmony_ci    :header-rows:  0
11062306a36Sopenharmony_ci    :stub-columns: 0
11162306a36Sopenharmony_ci    :widths:       3 1 4
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_TUNER``
11462306a36Sopenharmony_ci      - 1
11562306a36Sopenharmony_ci      - This input uses a tuner (RF demodulator).
11662306a36Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_CAMERA``
11762306a36Sopenharmony_ci      - 2
11862306a36Sopenharmony_ci      - Any non-tuner video input, for example Composite Video,
11962306a36Sopenharmony_ci	S-Video, HDMI, camera sensor. The naming as ``_TYPE_CAMERA`` is historical,
12062306a36Sopenharmony_ci	today we would have called it ``_TYPE_VIDEO``.
12162306a36Sopenharmony_ci    * - ``V4L2_INPUT_TYPE_TOUCH``
12262306a36Sopenharmony_ci      - 3
12362306a36Sopenharmony_ci      - This input is a touch device for capturing raw touch data.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci.. tabularcolumns:: |p{5.6cm}|p{2.6cm}|p{9.1cm}|
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci.. _input-status:
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci.. flat-table:: Input Status Flags
13162306a36Sopenharmony_ci    :header-rows:  0
13262306a36Sopenharmony_ci    :stub-columns: 0
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci    * - :cspan:`2` General
13562306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_POWER``
13662306a36Sopenharmony_ci      - 0x00000001
13762306a36Sopenharmony_ci      - Attached device is off.
13862306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_SIGNAL``
13962306a36Sopenharmony_ci      - 0x00000002
14062306a36Sopenharmony_ci      -
14162306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_COLOR``
14262306a36Sopenharmony_ci      - 0x00000004
14362306a36Sopenharmony_ci      - The hardware supports color decoding, but does not detect color
14462306a36Sopenharmony_ci	modulation in the signal.
14562306a36Sopenharmony_ci    * - :cspan:`2` Sensor Orientation
14662306a36Sopenharmony_ci    * - ``V4L2_IN_ST_HFLIP``
14762306a36Sopenharmony_ci      - 0x00000010
14862306a36Sopenharmony_ci      - The input is connected to a device that produces a signal that is
14962306a36Sopenharmony_ci	flipped horizontally and does not correct this before passing the
15062306a36Sopenharmony_ci	signal to userspace.
15162306a36Sopenharmony_ci    * - ``V4L2_IN_ST_VFLIP``
15262306a36Sopenharmony_ci      - 0x00000020
15362306a36Sopenharmony_ci      - The input is connected to a device that produces a signal that is
15462306a36Sopenharmony_ci	flipped vertically and does not correct this before passing the
15562306a36Sopenharmony_ci	signal to userspace.
15662306a36Sopenharmony_ci	.. note:: A 180 degree rotation is the same as HFLIP | VFLIP
15762306a36Sopenharmony_ci    * - :cspan:`2` Analog Video
15862306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_H_LOCK``
15962306a36Sopenharmony_ci      - 0x00000100
16062306a36Sopenharmony_ci      - No horizontal sync lock.
16162306a36Sopenharmony_ci    * - ``V4L2_IN_ST_COLOR_KILL``
16262306a36Sopenharmony_ci      - 0x00000200
16362306a36Sopenharmony_ci      - A color killer circuit automatically disables color decoding when
16462306a36Sopenharmony_ci	it detects no color modulation. When this flag is set the color
16562306a36Sopenharmony_ci	killer is enabled *and* has shut off color decoding.
16662306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_V_LOCK``
16762306a36Sopenharmony_ci      - 0x00000400
16862306a36Sopenharmony_ci      - No vertical sync lock.
16962306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_STD_LOCK``
17062306a36Sopenharmony_ci      - 0x00000800
17162306a36Sopenharmony_ci      - No standard format lock in case of auto-detection format
17262306a36Sopenharmony_ci	by the component.
17362306a36Sopenharmony_ci    * - :cspan:`2` Digital Video
17462306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_SYNC``
17562306a36Sopenharmony_ci      - 0x00010000
17662306a36Sopenharmony_ci      - No synchronization lock.
17762306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_EQU``
17862306a36Sopenharmony_ci      - 0x00020000
17962306a36Sopenharmony_ci      - No equalizer lock.
18062306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_CARRIER``
18162306a36Sopenharmony_ci      - 0x00040000
18262306a36Sopenharmony_ci      - Carrier recovery failed.
18362306a36Sopenharmony_ci    * - :cspan:`2` VCR and Set-Top Box
18462306a36Sopenharmony_ci    * - ``V4L2_IN_ST_MACROVISION``
18562306a36Sopenharmony_ci      - 0x01000000
18662306a36Sopenharmony_ci      - Macrovision is an analog copy prevention system mangling the video
18762306a36Sopenharmony_ci	signal to confuse video recorders. When this flag is set
18862306a36Sopenharmony_ci	Macrovision has been detected.
18962306a36Sopenharmony_ci    * - ``V4L2_IN_ST_NO_ACCESS``
19062306a36Sopenharmony_ci      - 0x02000000
19162306a36Sopenharmony_ci      - Conditional access denied.
19262306a36Sopenharmony_ci    * - ``V4L2_IN_ST_VTR``
19362306a36Sopenharmony_ci      - 0x04000000
19462306a36Sopenharmony_ci      - VTR time constant. [?]
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.4cm}|p{8.3cm}|
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci.. _input-capabilities:
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci.. flat-table:: Input capabilities
20262306a36Sopenharmony_ci    :header-rows:  0
20362306a36Sopenharmony_ci    :stub-columns: 0
20462306a36Sopenharmony_ci    :widths:       3 1 4
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci    * - ``V4L2_IN_CAP_DV_TIMINGS``
20762306a36Sopenharmony_ci      - 0x00000002
20862306a36Sopenharmony_ci      - This input supports setting video timings by using
20962306a36Sopenharmony_ci	``VIDIOC_S_DV_TIMINGS``.
21062306a36Sopenharmony_ci    * - ``V4L2_IN_CAP_STD``
21162306a36Sopenharmony_ci      - 0x00000004
21262306a36Sopenharmony_ci      - This input supports setting the TV standard by using
21362306a36Sopenharmony_ci	``VIDIOC_S_STD``.
21462306a36Sopenharmony_ci    * - ``V4L2_IN_CAP_NATIVE_SIZE``
21562306a36Sopenharmony_ci      - 0x00000008
21662306a36Sopenharmony_ci      - This input supports setting the native size using the
21762306a36Sopenharmony_ci	``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see
21862306a36Sopenharmony_ci	:ref:`v4l2-selections-common`.
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ciReturn Value
22162306a36Sopenharmony_ci============
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
22462306a36Sopenharmony_ciappropriately. The generic error codes are described at the
22562306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ciEINVAL
22862306a36Sopenharmony_ci    The struct :c:type:`v4l2_input` ``index`` is out of
22962306a36Sopenharmony_ci    bounds.
230