Re: [linux-uvc-devel] dual c270 webcams on raspberry pi via pygame, cannot open two streams at the
Linux UVC driver and tools
Brought to you by:
pinchartl
From: <Jak...@zf...> - 2018-10-26 11:29:31
|
Problem has been resolved. Tl;dr: ignoring the usb spec as far as cable length and voltage requirements is fine, cameras only work without usb extenders Following the usb specifications on Wikipedia for usb max cable length is 16.5ft for usb2 and 9.8ft for usb1.1, with a line voltage in the range of 4.75-5.25v As I need to locate the cameras 30-40ft away, I acquired some usb extenders which drop the bus down to usb1.1 (why 1.1 is still sold is beyond me) but that’s fine because now I can have longer wires while staying in the spec. using this at the end of the wire I had only 4.1v with the cameras powered up, so I then acquired a voltage booster to take that to 5.2v. now the system is in spec, but doesn’t work. As a last ditch effort I simply cut the camera usb cord and extended it with 30 feet of cat6 ethernet: blue pair 0v, brwn pair 5v, green pair gnd, orange d+, orange stripe d-. works fine now even with 4.2v at the end, been running like this for 16 hours no glitches whereas with the standard-following setup it would run for max 100seconds. It appears something in the kernel or drivers or whatnot breaks when working over usb1.1, im not sure this is even worth looking into a fix for since 1.1 devices are obsolete aside from this specific usb extender. Thanks all for your help. -----Original Message----- From: Jayakrishnan M <jay...@gm...> Sent: Saturday, October 13, 2018 13:36 To: Harris Jake LPR <Jak...@zf...> Cc: linux-uvc-devel <lin...@li...> Subject: Re: [linux-uvc-devel] dual c270 webcams on raspberry pi via pygame, cannot open two streams at the same time Hello, On Mon, Oct 8, 2018 at 5:34 PM <Jak...@zf...> wrote: > > I believe they are running at full speed not high speed because the usb extender is usb 1.1, not sure why 1.1 devices are even made anymore but regardless it is what it is. The cameras report a needed throughput of 944 B/frame, therefore @ 15fps with two cameras that is ~28 kBytes/sec while the usb1.1(full speed) standard allows for 1536 kBytes/sec thus I don’t see bandwidth being an issue. USB 1.1 will be a limiting factor for your application. A 160x120 YUYV frame is 38400 bytes in size. The camera sends only 944 bytes in one USB frame (1ms interval). So the camera needs 41 USB frames to transfer one video frame. So at 15fps, one camera needs 41*15=615 USB frames to transfer data. So when you use two cameras, you will not have enough bandwidth and will end up dropping data. Still, it is not reason enough for the device to get disconnected. The log does not show what causes the camera to disconnect. You might want to enable logs in the USB host controller driver to debug the problem. Regards, Jayakrishnan > > -----Original Message----- > From: Jayakrishnan M <jay...@gm...> > Sent: Saturday, October 06, 2018 12:47 > To: Harris Jake LPR <Jak...@zf...> > Cc: linux-uvc-devel <lin...@li...> > Subject: Re: [linux-uvc-devel] dual c270 webcams on raspberry pi via > pygame, cannot open two streams at the same time > > Hello Jake, > > On Thu, Oct 4, 2018 at 1:23 AM <Jak...@zf...> wrote: > > > > Evening, > > > > I'm trying to run two Logitech c270 webcams at the same time on a raspberry pi3. Running one by itself as a continuous video stream works fine, attempting to open two at the same time never works. > > In the log file, it appears that the cameras are getting identified as full speed devices and not as high speed devices. Are you running out of bandwidth when trying to capture from both cameras? > > Regards, > Jayakrishnan > > > > > I'm doing this in python via pygame, to eliminate any possible > > issues on my code I manually ran the commands in idle and wrote down > > the times to compare them with the kern.log file after enabling the > > trace as explained in the FAQ. I attached the log file during the > > time I was running the commands, following are the commands and > > their corresponding line number in the log file as well as the time > > they were ran(based on log file time) > > > > LOG FILE LINE UPTIME COMMAND > > pygame.camera.init() > > 143 260.14 pygame.camera.list_cameras() > > cam0 = pygame.camera.Camera('/dev/video0') > > 157 356.70 cam0.start() > > cam1 = pygame.camera.Camera('/dev/video1') > > 260 372.23 cam1.start() > > 793 501.14 cam0.stop() > > Cam1.stop() # fails, > > bad file descriptor > > > > It appears from the log cam1 attempts to start but the driver drops it, then the camera remounts as /dev/video2, subsequent attempts to reconfigure and start the camera as video2,3,4 etc has the same effect. > > > > The only way to access cam1 is to stop cam0 first, but each time a camera is stopped it is released then remounts as something else, eventually failing after a few minutes of start/stop/remount cycles. > > > > I've attempted to apply the 0x80 quirks as recommended in https://elinux.org/RPi_USB_Webcams but that lead to an I/O error when cam0.start() was ran. > > > > _______________________________________________ > > Linux-uvc-devel mailing list > > Lin...@li... > > https://lists.sourceforge.net/lists/listinfo/linux-uvc-devel > |