V4L2 ioctl()
&manvol;
v4l2-ioctlProgram a V4L2 device#include <sys/ioctl.h>int ioctlint fdint requestvoid *argpArgumentsfd&fd;requestV4L2 ioctl request code as defined in the videodev.h header file, for example
VIDIOC_QUERYCAP.argpPointer to a function parameter, usually a structure.DescriptionThe 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 argp in
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 .Return ValueOn 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.EBADFfd is not a valid open file
descriptor.EBUSYThe 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.EFAULTargp references an inaccessible
memory area.ENOTTYfd is not associated with a
character special device.EINVALThe request or the data pointed
to by argp is not valid. This is a very common
error code, see the individual ioctl requests listed in for actual causes.ENOMEMNot enough physical or virtual memory was available to
complete the request.ERANGEThe application attempted to set a control with the
&VIDIOC-S-CTRL; ioctl to a value which is out of bounds.