Hi,

On Tuesday 15 September 2009 10:01:03 Bo Liu wrote:
> Hi,
> 
> I found a problem when using my webcam. First, it's ok, but after I unplug
> it. Systerm call poll() will not return.
> 
> I looked at the src code, and found that uvc_queue_poll() always return 0,
> it didn't know the webcam have unpluged at that time.
> 
> And I saw in funtion uvc_video_complete(), if urb->status is
> -ESHUTDOWN,uvc_queue_cancel(queue, urb->status == -ESHUTDOWN); will be
> called.

That's right, and then uvc_queue_poll() should return POLLERR, making poll() 
return.

> But, if just when in uvc_video_complete()> usb_submit_urb() , the webcam is
> unpluged, the usb_submit_urb() will failed, but just with a printk. Won't
> call uvc_queue_cancel(). So, uvc_queue_poll() will always return 0.  And, I
> add uvc_queue_cancel() after usb_submit_urb()  failed,erverything is ok.
> 
> Is this a bug ?

This is weird. The uvcvideo driver submits several URBs, so even if the device 
is disconnected during the completion handler, the next URBs should get a -
ESHUTDOWN status (at least with EHCI USB controllers).

Are you using the latest driver ? What status do you get when the completion 
handler is called for the next URB after usb_submit_urb() returns -ESHUTDOWN ? 
What USB controller are you using ?

> Funtions uvc_video_complete():
> 
> 716     if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) {
> 717             uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n",
> 718                        ret);
> 719     }

-- 
Regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to