From: Hans Verkuil Date: Tue, 10 Jun 2014 11:50:52 +0000 (+0200) Subject: v4l2-ctl: add support for the motion detection event X-Git-Tag: v4l-utils-1.3.90~98 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=36123351327821e9c2d567b0e2175dd922ac547d;p=platform%2Fupstream%2Fv4l-utils.git v4l2-ctl: add support for the motion detection event Signed-off-by: Hans Verkuil --- diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp index 6af10ed..6134be6 100644 --- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp @@ -29,7 +29,8 @@ void misc_usage(void) " --wait-for-event=\n" " wait for an event [VIDIOC_DQEVENT]\n" " is the event number or one of:\n" - " eos, vsync, ctrl=, frame_sync, source_change=\n" + " eos, vsync, ctrl=, frame_sync, source_change=,\n" + " motion_det\n" " where is the name of the control\n" " and where is the index of the pad or input\n" " --poll-for-event=\n" diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp index ac38d0e..245a39e 100644 --- a/utils/v4l2-ctl/v4l2-ctl.cpp +++ b/utils/v4l2-ctl/v4l2-ctl.cpp @@ -799,6 +799,14 @@ static void print_event(const struct v4l2_event *ev) case V4L2_EVENT_SOURCE_CHANGE: printf("source_change: pad/input=%d changes: %x\n", ev->id, ev->u.src_change.changes); break; + case V4L2_EVENT_MOTION_DET: + if (ev->u.motion_det.flags & V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ) + printf("motion_det frame %d, regions 0x%x\n", + ev->u.motion_det.frame_sequence, + ev->u.motion_det.region_mask); + else + printf("motion_det regions 0x%x\n", ev->u.motion_det.region_mask); + break; default: if (ev->type >= V4L2_EVENT_PRIVATE_START) printf("unknown private event (%08x)\n", ev->type); @@ -821,6 +829,8 @@ static __u32 parse_event(const char *e, const char **name) event = V4L2_EVENT_VSYNC; else if (!strcmp(e, "frame_sync")) event = V4L2_EVENT_FRAME_SYNC; + else if (!strcmp(e, "motion_det")) + event = V4L2_EVENT_MOTION_DET; else if (!strncmp(e, "ctrl=", 5)) { event = V4L2_EVENT_CTRL; *name = e + 5;