ioctl VIDIOC_DQEVENT
&manvol;

# VIDIOC_DQEVENT

Dequeue event

    	int ioctl
    	int fd
    	int request
    	struct v4l2_event
    *argp

## Arguments

`fd`

  &fd;

`request`

  VIDIOC_DQEVENT

`argp`

## Description

Dequeue an event from a video device. No input is required for this ioctl. All the fields of the &v4l2-event; structure are filled by the driver. The file handle will also receive exceptions which the application may get by e.g. using the select system call.

### struct v4l2_event

&cs-str;
__u32 | type |  | Type of the event.
union | u |  |
| &v4l2-event-vsync; | vsync | Event data for event `V4L2_EVENT_VSYNC`.
| &v4l2-event-ctrl; | ctrl | Event data for event `V4L2_EVENT_CTRL`.
| &v4l2-event-frame-sync; | frame_sync | Event data for event `V4L2_EVENT_FRAME_SYNC`.
| &v4l2-event-motion-det; | motion_det | Event data for event V4L2_EVENT_MOTION_DET.
| &v4l2-event-src-change; | src_change | Event data for event V4L2_EVENT_SOURCE_CHANGE.
| __u8 | data[64] | Event data. Defined by the event type. The union should be used to define easily accessible type for events.
__u32 | pending |  | Number of pending events excluding this one.
__u32 | sequence |  | Event sequence number. The sequence number is incremented for every subscribed event that takes place. If sequence numbers are not contiguous it means that events have been lost.
struct timespec | timestamp |  | Event timestamp.
u32 | id |  | The ID associated with the event source. If the event does not have an associated ID (this depends on the event type), then this is 0.
__u32 | reserved[8] |  | Reserved for future extensions. Drivers must set the array to zero.

### struct v4l2_event_vsync

&cs-str;
__u8 | field | The upcoming field. See &v4l2-field;.

### struct v4l2_event_ctrl

&cs-str;
__u32 | changes |  | A bitmask that tells what has changed. See .
__u32 | type |  | The type of the control. See &v4l2-ctrl-type;.
union (anonymous) |  |  |
| __s32 | value | The 32-bit value of the control for 32-bit control types. This is 0 for string controls since the value of a string cannot be passed using &VIDIOC-DQEVENT;.
| __s64 | value64 | The 64-bit value of the control for 64-bit control types.
__u32 | flags |  | The control flags. See .
__s32 | minimum |  | The minimum value of the control. See &v4l2-queryctrl;.
__s32 | maximum |  | The maximum value of the control. See &v4l2-queryctrl;.
__s32 | step |  | The step value of the control. See &v4l2-queryctrl;.
__s32 | default_value |  | The default value value of the control. See &v4l2-queryctrl;.

### struct v4l2_event_frame_sync

&cs-str;
__u32 | frame_sequence | The sequence number of the frame being received.

### struct v4l2_event_src_change

&cs-str;
__u32 | changes | A bitmask that tells what has changed. See .

### struct v4l2_event_motion_det

&cs-str;
__u32 | flags | Currently only one flag is available: if `V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ` is set, then the frame_sequence field is valid, otherwise that field should be ignored.
__u32 | frame_sequence | The sequence number of the frame being received. Only valid if the `V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ` flag was set.
__u32 | region_mask | The bitmask of the regions that reported motion. There is at least one region. If this field is 0, then no motion was detected at all. If there is no `V4L2_CID_DETECT_MD_REGION_GRID` control (see ) to assign a different region to each cell in the motion detection grid, then that all cells are automatically assigned to the default region 0.

### Changes

&cs-def;
`V4L2_EVENT_CTRL_CH_VALUE` | 0x0001 | This control event was triggered because the value of the control changed. Special case: if a button control is pressed, then this event is sent as well, even though there is not explicit value associated with a button control.
`V4L2_EVENT_CTRL_CH_FLAGS` | 0x0002 | This control event was triggered because the control flags changed.
`V4L2_EVENT_CTRL_CH_RANGE` | 0x0004 | This control event was triggered because the minimum, maximum, step or the default value of the control changed.

### Source Changes

&cs-def;
`V4L2_EVENT_SRC_CH_RESOLUTION` | 0x0001 | This event gets triggered when a resolution change is detected at an input. This can come from an input connector or from a video decoder.

&return-value;