Re: [PATCH 4/9] usb: gadget/uvc: free buffers after streamoff

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

 



On Tue, Jun 04, 2013 at 05:08:23PM +0200, Michael Grzeschik wrote:
> From: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> 
> The current approach is to keep the device open and request buffers on
> REQBUFS. These buffers will not be freed until device close. The device
> close on the other hand will disconnect the device from the USB host.
> 
> This way its not possible to change the buffers capabilities while still
> being connected. Thus, the device can not stream different buffer types.
> 
> That patch clears the buffers on STREAMOFF. This way it will allways
> be needed to alloc new buffers before STREAMON.

No, this is wrong. The buffers must still exist after a STREAMON. From the
documentation: "I/O returns to the same state as after calling
VIDIOC_REQBUFS and can be restarted accordingly."

The correct solution is for the userspace to call VIDIOC_REQBUFS with
count=0 before calling VIDIOC_S_FMT.

Regards,
Michael

> Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/uvc_v4l2.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
> index 4d806b0..9fe2725 100644
> --- a/drivers/usb/gadget/uvc_v4l2.c
> +++ b/drivers/usb/gadget/uvc_v4l2.c
> @@ -290,7 +290,10 @@ uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
>  		if (*type != video->queue.queue.type)
>  			return -EINVAL;
>  
> -		return uvc_video_enable(video, 0);
> +		ret = uvc_video_enable(video, 0);
> +		uvc_free_buffers(&video->queue);
> +
> +		return ret;
>  	}
>  
>  	/* Events */
> -- 
> 1.8.2.rc2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
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