Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 .. c:namespace:: V4L
0003 
0004 .. _func-ioctl:
0005 
0006 ************
0007 V4L2 ioctl()
0008 ************
0009 
0010 Name
0011 ====
0012 
0013 v4l2-ioctl - Program a V4L2 device
0014 
0015 Synopsis
0016 ========
0017 
0018 .. code-block:: c
0019 
0020     #include <sys/ioctl.h>
0021 
0022 ``int ioctl(int fd, int request, void *argp)``
0023 
0024 Arguments
0025 =========
0026 
0027 ``fd``
0028     File descriptor returned by :c:func:`open()`.
0029 
0030 ``request``
0031     V4L2 ioctl request code as defined in the ``videodev2.h`` header
0032     file, for example VIDIOC_QUERYCAP.
0033 
0034 ``argp``
0035     Pointer to a function parameter, usually a structure.
0036 
0037 Description
0038 ===========
0039 
0040 The :ref:`ioctl() <func-ioctl>` function is used to program V4L2 devices. The
0041 argument ``fd`` must be an open file descriptor. An ioctl ``request``
0042 has encoded in it whether the argument is an input, output or read/write
0043 parameter, and the size of the argument ``argp`` in bytes. Macros and
0044 defines specifying V4L2 ioctl requests are located in the
0045 ``videodev2.h`` header file. Applications should use their own copy, not
0046 include the version in the kernel sources on the system they compile on.
0047 All V4L2 ioctl requests, their respective function and parameters are
0048 specified in :ref:`user-func`.
0049 
0050 Return Value
0051 ============
0052 
0053 On success 0 is returned, on error -1 and the ``errno`` variable is set
0054 appropriately. The generic error codes are described at the
0055 :ref:`Generic Error Codes <gen-errors>` chapter.
0056 
0057 When an ioctl that takes an output or read/write parameter fails, the
0058 parameter remains unmodified.