Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 8:13 PM, Thomas Steen Rasmussen wrote:


Anyway, since the APU only has the two external USB plugs I've been 
using, and that is the machine I need this to work on, this doesn't help 
a lot unfortunately. But it is a data point at least.


/Thomas


Hello again,

OK, so I will have to wrap this up for today.

I've moved the cameras back to the APU. I can get both working, but not 
at the same time. I will have to live with that for now.


One is intended for motion detection with the "motion" software, the 
other is just for taking a snapshot of a control panel with some LEDs 
occationally. When I need to do that I can power_off the one used in 
motion and power_on the other one, take the snapshot, and power_off and 
on again, and the other camera works again.


Thank you for all the help. Again :)

/Thomas
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

On 11/26/20 5:05 PM, Thomas Steen Rasmussen wrote:


I see. What does this mean?

Since the same problem is also on different computer, intel instead of AMD.

Same problem also occurred when I replaced one of the webcams with a 
different model.


It isn't clear to me whether this is a problem/bug in one or more of the 
webcams or drivers, or in freebsd or somewhere else?


Thank you for your time and patience with this :)


Hi,

The xHCI controller has some logic to reserve bandwidth in bytes per 
frame (125us for High speed or 1ms for Full speed) for various 
endpoints. If these numbers are wrong the xHCI controller may think 
there is no bandwidth and will not activate the endpoint and schedule 
the transactions.


Maybe my Skylake xHCI doesn't care about these values :-(

Reference:
https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf

--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 4:43 PM, Hans Petter Selasky wrote:

Hi,

xhci_interrupt_poll: event[21] = 33 (0x0001002f8e50 0x0500 
0x02008400)

xhci_check_command: Received command event
xhci_configure_reset_endpoint: Could not stop endpoint 9

xhci_interrupt_poll: event[22] = 33 (0x0001002f8e60 0x0500 
0x02008400)

xhci_check_command: Received command event
xhci_configure_reset_endpoint: Could not set dequeue ptr for endpoint 9


I think 0x0500 means TRB_ERROR (5):

 From the xHCI specification:


Asserted when a TRB parameter error condition (e.g., out of range
or invalid parameter) is detected in a TRB. Refer to section 4.10.2.2
for examples.




I see. What does this mean?

Since the same problem is also on different computer, intel instead of AMD.

Same problem also occurred when I replaced one of the webcams with a 
different model.


It isn't clear to me whether this is a problem/bug in one or more of the 
webcams or drivers, or in freebsd or somewhere else?


Thank you for your time and patience with this :)

/Thomas
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

On 11/26/20 4:36 PM, Thomas Steen Rasmussen wrote:

On 11/26/20 4:26 PM, Thomas Steen Rasmussen wrote:

On 11/26/20 4:08 PM, Hans Petter Selasky wrote:

On 11/26/20 3:38 PM, Thomas Steen Rasmussen wrote:
I tried swapping the webcams around, the error is always with the 
second webcam connected (so video2), regardless of which webcam it is.


Hi,

Might be a bug in the XHCI controller driver or XHCI HW, that the 
isochronous transactions don't get scheduling time.


Do you have the possibility to test on another computer running FreeBSD?


I do actually, let me get that setup.



Hello,

That was easy, webcamd and pwcview was already installed :)

I can confirm the same behaviour happens on an Intel NUC which has this 
XHCI root hub:


uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0

/dev/video0 is able to take a snapshot with pwcview, /dev/video2 hangs.



Hi,

I have a Skylake here with XHCI and it doesn't exhibit this problem when 
using two differently branded HighSpeed UVC webcams simultaneously.


I'm not sure what is causing this. Because your one webcam works alone 
it might have something to do with the xHCI bandwidth allocations, which 
are controlled by the ESIT and average TRB len as shown below. You may 
want to play with these fields in xhci.c:


