From eed880da1cf4af845700e1caf68d4d689391d4d3 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 9 Jun 2018 02:22:54 +0300 Subject: uvc: Handle UVC events internally in uvc.c The event notifier for the UVC device is registered in uvc_stream_set_event_handler(), which requires exposing the uvc_events_process() event handler to the uvc_stream class. Make the event handler internal by registering it in uvc_events_init(). This requires passing the uvc_stream pointer to the uvc_open() function and storing it internally in the uvc_device object. Signed-off-by: Laurent Pinchart --- stream.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'stream.h') diff --git a/stream.h b/stream.h index ba3d8af..4dbe344 100644 --- a/stream.h +++ b/stream.h @@ -65,6 +65,12 @@ struct uvc_stream *uvc_stream_new(const char *uvc_device, * contains all the parameters of the UVC function that will be handled by the * UVC stream. It can be parsed from the UVC function ConfigFS directory using * configfs_parse_uvc_function(). + * + * uvc_stream_init_uvc() also registers UVC event notifiers for the stream. The + * caller must have called the uvc_stream_set_event_handler() function first, + * and ensure that the event handler is immediately usable. If the event loop is + * already running, all initialization steps required to handle events must be + * fully performed before calling this function. */ void uvc_stream_init_uvc(struct uvc_stream *stream, struct uvc_function_config *fc); @@ -75,11 +81,7 @@ void uvc_stream_init_uvc(struct uvc_stream *stream, * @events: the event handler * * This function sets the event handler that the stream can use to be notified - * of file descriptor events. Event notifiers can be registered by this - * function, the caller must ensure that the event handler is immediately - * usable. If the event loop is already running, all initialization steps - * required to handle events must be fully performed before calling this - * function. + * of file descriptor events. */ void uvc_stream_set_event_handler(struct uvc_stream *stream, struct events *events); -- cgit v1.2.3