On Wed, 23 Aug 2017, Martin Oprešnik wrote: > Hi, > > What happens when you try to use the fourth camera? > > I'm sorry I forgot to write whet the actual problem is. Error message is > "No space left on device". Based on what I read this means there it > can't allocate enough bandwidth. > > Using this command (cat /sys/kernel/debug/usb/devices | grep "B: "), I > could see bandwidth allocation if cameras are connected to USB 2.0, but > not if connected to 3.0 port. With this command and usbtop I created > this table. > > +-------------+----------+----------------------+----------------+ > | Resolution | Name | Bandwidth allocation | Transfer rate | > +-------------+----------+----------------------+----------------+ > | 1280x720 | 720p | 256us | up to ~1.4Mb/s | > | 1600x896 | | 424us | up to ~1.7Mb/s | > | 1920x1080 | Full HD | 488us | up to ~1.8Mb/s | > +-------------+----------+----------------------+----------------+ > > On USB 2.0 port there is 800us available bandwidth, that means i could > run cameras in this modes: > -3 cameras in 720p (used 96% of bandwidth) > -one camera in 720p and one camera in FullHD > > On USB 3.0 port I can run cameras in same formats as on USB 2.0 and > additionally > -one camera in FullHD and one camera in 1600x896 > > I currently don't have 4 cameras, but I suppose that if we can make > cameras to work on higher resolutions, I could add more cameras. > Cameras are connected trough TP-LINK 3.0 USB hub (Model: UH720), but > there is no difference if I connect one camera directly and other over hub. Your bandwidth calculations do not take into account the USB keyboard and the OM device (whatever that is). They use up a significant fraction of the total bandwidth. Try plugging those two devices into USB-2 ports (or into a hub that is plugged into a USB-2 port) while plugging the cameras all into USB-3 ports (or into a hub that is plugged into a USB-3 port), and see if that helps at all. And try to avoid nesting hubs deeply; you're better off plugging multiple hubs each into a separate controller than all of them through a single hub into a single controller. Alan Stern > Then while running with 3 cameras, make a copy of > /sys/kernel/debug/usb/devices and post the copy. > > I added attachment. > > Also, what version of the kernel are you using? > > Linux odroid 4.9.38 > > and which host controller? (xhci, ehci, ohci, uhci) > > Using this code: > struct v4l2_capability caps = {}; > if (-1 == xioctl(fd, VIDIOC_QUERYCAP, &caps)) > { > perror("Querying Capabilities"); > return 1; > } > > printf( "Driver Caps:\n" > " Driver: \"%s\"\n" > " Card: \"%s\"\n" > " Bus: \"%s\"\n" > " Version: %d.%d\n" > " Capabilities: %08x\n", > caps.driver, > caps.card, > caps.bus_info, > (caps.version>>16)&&0xff, > (caps.version>>24)&&0xff, > caps.capabilities); > It says "usb-xhci-hcd.2.auto-1.1.1.4". > > On 23. 08. 2017 08:04, Felipe Balbi wrote: > > Hi, > > > > Alan Stern<stern@xxxxxxxxxxxxxxxxxxx> writes: > >> On Tue, 22 Aug 2017, Martin Oprešnik wrote: > >> > >>> Hello, > >>> > >>> we are working on a project, where we need multiple cameras connected to > >>> embedded computer. For computer we have chosen odroid XU4 and for > >>> cameras Logitech C920. We need at least 5 cameras running with 720p. The > >>> problem we have is allocated USB bandwidth (cameras are using > >>> isochronous transfer). Currently we can run 3 cameras on 720p. Image is > >>> transferred in h264 compressed format. Writing on disk is done directly > >>> trough memory map using V4L2 api and files on disk are really small and > >>> using usbmon/wireshark shows ~1104kB/s (there should be a lot of USB > >>> bandwidth left). > >> What happens when you try to use the fourth camera? > >> > >>> I tried same setups on my laptop and I don't get any better results, so > >>> I suspect there is some space for improvement in software and it's not > >>> odroid's fault. I tried changing different parameters in uvcvideo driver > >>> and I think only wMaxPacketSize is affecting bandwidth allocation. And > >>> changing that is reflected in non working camera. > >>> Now I don't know enough about USB and linux kernel to work around this > >>> problem and I would be very happy if you could give me some help or > >>> directions. > >>> If I should provide some additional information, I'll be happy to add it. > >>> > >>> I am looking forward to hearing from you. > >> Please try the following. First, mount a debugfs filesystem: > >> > >> mount -t debugfs none /sys/kernel/debug > >> > >> Then while running with 3 cameras, make a copy of > >> /sys/kernel/debug/usb/devices and post the copy. > >> > >> Also, what version of the kernel are you using? > > and which host controller? (xhci, ehci, ohci, uhci) > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html