xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-input.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_G_INPUT:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun************************************
7*4882a593Smuzhiyunioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
8*4882a593Smuzhiyun************************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_INPUT
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_INPUT
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunArguments
27*4882a593Smuzhiyun=========
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun``fd``
30*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun``argp``
33*4882a593Smuzhiyun    Pointer an integer with input index.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunDescription
36*4882a593Smuzhiyun===========
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunTo query the current video input applications call the
39*4882a593Smuzhiyun:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
40*4882a593Smuzhiyunstores the number of the input, as in the struct
41*4882a593Smuzhiyun:c:type:`v4l2_input` ``index`` field. This ioctl will fail
42*4882a593Smuzhiyunonly when there are no video inputs, returning ``EINVAL``.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunTo select a video input applications store the number of the desired
45*4882a593Smuzhiyuninput in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
46*4882a593Smuzhiyunto this integer. Side effects are possible. For example inputs may
47*4882a593Smuzhiyunsupport different video standards, so the driver may implicitly switch
48*4882a593Smuzhiyunthe current standard. Because of these possible side effects
49*4882a593Smuzhiyunapplications must select an input before querying or negotiating any
50*4882a593Smuzhiyunother parameters.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunInformation about video inputs is available using the
53*4882a593Smuzhiyun:ref:`VIDIOC_ENUMINPUT` ioctl.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunReturn Value
56*4882a593Smuzhiyun============
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
59*4882a593Smuzhiyunappropriately. The generic error codes are described at the
60*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunEINVAL
63*4882a593Smuzhiyun    The number of the video input is out of bounds.
64