ioctl() function is used to program
V4L2 devices. The argument
fd must be an open
file descriptor. An ioctl
request has encoded
in it whether the argument is an input, output or read/write
parameter, and the size of the argument
bytes. Macros and defines specifying V4L2 ioctl requests are located
in the videodev.h header file.
Applications should use their own copy, not include the version in the
kernel sources on the system they compile on. All V4L2 ioctl requests,
their respective function and parameters are specified in Reference I, Function Reference.
On success the
ioctl() function returns
0 and does not reset the
errno variable. On failure
-1 is returned, when the ioctl takes an
output or read/write parameter it remains unmodified, and the
errno variable is set appropriately. See below for
possible error codes. Generic errors like EBADF
or EFAULT are not listed in the sections
discussing individual ioctl requests.
Note ioctls may return undefined error codes. Since errors may have side effects such as a driver reset applications should abort on unexpected errors.
fd is not a valid open file
The property cannot be changed right now. Typically this error code is returned when I/O is in progress or the driver supports multiple opens and another process locked the property.
argp references an inaccessible
fd is not associated with a
character special device.
request or the data pointed
argp is not valid. This is a very common
error code, see the individual ioctl requests listed in Reference I, Function Reference for actual causes.
Not enough physical or virtual memory was available to complete the request.
The application attempted to set a control with the
VIDIOC_S_CTRL ioctl to a value which is out of bounds.