On Wednesday 18 July 2007 21:52:39 Laurent Pinchart wrote: > > + /* copy the frame */ > > + mem = video->queue.mem + buf->buf.m.offset; > > + if (copy_to_user(data, mem, len)) { > > + uvc_trace(UVC_TRACE_READ, "copy_to_user error\n"); > > + mutex_unlock(&video->queue.mutex); > > + uvc_queue_buffer(&video->queue, &v4l2_b); > > + return -EFAULT; > > + } > > This won't work. read() can be called with data buffers smaller than a > video frame.
> You should not assume that a read() call will read a whole > buffer at once. This is not correct. One read() should provide one frame exactly, In facts, the V4L2 API states: "read() attempts to read up to count bytes from file descriptor fd into the buffer starting at buf. [...] Regardless of the count value each read() call will provide at most one frame (two fields) worth of data. [...] read() never returns a "snapshot" of a buffer being filled. Using a single buffer the driver will stop capturing when the application starts reading the buffer until the read is finished. [...]" Best regards Luca Risolia _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel