I have five USB cameras, same brand, same model (Canyon CNR-FWC120H). They are used to monitor different scenes 24/7. I need to somehow identify which camera is which from the Linux (Debian) console or programmatically (any language).
I’ve tried looking at the output of
lsusb -vvv, there is a field
iSerial which should be different for each camera but unfortunately this manufacturer decided not to bother and all cameras have the same serial at that place:
Is there any other way I could identify which camera is which independently of USB ports to which they are connected because unfortunately in my specific scenario I can not rely on the fact that the same camera will always be connected to the same port.
UPDATE After some discussion in the comments I realize this is mission impossible. So forget the last paragraph or if you do have some ingenious idea, please, you are welcome to present it. I’m now interested if I could identify which USB port the device is connected to; I use the built-in USB ports on the motherboard and additional PCI USB controller cards to accommodate the cameras with enough bandwidth. I would need to uniquely identify the port, and the port number/identification should not change if for example the machine reboots and for some reason the USB controllers get initialized in different order. Is that possible?
UPDATE 2 I see in my logs for one of the cameras the following info:
[Wed Apr 30 18:35:02 2014] uvcvideo: Found UVC 1.00 device FULL HD 1080P Webcam (0bda:58b0) [Wed Apr 30 18:35:02 2014] input: FULL HD 1080P Webcam as /devices/pci0000:00/0000:00:01.0/0000:01:00.0/usb3/3-2/3-2:1.0/input/input4
Using that, I’ve called this command:
udevadm info --query=all --path=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/usb3/3-2/3-2:1.0/input/input4
And got this:
P: /devices/pci0000:00/0000:00:01.0/0000:01:00.0/usb3/3-2/3-2:1.0/input/input4 E: DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/usb3/3-2/3-2:1.0/input/input4 E: EV=3 E: ID_BUS=usb E: ID_INPUT=1 E: ID_INPUT_KEY=1 E: ID_MODEL=FULL_HD_1080P_Webcam E: ID_MODEL_ENC=FULL\x20HD\x201080P\x20Webcam E: ID_MODEL_ID=58b0 E: ID_PATH=pci-0000:01:00.0-usb-0:2:1.0 E: ID_PATH_TAG=pci-0000_01_00_0-usb-0_2_1_0 E: ID_REVISION=5801 E: ID_SERIAL=Generic_FULL_HD_1080P_Webcam_200901010001 E: ID_SERIAL_SHORT=200901010001 E: ID_TYPE=video E: ID_USB_DRIVER=uvcvideo E: ID_USB_INTERFACES=:0e0100:0e0200:010100:010200: E: ID_USB_INTERFACE_NUM=00 E: ID_VENDOR=Generic E: ID_VENDOR_ENC=Generic E: ID_VENDOR_ID=0bda E: KEY=100000 0 0 0 E: MODALIAS=input:b0003v0BDAp58B0e5801-e0,1,kD4,ramlsfw E: NAME="FULL HD 1080P Webcam" E: PHYS="usb-0000:01:00.0-2/button" E: PRODUCT=3/bda/58b0/5801 E: PROP=0 E: SUBSYSTEM=input E: UDEV_LOG=3 E: USEC_INITIALIZED=41090223
The things that differ between the cameras are
PHYS and (most interesting)
USEC_INITIALIZED. Now the first four elements are probably related to the USB port, but the last one
USEC_INITIALIZED looks like some sort of serial number. I can’t find any info about what it actually represents. Does anyone know anything about it? I thought that it is maybe the time in micro seconds when the camera initialized but the camera that initialized after this one has
USEC_INITIALIZED=17919751, and then the one after that
USEC_INITIALIZED=25609278 so it seems rather random. I’ll try to reboot the system and see, but I need to wait for a convenient time to do that.
And if anyone is wondering why I don’t just try reconnecting a camera and see if that remains the same. The answer is that I’m operating this PC remotely, and I’m investigating all this to prepare the system to be fully autonomous for any potential event in the future. Which for example might include disconnecting the cameras from USB ports.