Hi Alexey,

On Thursday 22 October 2009 09:40:27 Alexey Fisher wrote:
> Hi Laurent,
> thank you for the answer, i thought - no body care. :)
> 
> Am Donnerstag, den 22.10.2009, 01:55 +0200 schrieb Laurent Pinchart:
> > Hi Alexey,
> >
> > On Thursday 15 October 2009 21:00:59 Alexey Fisher wrote:
> > > I did some simple dirty hack, it prevent webcam from being killed by
> > > cheese. On other site it make cheese work too.
> > > Like Paulo said,  the camera is slow and it need more time to make
> > > thirst start, some time it need 8 seconds on second start it need about
> > > 2 seconds. If we call STREAMOFF before we get EOF, the camera will die.
> >
> > Which EOF are you talking about here ? The UVC bit in the video packets
> > header ? How have you tested that ?
> 
> I used "uvcvideo trace=255" and cheese.
> I talking about "uvc_v4l2_ioctl(VIDIOC_STREAMON)", "Frame complete (EOF
> found)" and "uvc_v4l2_ioctl(VIDIOC_STREAMOFF)".
> 
> > > IMHO, the driver should decide if camera ready or not. The easiest way
> > > is, to add SLOWSTART quirk. Correct way probobly will be to check if
> > > camera ready or not.
> > > Any ideas how to make it? Or any other ideas?
> > >
> > > I know, cheese use some bruteforce way to get settings, but the bug in
> > > cheese make the bug in uvcvideo easy to reproduce.
> >
> > It's not a bug in uvcvideo but a bug in the camera. Have you been to
> > isolate exactly which sequence of ioctls issued by Cheese make the camera
> > crash ? I'd like more information about that.
> 
> I made dmesg of two situations, webcam work and don't work.
> cheese celling two times "uvc_v4l2_ioctl(VIDIOC_STREAMON)", thirst one
> to get the settings and second time to start the record. Between thirst
> and second pass the time out seems to be too short (even it is 10
> seconds).
> 
> This is working example:
> [ 2715.842503] uvcvideo: uvc_v4l2_ioctl(VIDIOC_STREAMON)
> [ 2715.852318] uvcvideo: uvc_v4l2_poll
> [ 2724.689677] uvcvideo: Frame complete (EOF found).
> [ 2724.689698] uvcvideo: uvc_v4l2_poll
> [ 2724.689708] uvcvideo: uvc_v4l2_ioctl(VIDIOC_DQBUF)
> [ 2724.689713] uvcvideo: Dequeuing buffer 0 (3, 3840000 bytes).
> [ 2724.693157] uvcvideo: uvc_v4l2_ioctl(VIDIOC_QBUF)
> [ 2724.693164] uvcvideo: Queuing buffer 0.
> [ 2724.693551] uvcvideo: uvc_v4l2_poll
> [ 2724.694064] uvcvideo: uvc_v4l2_poll
> [ 2724.744145] uvcvideo: uvc_v4l2_ioctl(VIDIOC_STREAMOFF)
> 
> This is broken:
> [ 2874.576741] uvcvideo: uvc_v4l2_ioctl(VIDIOC_STREAMON)
> [ 2874.586236] uvcvideo: uvc_v4l2_poll
> [ 2884.601319] uvcvideo: uvc_v4l2_poll
> [ 2884.601412] uvcvideo: uvc_v4l2_ioctl(VIDIOC_STREAMOFF)
> 
> I think, if you call VIDIOC_STREAMOFF befor you get "Frame complete (EOF
> found)" on this camera it will kill it.
> 
> > > here is this hack:
> > >
> > > diff --git a/drivers/media/video/uvc/uvc_video.c
> > > b/drivers/media/video/uvc/uvc_video.c
> > > index f960e8e..fdc7007 100644
> > > --- a/drivers/media/video/uvc/uvc_video.c
> > > +++ b/drivers/media/video/uvc/uvc_video.c
> > > @@ -794,7 +794,7 @@ static void uvc_uninit_video(struct uvc_streaming
> > > *stream, int free_buffers)
> > > {
> > >   struct urb *urb;
> > >   unsigned int i;
> > > -
> > > + msleep(5000);
> > >   for (i = 0; i < UVC_URBS; ++i) {
> > >   urb = stream->urb[i];
> > >   if (urb == NULL)
> > > @@ -985,7 +985,7 @@ static int uvc_init_video(struct uvc_streaming
> > > *stream, gfp_t gfp_flags)
> > >                   return ret;
> > >           }
> > >   }
> > > -
> > > + msleep(5000);
> > >   return 0;
> > > }
> >
> > I hate random sleeps. Really. I'll need more information about the bug,
> > as well as a simple userspace test application, before making any such
> > change to the driver.
> 
> I made this suggestion to show how to reproduce this bug and how i
> workaround it. I hope it help. I can't make any program to reproduce it.

Thanks a lot for taking time to investigate the issue. I'll report this to 
Logitech and try to create a workaround in the uvcvideo driver.

-- 
Regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
Linux-uvc-devel@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to