xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-input.rst (revision cbecf716ca618fd44feda6bd9a64a8179d031fc5)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_INPUT:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT
854f38fcaSMauro Carvalho Chehab************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_INPUT - VIDIOC_S_INPUT - Query or select the current video input
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18*407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_INPUT
1954f38fcaSMauro Carvalho Chehab
20*407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_INPUT, int *argp)``
2154f38fcaSMauro Carvalho Chehab
22*407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_INPUT
23*407e84cdSMauro Carvalho Chehab
24*407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_INPUT, int *argp)``
2554f38fcaSMauro Carvalho Chehab
2654f38fcaSMauro Carvalho ChehabArguments
2754f38fcaSMauro Carvalho Chehab=========
2854f38fcaSMauro Carvalho Chehab
2954f38fcaSMauro Carvalho Chehab``fd``
30*407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho Chehab``argp``
3354f38fcaSMauro Carvalho Chehab    Pointer an integer with input index.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabTo query the current video input applications call the
3954f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer to an integer where the driver
4054f38fcaSMauro Carvalho Chehabstores the number of the input, as in the struct
4154f38fcaSMauro Carvalho Chehab:c:type:`v4l2_input` ``index`` field. This ioctl will fail
4254f38fcaSMauro Carvalho Chehabonly when there are no video inputs, returning ``EINVAL``.
4354f38fcaSMauro Carvalho Chehab
4454f38fcaSMauro Carvalho ChehabTo select a video input applications store the number of the desired
4554f38fcaSMauro Carvalho Chehabinput in an integer and call the :ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>` ioctl with a pointer
4654f38fcaSMauro Carvalho Chehabto this integer. Side effects are possible. For example inputs may
4754f38fcaSMauro Carvalho Chehabsupport different video standards, so the driver may implicitly switch
4854f38fcaSMauro Carvalho Chehabthe current standard. Because of these possible side effects
4954f38fcaSMauro Carvalho Chehabapplications must select an input before querying or negotiating any
5054f38fcaSMauro Carvalho Chehabother parameters.
5154f38fcaSMauro Carvalho Chehab
5254f38fcaSMauro Carvalho ChehabInformation about video inputs is available using the
5354f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_ENUMINPUT` ioctl.
5454f38fcaSMauro Carvalho Chehab
5554f38fcaSMauro Carvalho ChehabReturn Value
5654f38fcaSMauro Carvalho Chehab============
5754f38fcaSMauro Carvalho Chehab
5854f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
5954f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
6054f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
6154f38fcaSMauro Carvalho Chehab
6254f38fcaSMauro Carvalho ChehabEINVAL
6354f38fcaSMauro Carvalho Chehab    The number of the video input is out of bounds.
64