1

I have one camera USB which on connect makes a place as /dev/video0, now using other applications while its reading /dev/video0 works fine, after some time like couple of hours later, automatically the /dev/video0 disappear and it becomes /dev/video1. As a result the same application stop working to capture it because there is no more /dev/video0.

How is it possible to apply a BASH loop to have a clone of /dev/video0 and /dev/video1 always. Like if video0 is lost but video1 is present then the script will clone exactly one another.

Any idea, how to fix it so that we have always /dev/video0 and /dev/video1 clone of any one another?

Follow up:

Well answered too

3

This is pretty common, but basically you shouldn't mess with stuff under /dev it's a special file system that gets regenerated causing just the problem your talking about. instead you need to set up a udev rule to make sure your devices are always getting the same name.

Use this information from comment 5, to setup your rules file.

It's a bit complicated to phase correctly in this site, but basically:

  1. Get your device info with udevinfo -a -p $(udevinfo -q path -n /dev/video0) for each device.
  2. Find something different about the devices
  3. Head to /etc/udev/rules.d and make a new rules file (with a low number like 11)
  4. modify the file to use your new attribute and give your device a new/static name

It's very complicated, but works quite well.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy