webcamd, usb and two webcams - only one works

Hans Petter Selasky hps at selasky.org
Thu Nov 26 13:49:18 UTC 2020


On 11/26/20 2:34 PM, Thomas Steen Rasmussen wrote:
> 
> On 11/26/20 1:18 PM, Hans Petter Selasky wrote:
>>
>> Hi Thomas,
>>
>> Try setting the resolution or framerate down, because high resolution 
>> webcams need a lot of USB bandwidth! 
> 

Hi,

> Hi,
> 
> Thanks for the reply. How can I set the resolution or framerate lower?
> 
> I first connect both webcams, and then try for example with the pwcview 
> command:
> 
> $ sudo pwcview -h -c 1 -o foo.jpg -d /dev/video0 -s xga
> Webcam set to: 640x480 (xga) at 5 fps
> $
> 
> $ sudo pwcview -h -c 1 -o foo.jpg -d /dev/video2 -s xga
> Webcam set to: 640x480 (xga) at 5 fps
> ^C
> $
> 

Try "vga" instead of "xga".

> And only the first (video0+1) works, the second (video2+3) never 
> returns. Can I maybe tell webcamd to set fps and resolution somehow or 
> how would I do it?

This is done by the clients of V4L.

You could try to run webcamd in the foreground. It is also possible to 
enable debugging when you build webcamd from ports. Also, usbdump, can 
dump the traffic of these devices so that you see exactly what is going on.

Can you show what usbconfig tell about these two devices when they are 
connected?

In the "sysctl -a" output you'll find some "%parent" nodes which tell 
how they are connected. Also "devinfo" will tell that.

> 
> The webcams are connected to a externally powered USB3 hub which is 
> connected to a USB3 XHCI controller. I would think the 5 gbit/s offered 
> by USB3 would be enough for this.

USB3 is an own bus, and the 5 GBit/s won't be used unless your device is 
3.0 compatible.

Actually your USB HUB has USB2 and USB3 in parallell.

> The onboard usb3 controller:
> usbus0 on xhci0
> usbus0: 5.0Gbps Super Speed USB v3.0
> ugen0.1: <0x1022 XHCI root HUB> at usbus0
> uhub1: <0x1022 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
> 
> When I plugin the external USB hub it shows both a usb 2 and a usb3 hub 
> for some reason?
> 
> ugen0.2: <VIA Labs, Inc. USB2.0 Hub> at usbus0, cfg=0 md=HOST spd=HIGH 
> (480Mbps) pwr=SAVE (0mA)
> ugen0.3: <VIA Labs, Inc. USB3.0 Hub> at usbus0, cfg=0 md=HOST spd=SUPER 
> (5.0Gbps) pwr=SAVE (0mA)

This is normal and expected! Is the USB HUB self powered?

> 
> uhub5 on uhub1
> uhub5: <VIA Labs, Inc. USB2.0 Hub, class 9/0, rev 2.10/2.21, addr 1> on 
> usbus0
> uhub5: 4 ports with 4 removable, self powered
> uhub6 on uhub1
> uhub6: <VIA Labs, Inc. USB3.0 Hub, class 9/0, rev 3.00/2.21, addr 2> on 
> usbus0
> uhub6: 4 ports with 4 removable, self powered
> 
> So when I plug in the webcams how do I know which "uhub" device they are 
> plugged into? These are the messages after plugging in the webcams:
> 
> =====================================
> ugen0.4: <Jieli Technology USB PHY 2.0> at usbus0
> uaudio0 on uhub5
> uaudio0: <USB Microphone> on usbus0
> uaudio0: No playback.
> uaudio0: Record[0]: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Record[0]: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Record[0]: 16000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: Record[0]: 8000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio0: No MIDI sequencer.
> pcm0: <USB audio> on uaudio0
> uaudio0: No HID volume keys found.
> ugen0.5: <Jieli Technology USB PHY 2.0> at usbus0
> uaudio1 on uhub5
> uaudio1: <USB Microphone> on usbus0
> uaudio1: No playback.
> uaudio1: Record[0]: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio1: Record[0]: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio1: Record[0]: 16000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio1: Record[0]: 8000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
> uaudio1: No MIDI sequencer.
> pcm1: <USB audio> on uaudio1
> uaudio1: No HID volume keys found.
> =====================================
> 
> "uhub5" is the usb2 external hub. Could this be the reason for my timeouts?
> 

Maybe. You can check:

usbdump -i usbus0 -s 65536

And see if there are any USB errors besides from cancelled.

Are you running -stable ?

--HPS


More information about the freebsd-usb mailing list