v4l2-ctl: add support for the motion detection event
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 10 Jun 2014 11:50:52 +0000 (13:50 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Thu, 17 Jul 2014 17:38:14 +0000 (19:38 +0200)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-ctl/v4l2-ctl-misc.cpp
utils/v4l2-ctl/v4l2-ctl.cpp

index 6af10ed..6134be6 100644 (file)
@@ -29,7 +29,8 @@ void misc_usage(void)
               "  --wait-for-event=<event>\n"
               "                     wait for an event [VIDIOC_DQEVENT]\n"
               "                     <event> is the event number or one of:\n"
-              "                     eos, vsync, ctrl=<id>, frame_sync, source_change=<pad>\n"
+              "                     eos, vsync, ctrl=<id>, frame_sync, source_change=<pad>,\n"
+              "                     motion_det\n"
               "                     where <id> is the name of the control\n"
               "                     and where <pad> is the index of the pad or input\n"
               "  --poll-for-event=<event>\n"
index ac38d0e..245a39e 100644 (file)
@@ -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;