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