1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
13 v4l2-open - Open a V4L2 device
22 .. c:function:: int open( const char *device_name, int flags )
31 Open flags. Access mode must be ``O_RDWR``. This is just a
32 technicality, input devices still support only reading and output
35 When the ``O_NONBLOCK`` flag is given, the :c:func:`read()`
36 function and the :ref:`VIDIOC_DQBUF <VIDIOC_QBUF>` ioctl will
37 return the ``EAGAIN`` error code when no data is available or no
38 buffer is in the driver outgoing queue, otherwise these functions
39 block until data becomes available. All V4L2 drivers exchanging data
40 with applications must support the ``O_NONBLOCK`` flag.
42 Other flags have no effect.
47 To open a V4L2 device applications call :c:func:`open()` with the
48 desired device name. This function has no side effects; all data format
49 parameters, current input or output, control values or other properties
50 remain unchanged. At the first :c:func:`open()` call after loading the
51 driver they will be reset to default values, drivers are never in an
57 On success :c:func:`open()` returns the new file descriptor. On error
58 -1 is returned, and the ``errno`` variable is set appropriately.
59 Possible error codes are:
62 The caller has no permission to access the device.
65 The driver does not support multiple opens and the device is already
69 No device corresponding to this device special file exists.
72 Not enough kernel memory was available to complete the request.
75 The process already has the maximum number of files open.
78 The limit on the total number of files open on the system has been