switch (edesc->bmAttributes & UE_XFERTYPE) {
case UE_INTERRUPT:
case UE_ISOCHRONOUS:
temp = XHCI_EPCTX_4_MAX_ESIT_PAYLOAD_SET(max_frame_size) |
XHCI_EPCTX_4_AVG_TRB_LEN_SET(MIN(XHCI_PAGE_SIZE,
max_frame_size));
break;

--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

Hi,


xhci_interrupt_poll: event[21] = 33 (0x0001002f8e50 0x0500 0x02008400)
xhci_check_command: Received command event
xhci_configure_reset_endpoint: Could not stop endpoint 9

xhci_interrupt_poll: event[22] = 33 (0x0001002f8e60 0x0500 0x02008400)
xhci_check_command: Received command event
xhci_configure_reset_endpoint: Could not set dequeue ptr for endpoint 9


I think 0x0500 means TRB_ERROR (5):

From the xHCI specification:


Asserted when a TRB parameter error condition (e.g., out of range
or invalid parameter) is detected in a TRB. Refer to section 4.10.2.2
for examples.


--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 4:26 PM, Thomas Steen Rasmussen wrote:

On 11/26/20 4:08 PM, Hans Petter Selasky wrote:

On 11/26/20 3:38 PM, Thomas Steen Rasmussen wrote:
I tried swapping the webcams around, the error is always with the 
second webcam connected (so video2), regardless of which webcam it is.


Hi,

Might be a bug in the XHCI controller driver or XHCI HW, that the 
isochronous transactions don't get scheduling time.


Do you have the possibility to test on another computer running FreeBSD?


I do actually, let me get that setup.



Hello,

That was easy, webcamd and pwcview was already installed :)

I can confirm the same behaviour happens on an Intel NUC which has this 
XHCI root hub:


uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0

/dev/video0 is able to take a snapshot with pwcview, /dev/video2 hangs.

/Thomas
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 4:08 PM, Hans Petter Selasky wrote:

On 11/26/20 3:38 PM, Thomas Steen Rasmussen wrote:
I tried swapping the webcams around, the error is always with the 
second webcam connected (so video2), regardless of which webcam it is.


Hi,

Might be a bug in the XHCI controller driver or XHCI HW, that the 
isochronous transactions don't get scheduling time.


Do you have the possibility to test on another computer running FreeBSD?


I do actually, let me get that setup.



There is a debug knob for the XHCI controller,

sysctl hw.usb.xhci.debug

Try flipping it to 17 for a second while in the "timeout" state, and 
then flip it back to 0. Prints end up in dmesg and /var/log/messages . 
It might sched some more details into the exact XHCI error code.


I included some of the dmesg output from the xhci debug here:

==
xhci_setup_generic_chain_sub: NTRB=1
xhci_setup_generic_chain_sub: LINK=0x11aff1d80
xhci_dump_trb: trb = 0xfe00339f2010
xhci_dump_trb: qwTrb0 = 0x00011aff1d80
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1d80
xhci_dump_trb: qwTrb0 = 0x00011ae5ac00
xhci_dump_trb: dwTrb2 = 0x00040400
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_dump_trb: trb = 0xfe00339f1d90
xhci_dump_trb: qwTrb0 = 0x00011ae5b000
xhci_dump_trb: dwTrb2 = 0x00020800
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=2
xhci_setup_generic_chain_sub: LINK=0x11aff1c00
xhci_dump_trb: trb = 0xfe00339f1da0
xhci_dump_trb: qwTrb0 = 0x00011aff1c00
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1c00
xhci_dump_trb: qwTrb0 = 0x00011ae5b800
xhci_dump_trb: dwTrb2 = 0x00020800
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_dump_trb: trb = 0xfe00339f1c10
xhci_dump_trb: qwTrb0 = 0x00011ae5c000
xhci_dump_trb: dwTrb2 = 0x00020400
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=2
xhci_setup_generic_chain_sub: LINK=0x11aff1a80
xhci_dump_trb: trb = 0xfe00339f1c20
xhci_dump_trb: qwTrb0 = 0x00011aff1a80
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1a80
xhci_dump_trb: qwTrb0 = 0x00011ae5c400
xhci_dump_trb: dwTrb2 = 0x00020c00
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=1
xhci_setup_generic_chain_sub: LINK=0x11aff1900
xhci_dump_trb: trb = 0xfe00339f1a90
xhci_dump_trb: qwTrb0 = 0x00011aff1900
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1900
xhci_dump_trb: qwTrb0 = 0x00011ae5d000
xhci_dump_trb: dwTrb2 = 0x00020c00
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=1
xhci_setup_generic_chain_sub: LINK=0x11aff1780
xhci_dump_trb: trb = 0xfe00339f1910
xhci_dump_trb: qwTrb0 = 0x00011aff1780
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1780
xhci_dump_trb: qwTrb0 = 0x00011ae5dc00
xhci_dump_trb: dwTrb2 = 0x00040400
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_dump_trb: trb = 0xfe00339f1790
xhci_dump_trb: qwTrb0 = 0x00011ae5e000
xhci_dump_trb: dwTrb2 = 0x00020800
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=2
xhci_setup_generic_chain_sub: LINK=0x11aff1600
xhci_dump_trb: trb = 0xfe00339f17a0
xhci_dump_trb: qwTrb0 = 0x00011aff1600
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1600
xhci_dump_trb: qwTrb0 = 0x00011ae5e800
xhci_dump_trb: dwTrb2 = 0x00020800
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_dump_trb: trb = 0xfe00339f1610
xhci_dump_trb: qwTrb0 = 0x00011ae5f000
xhci_dump_trb: dwTrb2 = 0x00020400
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=2
xhci_setup_generic_chain_sub: LINK=0x11aff1480
xhci_dump_trb: trb = 0xfe00339f1620
xhci_dump_trb: qwTrb0 = 0x00011aff1480
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_dump_trb: trb = 0xfe00339f1480
xhci_dump_trb: qwTrb0 = 0x00011ae5f400
xhci_dump_trb: dwTrb2 = 0x00020c00
xhci_dump_trb: dwTrb3 = 0x80021415
xhci_setup_generic_chain_sub: NTRB=1
xhci_setup_generic_chain_sub: LINK=0x11aff1300
xhci_dump_trb: trb = 0xfe00339f1490
xhci_dump_trb: qwTrb0 = 0x00011aff1300
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1831
xhci_setup_generic_chain: first=0xf800102c6400 last=0xfe00339f1480
xhci_transfer_insert:
xhci_dump_trb: trb = 0xfe00339f1490
xhci_dump_trb: qwTrb0 = 0x96c80820
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x1821
xhci_dump_trb: trb = 0xf80096c80810
xhci_dump_trb: qwTrb0 = 0x102c6400
xhci_dump_trb: dwTrb2 = 0x
xhci_dump_trb: dwTrb3 = 0x
xhci_transfer_insert: qh_pos = 1
xhci_interrupt: real interrupt (status=0x0008)
xhci_interrupt_poll: event[20] = 37 (0x 0x0c00 
0x9400)


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

