dev-event.rst 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _event:
  4. ***************
  5. Event Interface
  6. ***************
  7. The V4L2 event interface provides a means for a user to get immediately
  8. notified on certain conditions taking place on a device. This might
  9. include start of frame or loss of signal events, for example. Changes in
  10. the value or state of a V4L2 control can also be reported through
  11. events.
  12. To receive events, the events the user is interested in first must be
  13. subscribed using the
  14. :ref:`VIDIOC_SUBSCRIBE_EVENT` ioctl. Once
  15. an event is subscribed, the events of subscribed types are dequeueable
  16. using the :ref:`VIDIOC_DQEVENT` ioctl. Events may be
  17. unsubscribed using VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event
  18. type V4L2_EVENT_ALL may be used to unsubscribe all the events the
  19. driver supports.
  20. The event subscriptions and event queues are specific to file handles.
  21. Subscribing an event on one file handle does not affect other file
  22. handles.
  23. The information on dequeueable events is obtained by using select or
  24. poll system calls on video devices. The V4L2 events use POLLPRI events
  25. on poll system call and exceptions on select system call.
  26. Starting with kernel 3.1 certain guarantees can be given with regards to
  27. events:
  28. 1. Each subscribed event has its own internal dedicated event queue.
  29. This means that flooding of one event type will not interfere with
  30. other event types.
  31. 2. If the internal event queue for a particular subscribed event becomes
  32. full, then the oldest event in that queue will be dropped.
  33. 3. Where applicable, certain event types can ensure that the payload of
  34. the oldest event that is about to be dropped will be merged with the
  35. payload of the next oldest event. Thus ensuring that no information
  36. is lost, but only an intermediate step leading up to that
  37. information. See the documentation for the event you want to
  38. subscribe to whether this is applicable for that event or not.