Hi Alessandro,

On Wednesday 10 December 2008, Alessandro Soro wrote:
> Dear All,
>
> I'm trying without success to get the serial number of a webcam Logitech
> Quickcam Pro 9000.
> after initialization, the field bus_info in the capability struct, got
> via ioctl, is set to something like "0000:05:06.2", that seems to be related
> to the usb bus as also appears in the proc fs, but not to the port, so I
> can't distinguish different webcams connected to the same controller
>
> the serial number of the webcam is reported in /proc/usb/devices
>
> T:  Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
> D:  Ver= 2.00 Cls=ef(unk. ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
> P:  Vendor=046d ProdID=0990 Rev= 0.05
> S:  SerialNumber=F88F63E8
>
> but unfortunately I can't find any way to map this info to the
> /dev/video# entry that I use
> to open the device.
>
> I need this for a computer vision app that uses 9 webcams connected to
> three different controllers, so I need the serial to match each webcam to
> the appropriate configuration file.
> Whenever the system is halted the /dev/video# entries are reassigned
> (randomly, it seems) to the webcams and the matching to config files is
> lost. 
>
> Any ideas?
>
> If not, a way to fix the assignment of /dev/video# entries to a usb
> bus/port would also do the trick for me.

The order in which the /dev/videoX nodes are created depends on the 
enumeration order on USB. This probably varies between reboots, hence your 
problems.

First of all, please note that not all cameras have a serial number, and 
serial numbers are not always unique. Logitech cameras behave nicely here so 
it won't be an issue for your application, but beware of this if you decided 
to switch to other cameras.

The serial number is available through sysfs:

$ cat /sys/bus/usb/devices/5-1/serial
C2D14EDB

You can control how device nodes are created through udev rules. I'm no udev 
expert, but copying your video device rule with an additional

ATTRS{serial}=="xxxxxxxx"

option should let you give persistant names to the device nodes.

Best regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to