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