Originally we were using udev rules like below, but they can be annoying to set up and maintain. So we switched to managing ports through pyudev. It made it a lot easier to manage across devices.
Idk just thought this might be helpful to somebody out there. Good luck all.
Are you testing this with PhotonVision or with what computer vision backend? Curious if this works for indexing cameras since last time I tried to use udev I couldn’t get it to work with PV (the field it was looking for couldn’t be changed by udev or something). It may have just been due to my lack of experience with udev but I just want to confirm.
We moved away from PhotonVision because of poor reliability. We now do vision custom in C++ and Python. Idrk how PV indexes, im curious too, udev rules can be a PITA to even the most seasoned linux vets, and can be pretty randomly non-persistent across reboots depending on the hardware.
PV used some weird stuff when I looked into their code. Stuff that from my inspection udev couldn’t really change as far as I could tell. Again though, I’m not very good with udev so I may just not know how to do it.
What we do in WPILibPi is not use udev rules at all, and instead just provide a list of alternative camera paths (e.g. by-id or by-path) for each camera; the user can select one of those to use instead of /dev/videoN.