Ubuntu – Set webcam on different USB bus

12.04usbwebcam

my objective is to capture from two webcams simultaneously at a resolution of 640×480. I am currently experiencing a problem where my two webcams are plugged in different USB ports but are using the same USB bus. Therefore, I get the following error:

libv4l2: error turning on stream: No space left on device

VIDIOC_STREAMON: No space left on device

and not able to capture from both cameras at 640×480. I would therefore like to be able to set each Logitech webcam on a different bus, which I believe would then allow me to capture from both webcams simultaneously.

This is what the output of lsusb shows:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 05ca:18b0 Ricoh Co., Ltd Sony Vaio Integrated Webcam
Bus 003 Device 002: ID 147e:1000 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 002 Device 012: ID 046d:0821 Logitech, Inc. HD Webcam C910
Bus 002 Device 007: ID 046d:0991 Logitech, Inc. QuickCam Pro for Notebooks

Is there a way to set each webcam to use a different USB bus?

Best Answer

The answer is: it's not actually your problem.

Some logitech cameras have usb bandwidth allocation bug. Lets see if that's the case.

cat /sys/kernel/debug/usb/devices | grep "B: "

will give you current bandwidth allocation of all usb hubs, output will be something like this:

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc= 35/900 us ( 4%), #Int=  3, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0

As you can see, I currently have 35 mbps allocated of my usb3 hub. The problem with some logitech cameras, though, is that they will always allocate as much as they can get (480 mbps), disregarding of mode. And so it's down to simple arithmetic as 480 + 480 > 900 and second camera just "won't fit".

As long as your cameras are plugged in the same hardware usb hub, you will have that problem.

Also bear in mind, that webcamera usually allocates 128mbps in MJPEG and 424mbps in uncompressed mode for 640x480.