On Tuesday 15 January 2008, Herton Ronaldo Krzesinski wrote:
> Em Tuesday 15 January 2008 20:12:16 Laurent Pinchart escreveu:
> > On Tuesday 15 January 2008, Herton Ronaldo Krzesinski wrote:
> > > Em Tuesday 15 January 2008 18:56:35 Laurent Pinchart escreveu:
> > > > Hi Herton,
> > > >
> > > > On Tuesday 15 January 2008, Herton Ronaldo Krzesinski wrote:
> > > > > Hi Laurent, thanks for the commit and advice. We played with the
> > > > > webcam again (sorry for delay) and we found out that it isn't
> > > > > really reporting the FID bit, but only end of frame marker (EOF).
> > > > > This is strange indeed, as from what I understand from UVC spec FID
> > > > > is required while EOF is optional.
> > > >
> > > > The bmFramingInfo field in the probe&commit control can be used by
> > > > the device to report if it supports FID and/or EOF. However, for
> > > > known frame-based formats, the field must be ignored. Just out of
> > > > curiosity, could you print the field's value when reading the probe
> > > > and commit controls ?
> > >
> > > It's always 0x00, falls at else in size check inside
> > > uvc_get_video_ctrl: uvc_get_video_ctrl: size != 34, bmFramingInfo =
> > > 0x00
> > >
> > > > > I reworked the quirk that Claudio made against revision 166 from
> > > > > svn, but now using the EOF to sync the stream (the previous quirk
> > > > > was ok, but on laggy communication, like using to transmit a video
> > > > > stream over internet etc., the frames would overlap etc. resulting
> > > > > in many display issues):
> > > >
> > > > Your patch could drop the last payload of each frame. Could you
> > > > please try the attached patch ?
> > >
> > > It works, but gives a different behaviour: for example, I simulate lag
> > > in luvcview placing a sleep(1) at the start of uvcGrab function, with
> > > this patch it captures only some frames at start and stops, with the
> > > patch I posted I receive continous snapshots.
> >
> > I'm not sure to understand. Could you please elaborate ?
>
> If I patch luvcview like this:
>
> --- v4l2uvc.c.orig 2008-01-15 20:19:57.000000000 -0200
> +++ v4l2uvc.c 2008-01-15 20:19:40.000000000 -0200
> @@ -462,6 +462,8 @@ int uvcGrab(struct vdIn *vd)
> #define HEADERFRAME1 0xaf
> int ret;
>
> + sleep(1);
> +
> if (!vd->isstreaming)
> if (video_enable(vd))
> goto err;
>
> And use luvcview with patched uvcvideo, the behaviour between the two
> patches is different. With your patch, the stream of video doesn't work
> well, it captures only the first 1/2 frames and stop. But in stock luvcview
> without the sleep your patch works fine. The difference here is that with
> the patch I posted earlier it works in both cases, it doesn't fail with the
> luvcview patched with sleep.
I see where the problem comes from. Could you please test the attached patch ?
It should fix the freeze and still prevent the last payload of each frame to
be discarded.
Best regards,
Laurent Pinchart
Index: uvc_video.c
===================================================================
--- uvc_video.c (revision 163)
+++ uvc_video.c (working copy)
@@ -298,11 +298,17 @@
* toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE.
* queue->last_fid is initialized to -1, so the first isochronous
* frame will always be in sync.
+ *
+ * If the device doesn't toggle the FID bit, invert video->last_fid
+ * when the EOF bit is set to force synchronisation on the next packet.
*/
if (buf->state != UVC_BUF_STATE_ACTIVE) {
if (fid == video->last_fid) {
uvc_trace(UVC_TRACE_FRAME, "Dropping payload (out of "
"sync).\n");
+ if ((video->dev->quirks & UVC_QUIRK_STREAM_NO_FID) &&
+ (data[1] & UVC_STREAM_EOF))
+ video->last_fid ^= UVC_STREAM_FID;
return -ENODATA;
}
@@ -370,6 +376,8 @@
if (data[0] == len)
uvc_trace(UVC_TRACE_FRAME, "EOF in empty payload.\n");
buf->state = UVC_BUF_STATE_DONE;
+ if (video->dev->quirks & UVC_QUIRK_STREAM_NO_FID)
+ video->last_fid ^= UVC_STREAM_FID;
}
}
Index: uvc_driver.c
===================================================================
--- uvc_driver.c (revision 165)
+++ uvc_driver.c (working copy)
@@ -1752,6 +1752,16 @@
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX
},
+ /* Syntek (HP Spartan) */
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
+ | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x174f,
+ .idProduct = 0x5212,
+ .bInterfaceClass = USB_CLASS_VIDEO,
+ .bInterfaceSubClass = 1,
+ .bInterfaceProtocol = 0,
+ .driver_info = UVC_QUIRK_STREAM_NO_FID
+ },
/* Ecamm Pico iMage */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
Index: uvcvideo.h
===================================================================
--- uvcvideo.h (revision 162)
+++ uvcvideo.h (working copy)
@@ -313,6 +313,7 @@
#define UVC_QUIRK_PROBE_MINMAX 0x00000002
#define UVC_QUIRK_PROBE_EXTRAFIELDS 0x00000004
#define UVC_QUIRK_BUILTIN_ISIGHT 0x00000008
+#define UVC_QUIRK_STREAM_NO_FID 0x00000010
/* Format flags */
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel