History

[media] hdpvr: fix interrupted recording

This is a reworking of a patch originally submitted by Ryley Angus, modified by Hans Verkuil and then seemingly forgotten before changes suggested by Keith Pyle here: http://www.mail-archive.com/linux-media@vger.kernel.org/msg75163.html were made and tested. I have implemented the suggested changes and have been testing for the last 2 months. I am no longer experiencing lockups while recording (with blue light on, requiring power cycling) which had been a long standing problem with the HD-PVR. I have not noticed any other problems since applying the patch.

Jonathan Sims committed 10 years ago

Commit a503ff81 parent 708f48e1 file · +19 −3Browse files

Unified · Split

drivers/media/usb/hdpvr/hdpvr-video.c+19−3
@@ -449,6 +449,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, · 448 unmodified lines
449449
450450 if (buf->status != BUFSTAT_READY &&
451451 dev->status != STATUS_DISCONNECTED) {
452+ int err;
452453 /* return nonblocking */
453454 if (file->f_flags & O_NONBLOCK) {
454455 if (!ret)
@@ -456,9 +457,24 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count, · 1 unmodified line
456457 goto err;
457458 }
458459
459− if (wait_event_interruptible(dev->wait_data,
460− buf->status == BUFSTAT_READY))
461− return -ERESTARTSYS;
460+ err = wait_event_interruptible_timeout(dev->wait_data,
461+ buf->status == BUFSTAT_READY,
462+ msecs_to_jiffies(1000));
463+ if (err < 0) {
464+ ret = err;
465+ goto err;
466+ }
467+ if (!err) {
468+ v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
469+ "timeout: restart streaming\n");
470+ hdpvr_stop_streaming(dev);
471+ msecs_to_jiffies(4000);
472+ err = hdpvr_start_streaming(dev);
473+ if (err) {
474+ ret = err;
475+ goto err;
476+ }
477+ }
462478 }
463479
464480 if (buf->status != BUFSTAT_READY)