From owner-freebsd-usb@freebsd.org Thu Nov 26 13:49:18 2020 Return-Path: Delivered-To: freebsd-usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C71BE4ACE27 for ; Thu, 26 Nov 2020 13:49:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4ChfHy4dsqz4WCF for ; Thu, 26 Nov 2020 13:49:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: by mailman.nyi.freebsd.org (Postfix) id 9EBFA4ACCD2; Thu, 26 Nov 2020 13:49:18 +0000 (UTC) Delivered-To: usb@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E86A4ACB63 for ; Thu, 26 Nov 2020 13:49:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ChfHy3HT4z4WFC for ; Thu, 26 Nov 2020 13:49:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 3049026020D; Thu, 26 Nov 2020 14:49:16 +0100 (CET) Subject: Re: webcamd, usb and two webcams - only one works To: Thomas Steen Rasmussen Cc: usb@freebsd.org References: <9a382539-c90d-91b9-bfac-f36c0f19d3f7@selasky.org> <723be24d-b2fe-85df-4961-5483004050e8@gibfest.dk> From: Hans Petter Selasky Message-ID: Date: Thu, 26 Nov 2020 14:49:09 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <723be24d-b2fe-85df-4961-5483004050e8@gibfest.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4ChfHy3HT4z4WFC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 13:49:18 -0000 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: at usbus0, cfg=0 md=HOST spd=HIGH > (480Mbps) pwr=SAVE (0mA) > ugen0.3: 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: on > usbus0 > uhub5: 4 ports with 4 removable, self powered > uhub6 on uhub1 > uhub6: 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: at usbus0 > uaudio0 on uhub5 > uaudio0: 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: on uaudio0 > uaudio0: No HID volume keys found. > ugen0.5: at usbus0 > uaudio1 on uhub5 > uaudio1: 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: 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