Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I enable the UVC_QUIRK_FIX_BANDWIDTH quirk in Linux UVC Driver?

Tags:

linux

v4l2

uvc

I am currently trying to run 2 webcams on a Wandboard board, which have to share a USB hub. Problem is , the current driver implementation (YUV only) saturates the USB hub and in the end I can only connect one camera.

However the UVC driver implementation has a quirk for this kind of situation, and others.

Problem is, I did not find any documentation on how to load these quirks. Could you please assist me with that?

like image 342
Adrian Nițu Avatar asked Sep 02 '14 08:09

Adrian Nițu


2 Answers

you can change the behaviour of many kernel-modules by passing some parameters.

you can get a list of all available module parameters with the modinfo command:

# modinfo uvcvideo

shows that there is a "quirks" parameters, which can be used. looking at the faq you posted, it seems that the quirks are really a bitfield, so if you want to enable multiple quirks, you have to add the numbers.

first unload the driver (obviously you must not use it when doing so):

 # rmmod uvcvideo

then re-load it with the quirks parameter. assuming you want to enable both UVC_QUIRK_FIX_BANDWIDTH (which has the hex-value 0x80, which is 128 in decimal) and UVC_QUIRK_RESTRICT_FRAME_RATE (which is 0x200 thus 512) you would use a quirks value of 640 (which is 128+512 resp. 0x200|0x80):

 # modprobe uvcvideo quirks=640
like image 115
umläute Avatar answered Sep 18 '22 13:09

umläute


To make umläute's answer survive reboots, I created file /etc/modprobe.d/uvcvideo.conf with content

options uvcvideo quirks=0x80

To get the module to reload uvcvideo.conf, unload and load the module:

rmmod uvcvideo
modprobe uvcvideo

Interestingly, using echo to set quirks (i.e., while uvcvideo is loaded) did not work, even though the UVC driver FAQ uses echo to modify the trace parameter of uvcvideo.

Note: UVC_QUIRK_FIX_BANDWIDTH enabled many Microsoft LifeCam Cinema webcams per USB host controller in my case (on Ubuntu 14.04) for a machine vision application. The LifeCam Cinema reserves about 48% of USB 2.0 bandwidth (according to Device Manager on Windows), so without the quirk one can operate at most two LifeCams per host controller. (For several host controller chips, I was even limited to one LifeCam without the quirk.)

like image 37
Ulrich Stern Avatar answered Sep 17 '22 13:09

Ulrich Stern