1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Event Interface</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="devices.html" title="Chapter 4. Interfaces"><link rel="prev" href="sdr.html" title="Software Defined Radio Interface (SDR)"><link rel="next" href="subdev.html" title="Sub-device Interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Event Interface</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sdr.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Interfaces</th><td width="20%" align="right"> <a accesskey="n" href="subdev.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="event"></a>Event Interface</h2></div></div></div><p>The V4L2 event interface provides a means for a user to get 2 immediately notified on certain conditions taking place on a device. 3 This might include start of frame or loss of signal events, for 4 example. Changes in the value or state of a V4L2 control can also be 5 reported through events. 6 </p><p>To receive events, the events the user is interested in first must 7 be subscribed using the <a class="link" href="vidioc-subscribe-event.html" title="ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT"><code class="constant">VIDIOC_SUBSCRIBE_EVENT</code></a> ioctl. Once an event is 8 subscribed, the events of subscribed types are dequeueable using the 9 <a class="link" href="vidioc-dqevent.html" title="ioctl VIDIOC_DQEVENT"><code class="constant">VIDIOC_DQEVENT</code></a> ioctl. Events may be unsubscribed using 10 VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type V4L2_EVENT_ALL may 11 be used to unsubscribe all the events the driver supports.</p><p>The event subscriptions and event queues are specific to file 12 handles. Subscribing an event on one file handle does not affect 13 other file handles.</p><p>The information on dequeueable events is obtained by using select or 14 poll system calls on video devices. The V4L2 events use POLLPRI events on 15 poll system call and exceptions on select system call.</p><p>Starting with kernel 3.1 certain guarantees can be given with 16 regards to events:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>Each subscribed event has its own internal dedicated event queue. 17This means that flooding of one event type will not interfere with other 18event types.</p></li><li class="listitem"><p>If the internal event queue for a particular subscribed event 19becomes full, then the oldest event in that queue will be dropped.</p></li><li class="listitem"><p>Where applicable, certain event types can ensure that the payload 20of the oldest event that is about to be dropped will be merged with the payload 21of the next oldest event. Thus ensuring that no information is lost, but only an 22intermediate step leading up to that information. See the documentation for the 23event you want to subscribe to whether this is applicable for that event or not.</p></li></ol></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sdr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="devices.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="subdev.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Software Defined Radio Interface (SDR) </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Sub-device Interface</td></tr></table></div></body></html> 24