Re: [PATCH 5/8] usb: gadget/uvc: add uvc suspend resume functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

Thank you for the patch.

On Wednesday 28 May 2014 09:38:06 Michael Grzeschik wrote:
> This is needed to tell the userspace daemon
> to disable the streaming if the device is
> suspended.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/f_uvc.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c
> index e2a1f50..7837ae6 100644
> --- a/drivers/usb/gadget/f_uvc.c
> +++ b/drivers/usb/gadget/f_uvc.c
> @@ -367,6 +367,21 @@ uvc_function_disable(struct usb_function *f)
>  	uvc->state = UVC_STATE_DISCONNECTED;
>  }
> 
> +static void
> +uvc_function_resume(struct usb_function *f)
> +{
> +	struct uvc_device *uvc = to_uvc(f);
> +	struct v4l2_event v4l2_event;
> +
> +	INFO(f->config->cdev, "uvc_function_resume\n");
> +
> +	memset(&v4l2_event, 0, sizeof(v4l2_event));
> +	v4l2_event.type = UVC_EVENT_CONNECT;
> +	v4l2_event_queue(uvc->vdev, &v4l2_event);
> +
> +	uvc->state = UVC_STATE_CONNECTED;

Shouldn't userspace be notified of suspend/resume events instead of faking 
disconnect/connect events ?

> +}
> +
>  /*
> --------------------------------------------------------------------------
> * Connection / disconnection
>   */
> @@ -818,6 +833,8 @@ uvc_bind_config(struct usb_configuration *c,
>  	uvc->func.get_alt = uvc_function_get_alt;
>  	uvc->func.set_alt = uvc_function_set_alt;
>  	uvc->func.disable = uvc_function_disable;
> +	uvc->func.suspend = uvc_function_disable;
> +	uvc->func.resume = uvc_function_resume;
>  	uvc->func.setup = uvc_function_setup;
> 
>  	ret = usb_add_function(c, &uvc->func);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux