1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
19 v4l2-open - Open a V4L2 device
30 .. c:function:: int open( const char *device_name, int flags )
40 Open flags. Access mode must be ``O_RDWR``. This is just a
41 technicality, input devices still support only reading and output
44 When the ``O_NONBLOCK`` flag is given, the :ref:`read() <func-read>`
45 function and the :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl will
46 return the ``EAGAIN`` error code when no data is available or no
47 buffer is in the driver outgoing queue, otherwise these functions
48 block until data becomes available. All V4L2 drivers exchanging data
49 with applications must support the ``O_NONBLOCK`` flag.
51 Other flags have no effect.
57 To open a V4L2 device applications call :ref:`open() <func-open>` with the
58 desired device name. This function has no side effects; all data format
59 parameters, current input or output, control values or other properties
60 remain unchanged. At the first :ref:`open() <func-open>` call after loading the
61 driver they will be reset to default values, drivers are never in an
68 On success :ref:`open() <func-open>` returns the new file descriptor. On error
69 -1 is returned, and the ``errno`` variable is set appropriately.
70 Possible error codes are:
73 The caller has no permission to access the device.
76 The driver does not support multiple opens and the device is already
80 No device corresponding to this device special file exists.
83 Not enough kernel memory was available to complete the request.
86 The process already has the maximum number of files open.
89 The limit on the total number of files open on the system has been