2

I need my usb video camera (A4Tech) to take /dev/video0 and the capture card (analog converter) to take /dev/video1 regardless of the order I connect them to PC.

1 Answers1

2

I'm not sure it can be done; but you can create a persistent symlink based on a device attribute (for instance ID_MODEL).

Plug in your e.g. camera and run

udevadm info --export-db > file.txt

then look at file.txt to locate the camera (perhaps search for A4Tech?) and find the ID_MODEL attribute.

Then create a file called /target/etc/udev/rules.d/70-persistent-capture-device.rules and put stuff like this in it:

SUBSYSTEM=="video4linux", ENV{ID_MODEL}=="'YOUR_ID_MODEL'", SYMLINK+="a4tech-camera", ENV{GENERATED}="1"

Obviously, substitute YOUR_ID_MODEL with the value you found by looking at udevadm output.

When you plugin the camera, a symlink to the appropriate video* device will be created as /dev/a4tech-camera.

You can add a similar line to the same file for your capture card, assuming it shows in udevadm output and you can find an ID_MODEL or other attribute to identify it.

roadmr
  • 34,802