V4L/DVB: V4L: Events: Add new ioctls for events
authorSakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Wed, 24 Feb 2010 22:19:05 +0000 (19:19 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:58:06 +0000 (12:58 -0300)
This patch adds a set of new ioctls to the V4L2 API. The ioctls conform to
V4L2 Events RFC version 2.3:

<URL:http://www.spinics.net/lists/linux-media/msg12033.html>

Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-compat-ioctl32.c
drivers/media/video/v4l2-ioctl.c
include/linux/videodev2.h

index f77f84bfe714be85b4c372cb010a1a37f4213de9..9004a5fe764300e3fd5d32a091b395cbd014c987 100644 (file)
@@ -1086,6 +1086,9 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
        case VIDIOC_QUERY_DV_PRESET:
        case VIDIOC_S_DV_TIMINGS:
        case VIDIOC_G_DV_TIMINGS:
+       case VIDIOC_DQEVENT:
+       case VIDIOC_SUBSCRIBE_EVENT:
+       case VIDIOC_UNSUBSCRIBE_EVENT:
                ret = do_video_ioctl(file, cmd, arg);
                break;
 
index 3da8d8f041d8440780b19d7416e5dfd3c9f22898..2ceaa152a4507aff808c0b1090c79e7472c04a3f 100644 (file)
@@ -291,6 +291,9 @@ static const char *v4l2_ioctls[] = {
        [_IOC_NR(VIDIOC_QUERY_DV_PRESET)]  = "VIDIOC_QUERY_DV_PRESET",
        [_IOC_NR(VIDIOC_S_DV_TIMINGS)]     = "VIDIOC_S_DV_TIMINGS",
        [_IOC_NR(VIDIOC_G_DV_TIMINGS)]     = "VIDIOC_G_DV_TIMINGS",
+       [_IOC_NR(VIDIOC_DQEVENT)]          = "VIDIOC_DQEVENT",
+       [_IOC_NR(VIDIOC_SUBSCRIBE_EVENT)]  = "VIDIOC_SUBSCRIBE_EVENT",
+       [_IOC_NR(VIDIOC_UNSUBSCRIBE_EVENT)] = "VIDIOC_UNSUBSCRIBE_EVENT",
 };
 #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
 
index e878056952c727f26393cd5ffa6154e1ada8e6bf..0f627c5b986b086829ae2d6c5b702b1dd9c24da6 100644 (file)
@@ -1636,6 +1636,29 @@ struct v4l2_streamparm {
        } parm;
 };
 
+/*
+ *     E V E N T S
+ */
+
+struct v4l2_event {
+       __u32                           type;
+       union {
+               __u8                    data[64];
+       } u;
+       __u32                           pending;
+       __u32                           sequence;
+       struct timespec                 timestamp;
+       __u32                           reserved[9];
+};
+
+struct v4l2_event_subscription {
+       __u32                           type;
+       __u32                           reserved[7];
+};
+
+#define V4L2_EVENT_ALL                         0
+#define V4L2_EVENT_PRIVATE_START               0x08000000
+
 /*
  *     A D V A N C E D   D E B U G G I N G
  *
@@ -1758,6 +1781,9 @@ struct v4l2_dbg_chip_ident {
 #define        VIDIOC_QUERY_DV_PRESET  _IOR('V',  86, struct v4l2_dv_preset)
 #define        VIDIOC_S_DV_TIMINGS     _IOWR('V', 87, struct v4l2_dv_timings)
 #define        VIDIOC_G_DV_TIMINGS     _IOWR('V', 88, struct v4l2_dv_timings)
+#define        VIDIOC_DQEVENT           _IOR('V', 89, struct v4l2_event)
+#define        VIDIOC_SUBSCRIBE_EVENT   _IOW('V', 90, struct v4l2_event_subscription)
+#define        VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
 
 /* Reminder: when adding new ioctls please add support for them to
    drivers/media/video/v4l2-compat-ioctl32.c as well! */