On 11/26/20 3:38 PM, Thomas Steen Rasmussen wrote:
I tried swapping the webcams around, the error is always with the second 
webcam connected (so video2), regardless of which webcam it is.


Hi,

Might be a bug in the XHCI controller driver or XHCI HW, that the 
isochronous transactions don't get scheduling time.


Do you have the possibility to test on another computer running FreeBSD?

There is a debug knob for the XHCI controller,

sysctl hw.usb.xhci.debug

Try flipping it to 17 for a second while in the "timeout" state, and 
then flip it back to 0. Prints end up in dmesg and /var/log/messages . 
It might sched some more details into the exact XHCI error code.


--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 3:20 PM, Hans Petter Selasky wrote:


Try running webcamd in the foreground, and see if there are any errors 
output there aswell. Like request for firmware.


I now have webcamd running for both webcams in the foreground, no 
errors, almost the same output except the video device numbers:


==
$ sudo /usr/local/sbin/webcamd -i 0 -d ugen0.2 -U webcamd -G webcamd
webcamd 61415 - - Attached to ugen0.2[0]
webcamd 61415 - - Creating /dev/video0
webcamd 61415 - - Creating /dev/video1


$ sudo /usr/local/sbin/webcamd -i 0 -d ugen0.3 -U webcamd -G webcamd
webcamd 73317 - - Attached to ugen0.3[0]
webcamd 73317 - - Creating /dev/video2
webcamd 73317 - - Creating /dev/video3
==

No further output when taking a snapshot with the working /dev/video0 or 
when trying to take a snapshot with the not working /dev/video2.


I tried swapping the webcams around, the error is always with the second 
webcam connected (so video2), regardless of which webcam it is.


/Thomas
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

Also try to switch the enumeration order.

Is it always the same webcam that doesn't work?

Or only /dev/video2 ?

--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

On 11/26/20 3:13 PM, Thomas Steen Rasmussen wrote:
14:05:25.408143 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:25.654017 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.654030 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.654220 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0


Hi,

This just means the device is not returning data like it should and the 
USB stack detects that and tries to restart.


Try running webcamd in the foreground, and see if there are any errors 
output there aswell. Like request for firmware.


Peek at "ps auxw | grep webcamd" for arguments (remove -B argument).

