LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   udev rule for naming multiple webcams (http://www.linuxquestions.org/questions/linux-software-2/udev-rule-for-naming-multiple-webcams-4175426235/)

wikapuki 09-08-2012 07:50 AM

udev rule for naming multiple webcams
 
Debian Linux 2.6.32-5-486

I am trying to give persistant names for 2 cameras that are attached via usb but on each boot, they get assigned to /dev/video0 or /dev/video1

So udev seems to be the way but I have a massive headache now. TY minimal docu writers ;-)

Doing: find /dev -name usb*
Code:

/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0
/dev/v4l/by-id/usb-046d_08b2-video-index0
/dev/v4l/by-id/usb-046d_08cc_0E0390B3-video-index0
/dev/snd/by-id/usb-046d_08cc_0E0390B3-02
/dev/snd/by-id/usb-046d_08b2-01
/dev/.udev/db/usb:2-2
/dev/.udev/db/usb:5-2
/dev/.udev/db/usb:7-2
/dev/.udev/db/usb:7-1
/dev/.udev/db/usb:usb2
/dev/.udev/db/usb:usb4
/dev/.udev/db/usb:usb3
/dev/.udev/db/usb:usb1
/dev/.udev/db/usb:usb7
/dev/.udev/db/usb:usb8
/dev/.udev/db/usb:usb5
/dev/.udev/db/usb:usb6
/dev/bus/usb
/dev/input/by-id/usb-046d_08cc_0E0390B3-event-if00

and doing:lsusb
Code:

lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 007 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
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 002: ID 046d:08b2 Logitech, Inc. QuickCam Pro 4000
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 002: ID 046d:08cc Logitech, Inc. Mic (PTZ)
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

Goal: is to have '046d:08b2 Logitech, Inc. QuickCam Pro 4000' named 'cctv_north'
and '046d:08cc Logitech, Inc. Mic (PTZ)' named 'cctv_south'

In /etc/udev I created a file called: 50-udev.rules
which contained the following:

Code:

# MAW
#SUBSYSTEM=="devices", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05e1", ATTRS{idProduct}=="0408", SYMLINK+="cctv_carport"
#SUBSYSTEM=="devices", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08cc", SYMLINK+="cctv_south"
#SUBSYSTEM=="devices", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08b2", SYMLINK+="cctv_north"

SYSFS{idVendor}=="046d", SYSFS{idProduct}=="08cc", SYMLINK+="cctv_south"

Various attempts have all failed, after editing the file I always do a udev restart: sudo /etc/init.d/udev restart

then search for the newly named cams: find /dev -name cc*

but no luck.

tweezerhead 09-08-2012 11:58 AM

The udev rules in the example are commented out. Is this a typo?

wikapuki 09-08-2012 12:16 PM

Hi tweezerhead, No, they are my previous failures ;-) The last line I have got rid of now too. This is my current attempt:
Code:

SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08b2", SYMLINK+="cctv_north"
SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="08cc", SYMLINK+="cctv_south"

Just rebooting now, since this appears the only way a bafoon like myself can get it to re-do its self.

For some reason they appear to be pointing to one device even though you cann access each device seperately.

Code:

find /dev -name cctv*
/dev/cctv_north
/dev/cctv_south
/dev/.udev/links/cctv_north
/dev/.udev/links/cctv_south
jilldando:/home/worsdall#  find /dev -name vid*
/dev/video1
/dev/video0
/dev/.udev/tags/udev-acl/video4linux:video1
/dev/.udev/tags/udev-acl/video4linux:video0
/dev/.udev/db/video4linux:video1
/dev/.udev/db/video4linux:video0
jilldando:/home/worsdall#  find /dev -name usb*
/dev/v4l/by-id/usb-046d_08b2-video-index0
/dev/v4l/by-id/usb-046d_08cc_0E0390B3-video-index0
/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0
/dev/snd/by-id/usb-046d_08b2-01
/dev/snd/by-id/usb-046d_08cc_0E0390B3-02
/dev/.udev/db/usb:6-2
/dev/.udev/db/usb:6-1
/dev/.udev/db/usb:4-2
/dev/.udev/db/usb:2-2
/dev/.udev/db/usb:usb8
/dev/.udev/db/usb:usb2
/dev/.udev/db/usb:usb3
/dev/.udev/db/usb:usb1
/dev/.udev/db/usb:usb7
/dev/.udev/db/usb:usb4
/dev/.udev/db/usb:usb5
/dev/.udev/db/usb:usb6
/dev/bus/usb
/dev/input/by-id/usb-046d_08cc_0E0390B3-event-if00


wikapuki 09-09-2012 01:37 PM

It turns out everything is being assigned correctly by udev. It is the software guvcview that was NOT accepting /dev/cctv_north or /dev/cctv_south --device= parameter and was using its own USB vide4linux lostings of available cameras.

When I went back to old faithful (VLC) and told it what to stream, bingO all is fine.

Thanks (Now where is that mark solved button???)


All times are GMT -5. The time now is 09:27 AM.