Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138345
b: refs/heads/master
c: 7d771ff
h: refs/heads/master
i:
  138343: ae2c922
v: v3
  • Loading branch information
Janne Grunau authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 1af3f78 commit a247c6b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ef77adfb9ac170bcaf449530cf129c48547fd55
refs/heads/master: 7d771ff0dc3371923db929d9f88932acec3fc8e8
26 changes: 26 additions & 0 deletions trunk/drivers/media/video/hdpvr/hdpvr-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,20 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
/* 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);
Expand All @@ -316,6 +325,23 @@ static int hdpvr_stop_streaming(struct hdpvr_device *dev)
/* 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;

return 0;
Expand Down

0 comments on commit a247c6b

Please sign in to comment.