How do you get a USB webcam’s serial number from the Linux command line?
I have multiple USB webcams connected to an Ubuntu machine. They all show up as
/dev/video2, etc, but I can't seem to find any way to programmatically tell which is which. Several of the cameras are the same model, so just getting a model name isn't enough.
Note, I'm not asking how to use
lsusb. Yes, I know you can use
lsusb or libusb to get device serial number, product ID, manufacturer name, etc. But as far as I can tell, nothing shown by
lsusb can be cross-referenced with a
e.g. If someone plugs in two identical webcams and they show up as
/dev/video2 and then unplugs them and replugs them into completely different ports, so that
/dev/video4, I can immediately know that the current
/dev/video3 "used to be"
The only similar questions I've found only suggest hacks like unplugging and and replugging it while scanning dmesg. I'm looking for a pure-programmatic solution that requires no hardware manipulation to identify the webcams.