Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.