Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1624609
| From | Daniel Axtens <dja@axtens.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect |
| Date | 2017-04-17 11:00 +0200 |
| Message-ID | <txaFP-70u-1@gated-at.bofh.it> (permalink) |
| References | <txaFP-70u-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
When an in-use webcam is disconnected, I noticed the following messages: uvcvideo: Failed to resubmit video URB (-19). -19 is -ENODEV, which does make sense given that the device has disappeared. We could put a case for -ENODEV like we have with -ENOENT, -ECONNRESET and -ESHUTDOWN, but the usb_unlink_urb() API documentation says that 'The disconnect function should synchronize with a driver's I/O routines to insure that all URB-related activity has completed before it returns.' So we should make an effort to proactively kill URBs in the disconnect path instead. Call uvc_enable_video() (specifying 0 to disable) in the disconnect path, which kills and frees URBs. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Axtens <dja@axtens.net> --- Before this patch, yavta -c hangs when a camera is disconnected, but with this patch it exits immediately after the camera is disconnected. I'm not sure if this is acceptable - Laurent? --- drivers/media/usb/uvc/uvc_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 2390592f78e0..647e3d8a1256 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1877,6 +1877,8 @@ static void uvc_unregister_video(struct uvc_device *dev) if (!video_is_registered(&stream->vdev)) continue; + uvc_video_enable(stream, 0); + video_unregister_device(&stream->vdev); uvc_debugfs_cleanup_stream(stream); -- 2.9.3
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect Daniel Axtens <dja@axtens.net> - 2017-04-17 11:00 +0200
Re: [PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2017-04-17 14:50 +0200
Re: [PATCH 2/2] [media] uvcvideo: Kill video URBs on disconnect Daniel Axtens <dja@axtens.net> - 2017-04-23 02:50 +0200
csiph-web