--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb

On 11/26/20 2:49 PM, Hans Petter Selasky wrote:

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 :)



Try "vga" instead of "xga".



I tried vga but it did not make a difference, it still says 640*480 and 
only one camera works.


I removed the external USB hub (which is externally powered) from the 
picture and plugged both cameras directly into the APU for now, to 
eliminate some potential sources of issues. The issue still remains.


Using usbdump I was able to see the USB back-and-forth when taking a 
snapshot with pwcview with the working camera. About maybe 100 lines or 
so, no errors.


Then I tried the other camera where pwcview never returns, and it looks 
similar at first but then gets stuck in a loop of:


=
14:05:25.408143 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:25.654017 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.654030 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.654220 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:25.93 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.900012 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:25.900141 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:26.146015 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.146035 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.146244 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:26.392001 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.392017 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.392229 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
^C14:05:26.637926 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.637939 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.638104 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:26.883934 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.883959 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:26.884114 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:27.129974 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.129984 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.130124 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:27.375997 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.376006 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.376182 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0
14:05:27.621937 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.621950 usbus0.3 
DONE-ISOC-EP=0084,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
14:05:27.622184 usbus0.3 
SUBM-ISOC-EP=0084,SPD=HIGH,NFR=128,SLEN=0,IVAL=0


210 packets captured
210 packets received by filter
0 packets dropped by kernel
$
=

Note that usbdump is completely quiet when I don't run pwcview on either 
camera. If the problem was that the first webcam sends too much data for 
the second webcam to work, wouldn't usbdump show that? This makes me 
think the problem is elsewhere!





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.


This is devinfo output with the two webcams plugged directly into the 
USB plugs on the APU3:


xhci0
  usbus0
uhub1
  uaudio0
pcm0
  uaudio1
pcm1

Where "uhub1" is uhub1: <0x1022 XHCI root HUB, class 9/0, rev 3.00/1.00, 
addr 1> on usbus0





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


I sent the output of dump_all_desc for one of them in the initial email. 
I can send both or other output if needed?


This is the brief output for both:

===
$ sudo usbconfig -d ugen0.3 dump_device_desc
ugen0.3:  at usbus0, cfg=0 md=HOST 
spd=HIGH (480Mbps) pwr=ON (500mA)


  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x00ef  
  bDeviceSubClass = 0x0002
  bDeviceProtocol = 0x0001
  bMaxPacketSize0 = 0x0040
  idVendor = 0x1224
  idProduct = 0x2a25
  bcdDevice = 0x0100
  iManufacturer = 0x0001  
  iProduct = 0x0002  
  iSerialNumber = 

Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

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
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Thomas Steen Rasmussen via freebsd-usb



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,

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
$

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?


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.


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)


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?

Thanks!

/Thomas



___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"


Re: webcamd, usb and two webcams - only one works

2020-11-26 Thread Hans Petter Selasky

On 11/26/20 1:04 PM, Thomas Steen Rasmussen via freebsd-usb wrote:

Hello USB friends :)

I am having a hard time trying to get two webcams working simultaneously 
on FreeBSD 12.2-STABLE r367109 GENERIC amd64.


Each webcam works by itself, for example when taking a snapshot with 
pwcview:


sudo pwcview -h -c 1 -o foo.jpg -d /dev/video0

The webcam creates two video devices, video0 and video1. When I plug in 
the second webcam video2 and video3 are created. But trying to use the 
device doesn't work, pwcview hangs forever and multimedia/motion 
complains about timeouts when speaking to the camera.


If I swap the cameras around then "the other one" works, so I know both 
cameras are fine.


It seems somehow webcamd or maybe something in the usb system doesn't 
like having two cameras in my setup.




Hi Thomas,

Try setting the resolution or framerate down, because high resolution 
webcams need a lot of USB bandwidth! We currently don't have so many 
checks for excess bandwidth usage in the USB stack in FreeBSD, but I 
believe this is the root cause.


Or make sure the webcams are connected to different USB host controllers.

I recently bought a couple of USB 3.0 capable webcams to resolve the 
issue I had on my setup.


USB 2.0 is only 480 MBit/s and many webcams simply send raw data :-)

Both are connected to a USB hub, but I have tried connecting one 
directly to the computer, which is a pcengines APU3C4 btw. It did not 
make a difference.


What can I try to troubleshoot/debug this? Any more info needed?


--HPS
___
freebsd-usb@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"