Re: [Ekiga-devel-list] Camera fails after a call.



On Tue, Aug 07, 2007 at 01:42:25PM -0700, Vehyla wrote:
> 
> I have a whole lot in dmesg actually.  I will include an attachment but here
> is all the different errors clipped out. 
> 
> usb 1-5: reset high speed USB device using address 2
> uvcvideo: Failed to resubmit video URB (-19).
> uvcvideo: Failed to query (130) UVC control 1 (unit 0) : -32 (exp. 26).
> uvcvideo: Failed to query (1) UVC control 2 (unit 0) : -32 (exp. 26).
> usb 1-5: control timeout on ep0in
> usb 1-5: control timeout on ep0out
> uvcvideo: Failed to query (1) UVC control 1 (unit 0) : -110 (exp. 26).
> 2:3:3: cannot set freq 16000 to ep 0x86
> uvcvideo: Failed to resubmit video URB (-19).
> uvcvideo: Failed to query (131) UVC control 1 (unit 0) : -32 (exp. 26).
> uvcvideo: Failed to query (135) UVC control 2 (unit 2) : -110 (exp. 2).
> 

Try this patch that resolv my problem for the logitech fusion (early model).

diff -r 9d502ba6c4d9 uvc_driver.c
--- a/uvc_driver.c	Sat Apr 21 10:27:43 2007 +0200
+++ b/uvc_driver.c	Sat Apr 21 10:40:58 2007 +0200
@@ -1159,9 +1159,17 @@ static int uvc_register_video(struct uvc
 	 * parameters.
 	 */
 	if ((ret = uvc_video_init(&dev->video)) < 0) {
-		uvc_printk(KERN_ERR, "Failed to initialize the device "
-			"(%d).\n", ret);
-		return ret;
+               uvc_printk(KERN_ERR, "Failed to initialize the device, "
+                          "(%d). trying to reset ...\n", ret);
+
+               if ((ret = uvc_usb_reset(dev)))
+                       return ret;
+
+               if ((ret = uvc_video_init(&dev->video)) < 0) {
+                       uvc_printk(KERN_ERR, "Failed to initialize the device "
+                                  "(%d).\n", ret);
+                       return ret;
+               }
 	}
 
 	/* Register the device with V4L. */
diff -r 9d502ba6c4d9 uvc_v4l2.c
--- a/uvc_v4l2.c	Sat Apr 21 10:27:43 2007 +0200
+++ b/uvc_v4l2.c	Sat Apr 21 10:33:15 2007 +0200
@@ -435,6 +435,10 @@ static int uvc_v4l2_release(struct inode
 		mutex_unlock(&video->queue.mutex);
 	}
 
+       /* leave usb device in a clean state */
+       if (video->dev->state & UVC_DEV_IOERROR)
+               uvc_video_reinit(video);
+
 	/* Release the file handle. */
 	uvc_dismiss_privileges(handle);
 	kfree(handle);
diff -r 9d502ba6c4d9 uvc_video.c
--- a/uvc_video.c	Sat Apr 21 10:27:43 2007 +0200
+++ b/uvc_video.c	Sat Apr 21 10:29:25 2007 +0200
@@ -26,6 +26,30 @@
 /* ------------------------------------------------------------------------
  * UVC Controls
  */
+ 
+int uvc_usb_reset(struct uvc_device *dev)
+{
+       int l, ret;
+
+       l = usb_lock_device_for_reset(dev->udev, dev->intf);
+
+       if (l >= 0) {
+               ret = usb_reset_device(dev->udev);
+               if (l)
+                       usb_unlock_device(dev->udev);
+       }
+       else
+               ret = -EBUSY;
+
+       if (ret)
+               uvc_printk(KERN_DEBUG, "uvc_usb_reset: Unable to reset usb device"
+                          "(%d).\n", ret);
+       else
+               dev->state &= ~UVC_DEV_IOERROR;
+
+       return ret;
+}
+
 
 int uvc_query_ctrl(struct uvc_device *dev, __u8 query, __u8 unit,
 			__u8 intfnum, __u8 cs, void *data, __u16 size)
@@ -45,6 +69,7 @@ int uvc_query_ctrl(struct uvc_device *de
 		uvc_printk(KERN_ERR, "Failed to query (%u) UVC control %u "
 			"(unit %u) : %d (exp. %u).\n", query, cs, unit, ret,
 			size);
+		dev->state |= UVC_DEV_IOERROR;
 		return -EIO;
 	}
 
@@ -656,6 +681,25 @@ static int uvc_init_video_bulk(struct uv
  * Video device
  */
 
+/* 
+ * Reset and Re-Initialize video device
+ */
+int uvc_video_reinit(struct uvc_video_device *video)
+{
+       int ret;
+
+       if ((ret = uvc_usb_reset(video->dev)) < 0)
+               return ret;
+
+       if ((ret = uvc_set_video_ctrl(video, &video->streaming->ctrl, 0)) < 0) {
+               uvc_printk(KERN_DEBUG, "uvc_video_reinit: Unable to commit format "
+                          "(%d).\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
 /*
  * Initialize the UVC video device.
  *
diff -r 9d502ba6c4d9 uvcvideo.h
--- a/uvcvideo.h	Sat Apr 21 10:27:43 2007 +0200
+++ b/uvcvideo.h	Sat Apr 21 10:41:15 2007 +0200
@@ -515,6 +515,7 @@ struct uvc_video_device {
 
 enum uvc_device_state {
 	UVC_DEV_DISCONNECTED = 1,
+	UVC_DEV_IOERROR = 2,
 };
 
 struct uvc_device {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]