Answer the question
In order to leave comments, you need to log in
How to set a specific dev for each of two identical webcams in Linux?
There are two cheap cameras. So cheap that the output
of udevadm info -a -n /dev/video0
and
udevadm info -a -n /dev/video1 is identical
. There is no difference in vid, pid, SN, etc.
But you need to be sure that after a reboot, video1 and video0 will not change places.
The implementation was planned through the rules in /etc/udev/rules.d
With the replacement of the standard dev with video0 for say cam0.
Here are different lines, but I think that they cannot be hooked on.
looking at device '/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.3/2-6.3:1.0/video4linux/video0' :
KERNEL=="video0"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.3/2-6.3:1.0':
KERNELS=="2-6.3:1.0"
looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6.3':
KERNELS=="2-6.3"
ATTRS{devpath}=="6.3"
ATTRS{devnum}=="9"
Answer the question
In order to leave comments, you need to log in
I had a similar task: a bunch of tokens, sometimes with the same vid and pid, are placed on usb ports, including through a usb hub. OS Linux Debian 8.
It is impossible to uniquely identify the token, since there is no unique serial number. But the serial number is present for each usb root hub built into the motherboard. This means that you can hard-code its busnum for each root hub, and if you do not pull out tokens, then their devnum will be constant.
I pulled out all the tokens and, using lsusb, found out that I have 8 usb root hubs, each occupies device number 1:
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[email protected]:~# udevadm info -a /dev/bus/usb/005/001 | grep serial
ATTR{serial}=="0000:00:1a.2"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1a.7", ATTR{busnum}="1"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1d.7", ATTR{busnum}="2"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1a.0", ATTR{busnum}="3"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1a.1", ATTR{busnum}="4"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1a.2", ATTR{busnum}="5"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1d.0", ATTR{busnum}="6"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1d.1", ATTR{busnum}="7"
SUBSYSTEM=="usb", ATTR{devnum}=="1", ATTR{serial}=="0000:00:1d.2", ATTR{busnum}="8"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question