Dear Laurent,

Laurent Pinchart wrote:
> On Monday 09 November 2009 00:04:36 Paulo Assis wrote:
>   
>> Hi,
>> I tested this in my system and was able to grab two simultaneous YUYV
>> 1600x1...@5fps video streams.
>> The cameras are two different uvc logitech models connected to two
>> separate usb controllers, my board has plenty of them :)
>> Connecting both cameras to the same controler (e.g. the two front
>> ports) will cause the second stream to fail.
>>
>> I don't know about windows since I don't use it, but are you sure you
>> aren't getting a zoomed (1600x1200) image from a lower resolution?
>> maybe the windows driver is playing a trick on you.
>>     
>
> That's one possibility.
>
> If I remember correctly Windows might be violating the USB spec by allowing 
> devices to use more than 80% of the available bandwidth for periodic 
> (isochronous and interrupt) transfers. Or it might calculate the bandwith 
> slightly differently than Linux.
>
> In any case, the problem under Linux comes from the fact that the USB core 
> rejects the uvcvideo driver's request to allocate bandwidth for the second 
> camera because not enough bandwidth is available. The uvcvideo driver can't 
> do 
> much about it.
>
> Now, the camera might lie about the bandwidth it really requires, and it 
> might 
> be possible to hack the driver to request less bandwidth and still get away 
> with it. I have some doubts that this would work though, but it might be 
> worth 
> a try.
>   

This sounds like very likely explanation of my different Linux/Windows
experience.

Thanks also for the hint how to hack the driver. Fortunately, I can
avoid hacking the driver as I solved the problem by using two separate
USB controllers. But I'll look to the code just for curiosity... Thanks
anyway for your reply.

Regards,
Vojtech
> As you've written your own userspace software I assume you're familiar with C 
> programming so I'll just give you a few pointers to hack on the driver :-)
>
> USB bandwidth allocation is done in the uvc_init_video() function 
> (uvc_video.c) by a call to usb_set_interface(). You can check which alternate 
> setting the driver requests by printing the value of variable 'i'.
>
> A look at the camera's USB descriptors (lsusb -v) will show you a list of 
> alternate settings for the video streaming interface. Each alternate setting 
> has different packet sizes for the isochronous endpoint. Locate the alternate 
> setting with the biggest packet size below the one requested by the driver, 
> and modify uvc_init_video() to hardcode that alternate setting. If that's 
> still too much bandwidth, repeat the procedure until you can start streaming 
> on both cameras.
>
> The driver will then probably get corrupted data (lost packets), but it could 
> be worth a try.
>
>   
>> BTW with some new camera models that support MJPG in high resolution
>> you should able to squeeze two MJPG 1600x1...@10fps video streams from
>> the same usb controller.
>>     
>
>   


-- 
--------------------------------------------------------------
Vojtech Franc, Ph.D.
Research fellow

Center for Machine Perception
Department of Cybernetics
Faculty of Electrical Engineering
Czech Technical University in Prague

email: xfra...@cmp.felk.cvut.cz
www: http://cmp.felk.cvut.cz/~xfrancv
phone: +420 22435 7665
--------------------------------------------------------------

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

Reply via email to