ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL
&manvol;

# VIDIOC_G_CTRL

# VIDIOC_S_CTRL

Get or set the value of a control

    	int ioctl
    	int fd
    	int request
    	struct v4l2_control
    *argp

## Arguments

`fd`

  &fd;

`request`

  VIDIOC_G_CTRL, VIDIOC_S_CTRL

`argp`

## Description

To get the current value of a control applications initialize the id field of a struct v4l2_control and call the `VIDIOC_G_CTRL` ioctl with a pointer to this structure. To change the value of a control applications initialize the id and value fields of a struct v4l2_control and call the `VIDIOC_S_CTRL` ioctl.

When the id is invalid drivers return an &EINVAL;. When the value is out of bounds drivers can choose to take the closest valid value or return an &ERANGE;, whatever seems more appropriate. However, `VIDIOC_S_CTRL` is a write-only ioctl, it does not return the actual new value.

These ioctls work only with user controls. For other control classes the &VIDIOC-G-EXT-CTRLS;, &VIDIOC-S-EXT-CTRLS; or &VIDIOC-TRY-EXT-CTRLS; must be used.

### struct v4l2_control

&cs-str;
__u32 | id | Identifies the control, set by the application.
__s32 | value | New value or current value.

&return-value;

EINVAL

  The &v4l2-control; id is invalid.

ERANGE

  The &v4l2-control; value is out of bounds.

EBUSY

  The control is temporarily not changeable, possibly because another applications took over control of the device function this control belongs to.

EACCES

  Attempt to set a read-only control or to get a write-only control.