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

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

 



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.

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

--
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