mikedmor / OctoPrint_MultiCam

Extends the Control tab of OctoPrint, allowing the ability to switch between multiple webcam feeds.
45 stars 19 forks source link

Second camera address changes #37

Closed chaingun427 closed 1 year ago

chaingun427 commented 3 years ago

Device address constantly changing from video0 to video 1-4 after system reboot.

hawkeyexp commented 3 years ago

This is nothing which is caused by the addon - you need to fix you cameras by an udev-rule to ensure the name is always the same - by default multiple cams are anmed by the kernel during the detection and this is possible random.

for example my udev rule for my nozzlecam: stored as /etc/dev/ruls.d/99-cams.rules

ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="337b", ATTRS{idProduct}=="090c", SYMLINK+="nozzlecam"
ACTION=="remove", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="337b", ATTRS{idProduct}=="090c", RUN+="/bin/rm -f /dev/nozzlecam"

As you can see the device is defined by vendor and device id - by default a device as /dev/videoX is ceated and this rule ensures a link from /dev/nozzlecam to /dev/videoX - this way nozzlecam is always the same device and not depending which videoX is asigned.

But for same camera modules you must possible check another attrib like a serialnumber etc. - ask google for more attribs. But notze: some cams have no unique attribs and not usable this way.