Re: [PATCH] uvcvideo: Be tolerant about IO errors

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

 



Hi Holger,

(CC'ing the linux-usb mailing list)

On Sunday 20 January 2013 21:52:42 Holger Oehm wrote:
> Hi Laurent,
> 
> this is my first attempt at submitting a patch, so please apologize my
> mistakes.

Thank you for your patch. It's always nice to see new contributors :-)

> I attached the patch (generated with git format-patch HEAD^1)
> because Thunderbird seems to mangle it when I use cut and paste.

I advice using git-send-email to send patches, that avoids e-mail mangling 
issues. The git learning curve is a bit steep, but it's a very powerful tool.

> The patch comes from the source tree that I synced from
> git://github.com/raspberrypi/linux.git, branch refs/heads/rpi-3.6.y a
> 3.6.11 source tree. In the current sources 3.8-rc4 the location of the
> changed file (uvc_video.c) has changed to
> drivers/media/usb/uvc/uvc_video.c, but the file itself hasn't changed,
> so the patch should still apply to the file in the new location.
> 
> With the change I can use my Logitech C200 webcam on the raspberry pi,
> without it, the webcam is basically unusable on the raspberry (it works
> fine when I attach it to my PC).
> 
> Please tell me if it makes any sense at all to incorporate my change. I
> would be willing to put some more effort into this, if needed.

[patch inlined to ease review]

> From: Holger Oehm <holger.oehm@xxxxxxxxxxxxxx>
> Date: Sun, 20 Jan 2013 20:53:34 +0100
> Subject: [PATCH] uvcvideo: Be tolerant about IO errors
> 
> On raspberry pi Logitech C200 Webcam sometimes causes the uvcvideo
> module to issue a warning "uvcvideo: Non-zero status (-5) in video
> completion handler". Afterwards guvcviewer or motion stall.
> 
> This change ignores the urb->status value of -EIO (but still prints
> a warning message) and continues processing.
> 
> Signed-off-by: Holger Oehm <holger.oehm@xxxxxxxxxxxxxx>
> ---
>  drivers/media/video/uvc/uvc_video.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/uvc/uvc_video.c 
b/drivers/media/video/uvc/uvc_video.c
> index 7ac4347..51df621 100644
> --- a/drivers/media/video/uvc/uvc_video.c
> +++ b/drivers/media/video/uvc/uvc_video.c
> @@ -1305,6 +1305,10 @@ static void uvc_video_complete(struct urb *urb)
>  	case 0:
>  		break;
>  
> +	case -EIO:
> +		uvc_printk(KERN_WARNING, "Ignoring IOError in video completion 
handler.\n");
> +		break;
> +
>  	default:
>  		uvc_printk(KERN_WARNING, "Non-zero status (%d) in video "
>  			"completion handler.\n", urb->status);

-EIO isn't documented in Documentation/usb/error-codes.txt. Unless the 
documentation is outdated, it shouldn't be returned as a URB status error. The 
proper solution would thus be to fix the USB host controller. That's no small 
task though, from what I've heard the BCM2835 USB host controller driver is of 
very dubious quality. I'm sure many people would be happy if you cleaned it up 
;-)

> PS: I wasn't sure whether the fall-through in the default case was
> intended, so I changed the behavior only for the -EIO case, but it might
> be possible that the real issue is a missing break after the code for
> the default case.

The fall-through was intended. A couple of common error codes are expected and 
should not be logged, while others indicate a real problem and are printed in 
the kernel log.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux