If it were me, I'd next swap in a Raspberry Pi 3B or 3B+ at this point. I'm guessing that this is Pi4B-specific and it will suddenly work as expected on the earlier platform.
Similarly to your problem, if I press the reset button of a serial PyBoard Raspbian won't recapture the same device, it will use the next one available. So it was /dev/ttyACM0 maybe and after pressing the button it's suddenly /dev/ttyACM1 then. But rebooting puts it back to zero in my case. Perhaps yours—when it goes bad—it's just incrementing one of the two device handles in such a way that your configuration is temporarily wrong.
Not sure if we mentioned this in this thread but I think I'd plug both of these into the non-blue (v2.0 spec) USB connectors.
This is a 3B+ fresh out of the box (no blue USB ports).
When I run the v4l2-ctl --list-devices above it seems to use video0 for the first cams JPEG stream and video1 for its YUV stream, 2 and 3 are for the second cam. Somehow it seems to know that I want the JPEG streams and attach the symlinks to the correct ones. Things still fail if I use the -y option and the correct /dev/video, and also when I switch things around (restarting the appropriate webcamd). I'll swap out the 3B+ and see if it's a board thing, but I don't understand how it would be as it's not consistently one camera or video device... this sounds like a software glitch.
I'll switch boards and see what happens... assuming just the board swap will be ok, and won't melt my router or 3d printer... at this stage, I'll try anything
My bad, I'm mixing up multiple support threads on here. You might even consider this approach (it's what I did on my own printer). The mobility means that I can re-use it on other projects or add more if I need to seriously document something.
When I did this before I had a raspicam and a C270 and after some manual config it worked fine. But the raspicam is really pants (laggy/slow/bad motion blur/can't control parameters...) at 1280x720 so I thought I'd go for 2 C270s. I can think of no reason why this won't work as it works fine with 1, and it can happily run 2 mjpeg-streamers.
For info, second board and its 5 attempts, 1 success.
If you did have a Pi4B then I would say that it's got plenty of RAM to make all this happy.
Which makes me think... does any of this use hardware acceleration (math/gpu)? If so, then maybe it's a matter of testing this. Adjust the gpu_mem in your /boot/config.txt higher (stealing from CPU memory).
I upped the gpu_mem to 256 from 129 and its still failing.
I think I might be getting somewhere though, what I'm seeing is the symlinks changing:
When /dev/videobase works, it points at /dev/video0, when it fails it points at /dev/video1
When /dev/videosky works, it points at /dev/video2, when it fails it points at /dev/video3
If I delete the symlink and remake it to the correct device, then restart the webcamd it seems to work.
How can I force the symlink to point to the first video channel for that device in the rules file? I don't want to hard code this to use video0 and video2 cuz they may change if I pull the cables out and move them accidentally... and besides, that's kind of the point of the rules file.
Worst-case, I'll botch something in bash to run the v4l2-ctl call and compare bus infos and then rebuild the symlinks, but there has to be a better way, I only have a small underpowered brain????
I think I nailed it. Adding , ATTR{index}=="0" seems to have had 4 successful reboots. I'll try more.
Running sudo udevadm info --name=/dev/video0 --attribute-walk shows all the parameters and it seems you can use anything in the heirachy. When you compare it to /dev/video1 you only see the index difference.
Hey nigeljohnson73! I've been working through trying to get two microsoft LifeCams working, I'm to a point where I can both working separately, but together only one will work, and I think it's an allocation issue like you were having. What is you added ATTR{index}=="0" to? I tried /etc/udev/rules.d but there wasn't anything in there to edit to add that to. I feel like I'm sooooo close to having these working, thank you!
Hey OutsourcedGuru, I just posted this to nigel, but thought I'd reply direct to you too just in case he doesnt' see it.
I've been working through trying to get two microsoft LifeCams working, I'm to a point where I can both working separately, but together only one will work, and I think it's an allocation issue like you were having. What is you added ATTR{index}=="0" to? I tried /etc/udev/rules.d but there wasn't anything in there to edit to add that to. I feel like I'm sooooo close to having these working, thank you!
Ah ha. Not sure life cams will work, but check the syslog when you plug them in. If you get serial numbers then you're in luck and you can add vendor, product and series numbers to the rules file for each cam.
Have a check on YouTube for Chris's basement. He recently did a good run-through with all the syntax needed (bar the INDEX bit here). If you're not a YouTube fan I'll try and pop back later when I can get to my computer and dig out my rules file.
They do function, only one at a time, which seems to flop on load. The cams show up when plugged in and give me all the info for them. I'll check that part of that video and see if I can get it to work, and let ya know either way. Thanks!
Search on the forum here for udev rules. I've posted about it before. In the case where you have two identical devices you have to go beyond just differentiating by product and manufacturer and to use the serial number of each device as well. The best approach is to give each an alias in the udev rule so that it ends up as: /dev/hans and /dev/chewie, for example.