The patch number 11247 was added via Janne Grunau <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List <[email protected]>
------
From: Janne Grunau <[email protected]>
hdpvr: empty internal device buffer after stopping streaming
Makes the next capturing starting faster and more reliable.
Priority: normal
Signed-off-by: Janne Grunau <[email protected]>
---
linux/drivers/media/video/hdpvr/hdpvr-video.c | 26 ++++++++++++++++++
1 file changed, 26 insertions(+)
diff -r fdbbcb7e8aa5 -r 9e6940e3fd4e
linux/drivers/media/video/hdpvr/hdpvr-video.c
--- a/linux/drivers/media/video/hdpvr/hdpvr-video.c Sat Mar 28 00:09:40
2009 +0100
+++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c Sat Mar 28 00:21:17
2009 +0100
@@ -298,11 +298,20 @@ static int hdpvr_start_streaming(struct
/* function expects dev->io_mutex to be hold by caller */
static int hdpvr_stop_streaming(struct hdpvr_device *dev)
{
+ uint actual_length, c = 0;
+ u8 *buf;
+
if (dev->status == STATUS_IDLE)
return 0;
else if (dev->status != STATUS_STREAMING)
return -EAGAIN;
+ buf = kmalloc(dev->bulk_in_size, GFP_KERNEL);
+ if (!buf)
+ v4l2_err(&dev->v4l2_dev, "failed to allocate temporary buffer "
+ "for emptying the internal device buffer. "
+ "Next capture start will be slow\n");
+
dev->status = STATUS_SHUTTING_DOWN;
hdpvr_config_call(dev, CTRL_STOP_STREAMING_VALUE, 0x00);
mutex_unlock(&dev->io_mutex);
@@ -315,6 +324,23 @@ static int hdpvr_stop_streaming(struct h
mutex_lock(&dev->io_mutex);
/* kill the still outstanding urbs */
hdpvr_cancel_queue(dev);
+
+ /* emptying the device buffer beforeshutting it down */
+ while (buf && ++c < 500 &&
+ !usb_bulk_msg(dev->udev,
+ usb_rcvbulkpipe(dev->udev,
+ dev->bulk_in_endpointAddr),
+ buf, dev->bulk_in_size, &actual_length,
+ BULK_URB_TIMEOUT)) {
+ /* wait */
+ msleep(5);
+ v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
+ "%2d: got %d bytes\n", c, actual_length);
+ }
+ kfree(buf);
+ v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
+ "used %d urbs to empty device buffers\n", c-1);
+ msleep(10);
dev->status = STATUS_IDLE;
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/9e6940e3fd4e75066b2eca1e21d172a28d28b292
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits