VIDIOC_DQEVENT — Dequeue event
| int ioctl( | int fd, | 
| int request, | |
| struct v4l2_event
*argp ); | 
Dequeue an event from a video device. No input is required for this ioctl. All the fields of the struct 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.
Table A.12. struct v4l2_event
| __u32 | type | Type of the event, see Table A.13, “Event Types”. | |
| union | u | ||
| struct v4l2_event_vsync | vsync | Event data for event V4L2_EVENT_VSYNC. | |
| struct v4l2_event_ctrl | ctrl | Event data for event V4L2_EVENT_CTRL. | |
| struct v4l2_event_frame_sync | frame_sync | Event data for event V4L2_EVENT_FRAME_SYNC. | |
| struct v4l2_event_motion_det | motion_det | Event data for event V4L2_EVENT_MOTION_DET. | |
| struct 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. The timestamp has been taken from the CLOCK_MONOTONICclock. To access the
	    same clock outside V4L2, useclock_gettime(2). | |
| 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. | 
Table A.13. Event Types
| V4L2_EVENT_ALL | 0 | All events. V4L2_EVENT_ALL is valid only for VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. | 
| V4L2_EVENT_VSYNC | 1 | This event is triggered on the vertical sync. This event has a struct v4l2_event_vsync associated with it. | 
| V4L2_EVENT_EOS | 2 | This event is triggered when the end of a stream is reached. This is typically used with MPEG decoders to report to the application when the last of the MPEG stream has been decoded. | 
| V4L2_EVENT_CTRL | 3 | This event requires that the  If the event is generated due to a call to  This event type will ensure that no information is lost when
		more events are raised than there is room internally. In that
		case the struct v4l2_event_ctrl of the second-oldest event is kept,
		but the  | 
| V4L2_EVENT_FRAME_SYNC | 4 | Triggered immediately when the reception of a frame has begun. This event has a struct v4l2_event_frame_sync associated with it. If the hardware needs to be stopped in the case of a
	      buffer underrun it might not be able to generate this event.
	      In such cases the  | 
| V4L2_EVENT_SOURCE_CHANGE | 5 | This event is triggered when a source parameter change is
	       detected during runtime by the video device. It can be a
	       runtime resolution change triggered by a video decoder or the
	       format change happening on an input connector.
	       This event requires that the  This event has a struct v4l2_event_src_change associated
	      with it. The  | 
| V4L2_EVENT_MOTION_DET | 6 | Triggered whenever the motion detection state for one or more of the regions changes. This event has a struct v4l2_event_motion_det associated with it. | 
| V4L2_EVENT_PRIVATE_START | 0x08000000 | Base event number for driver-private events. | 
Table A.15. struct v4l2_event_ctrl
| __u32 | changes | A bitmask that tells what has changed. See Table A.19, “Control Changes”. | |
| __u32 | type | The type of the control. See enum 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 Table A.99, “Control Flags”. | |
| __s32 | minimum | The minimum value of the control. See struct v4l2_queryctrl. | |
| __s32 | maximum | The maximum value of the control. See struct v4l2_queryctrl. | |
| __s32 | step | The step value of the control. See struct v4l2_queryctrl. | |
| __s32 | default_value | The default value value of the control. See struct v4l2_queryctrl. | 
Table A.16. struct v4l2_event_frame_sync
| __u32 | frame_sequence | The sequence number of the frame being received. | 
Table A.17. struct v4l2_event_src_change
| __u32 | changes | A bitmask that tells what has changed. See Table A.20, “Source Changes”. | 
Table A.18. struct v4l2_event_motion_det
| __u32 | flags | Currently only one flag is available: if V4L2_EVENT_MD_FL_HAVE_FRAME_SEQis set, then theframe_sequencefield 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_SEQflag 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_GRIDcontrol
	      (see the section called “Detect Control Reference”) 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. | 
Table A.19. Control Changes
| V4L2_EVENT_CTRL_CH_VALUE | 0x0001 | This control event was triggered because the value of the control
		changed. Special cases: Volatile controls do no generate this event;
		If a control has the V4L2_CTRL_FLAG_EXECUTE_ON_WRITEflag set, then this event is sent as well, regardless its value. | 
| 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. | 
Table A.20. Source Changes
| 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. | 
On success 0 is returned, on error -1 and the errno variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.