^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. c:namespace:: MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) .. _media-func-ioctl:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) media ioctl()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) media-ioctl - Control a media device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. code-block:: c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <sys/ioctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) ``int ioctl(int fd, int request, void *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) ``request``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Media ioctl request code as defined in the media.h header file, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) example MEDIA_IOC_SETUP_LINK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Pointer to a request-specific structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) The :ref:`ioctl() <media-func-ioctl>` function manipulates media device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) parameters. The argument ``fd`` must be an open file descriptor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) The ioctl ``request`` code specifies the media function to be called. It
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) has encoded in it whether the argument is an input, output or read/write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) parameter, and the size of the argument ``argp`` in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) Macros and structures definitions specifying media ioctl requests and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) their parameters are located in the media.h header file. All media ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) requests, their respective function and parameters are specified in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) :ref:`media-user-func`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) Request-specific error codes are listed in the individual requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) descriptions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) When an ioctl that takes an output or read/write parameter fails, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) parameter remains unmodified.