diff options
| author | Hans de Goede <hdegoede@redhat.com> | 2012-04-08 11:59:46 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-07 15:28:35 -0400 |
| commit | c53c2549333b340e2662dc64ec81323476b69a97 (patch) | |
| tree | 4bd55780eba1302caaf7359631b996043dc1082f /Documentation/video4linux | |
| parent | a22d85fea89744fad2cb215da1fe0c1ce226a613 (diff) | |
[media] v4l2-event: Add v4l2_subscribed_event_ops
Just like with ctrl events, drivers may want to get called back on
listener add / remove for other event types too. Rather then special
casing all of this in subscribe / unsubscribe event it is better to
use ops for this.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/video4linux')
| -rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index e3dfc268d9c1..369d4bc87828 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
| @@ -945,21 +945,35 @@ fast. | |||
| 945 | 945 | ||
| 946 | Useful functions: | 946 | Useful functions: |
| 947 | 947 | ||
| 948 | - v4l2_event_queue() | 948 | void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev) |
| 949 | 949 | ||
| 950 | Queue events to video device. The driver's only responsibility is to fill | 950 | Queue events to video device. The driver's only responsibility is to fill |
| 951 | in the type and the data fields. The other fields will be filled in by | 951 | in the type and the data fields. The other fields will be filled in by |
| 952 | V4L2. | 952 | V4L2. |
| 953 | 953 | ||
| 954 | - v4l2_event_subscribe() | 954 | int v4l2_event_subscribe(struct v4l2_fh *fh, |
| 955 | struct v4l2_event_subscription *sub, unsigned elems, | ||
| 956 | const struct v4l2_subscribed_event_ops *ops) | ||
| 955 | 957 | ||
| 956 | The video_device->ioctl_ops->vidioc_subscribe_event must check the driver | 958 | The video_device->ioctl_ops->vidioc_subscribe_event must check the driver |
| 957 | is able to produce events with specified event id. Then it calls | 959 | is able to produce events with specified event id. Then it calls |
| 958 | v4l2_event_subscribe() to subscribe the event. The last argument is the | 960 | v4l2_event_subscribe() to subscribe the event. |
| 959 | size of the event queue for this event. If it is 0, then the framework | ||
| 960 | will fill in a default value (this depends on the event type). | ||
| 961 | 961 | ||
| 962 | - v4l2_event_unsubscribe() | 962 | The elems argument is the size of the event queue for this event. If it is 0, |
| 963 | then the framework will fill in a default value (this depends on the event | ||
| 964 | type). | ||
| 965 | |||
| 966 | The ops argument allows the driver to specify a number of callbacks: | ||
| 967 | * add: called when a new listener gets added (subscribing to the same | ||
| 968 | event twice will only cause this callback to get called once) | ||
| 969 | * del: called when a listener stops listening | ||
| 970 | * replace: replace event 'old' with event 'new'. | ||
| 971 | * merge: merge event 'old' into event 'new'. | ||
| 972 | All 4 callbacks are optional, if you don't want to specify any callbacks | ||
| 973 | the ops argument itself maybe NULL. | ||
| 974 | |||
| 975 | int v4l2_event_unsubscribe(struct v4l2_fh *fh, | ||
| 976 | struct v4l2_event_subscription *sub) | ||
| 963 | 977 | ||
| 964 | vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use | 978 | vidioc_unsubscribe_event in struct v4l2_ioctl_ops. A driver may use |
| 965 | v4l2_event_unsubscribe() directly unless it wants to be involved in | 979 | v4l2_event_unsubscribe() directly unless it wants to be involved in |
| @@ -968,7 +982,7 @@ Useful functions: | |||
| 968 | The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The | 982 | The special type V4L2_EVENT_ALL may be used to unsubscribe all events. The |
| 969 | drivers may want to handle this in a special way. | 983 | drivers may want to handle this in a special way. |
| 970 | 984 | ||
| 971 | - v4l2_event_pending() | 985 | int v4l2_event_pending(struct v4l2_fh *fh) |
| 972 | 986 | ||
| 973 | Returns the number of pending events. Useful when implementing poll. | 987 | Returns the number of pending events. Useful when implementing poll. |
| 974 | 988 | ||
