ChangeSet 1.808.2.8, 2002/10/21 23:30:44-07:00, jtyner@cs.ucr.edu

[PATCH] drivers/usb/media/vicam.c: simplify vicam_read

> The following patch removes the old framebuf_size and framebuf_read_start
> values from the cam structure and simplifes the read function. It also
> moves the needs dummy read check into the read_frame function. cp and dd
> should both still work.

This is in addition to the previous patch. It should allow any programs
that read entire frames to receive a new frame with each successive read.
Programs that read less than the entire frame will read until they reach
the end of the frame. They will then read 0 bytes (signifying EOF). The
next read will start the next frame.


diff -Nru a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c
--- a/drivers/usb/media/vicam.c	Mon Oct 28 13:55:30 2002
+++ b/drivers/usb/media/vicam.c	Mon Oct 28 13:55:30 2002
@@ -1004,6 +1004,10 @@
 		*ppos += count;
 	}
 
+	if (count == VICAM_MAX_FRAME_SIZE) {
+		*ppos = 0;
+	}
+
 	up(&cam->busy_lock);
 
 	return count;
