QuickCam Team Forums

Full Version: udev , coldplugging and libwebcam
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello all

I am having problems with coldplugging and my Logitech sphere webcam.
i.e : booting with the webcam plugged into the computer .
(hotplugging is working fine ) .
I also have 2 other video devices in the computer : a pci terratec dvb-t card and a bttv tv card . when booting the computer all the video drivers get loaded correctly , but the rule 80-uvcdynctrl.rules (which should load the additionnal v4l 2properties to the uvc camera (pan/tilt etc ) , is not always triggered , (not on every boot ) , if it is triggered , most of the time it fails (not finding VID or PID of the device in the /sys filesystem) , or the uvcdynctrl -i command gets applied but on the wrong v4l device (so it fails ). this varies a lot , sometime (1 out of 30 ) it even succeeds ...

when the machine has finished booting , passing manually the command "udevtrigger" will correct things (the pb is that its manual ..)

my distrib is mandriva 2007 , udev version is 106 .


to me the pb seems :
a) timing related
b) due to the fact that there are several v4l devices on my system.
c) the v4l device number (video0 , video1 etc ) seem to move around a bit
during the boot process . (as seen from /tmp/uvcdynctrl-udev.log )

I don't think it is due to libwebcam , maybe to the way udev works at boot or the initialisation steps of uvcvideo driver ?

i am not so familiar with udev , I was wondering if any of you , has been
experimenting those problems with cold plugging and found a not too ugly fix .

thanks for any idea .


here is an extract of /tmp/uvcdynctrl-udev.log
(notice how video2 gets turned into video0 ...?)

==============================================================================
Triggered at Thu Mar 27 22:07:12 UTC 2008

ACTION=add
BASH=/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="/lib/udev/uvcdynctrl")
BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="2" [4]="release" [5]="i586-mandriva
-linux-gnu")
BASH_VERSION='3.1.17(2)-release'
DEVLINKS='/dev/sonix_cam_0 /dev/video4'
DEVNAME=/dev/v4l/video4
DEVPATH=/class/video4linux/video4
DIRSTACK=()
EUID=0
GROUPS=()
HOSTNAME=venus.localwarp.net
HOSTTYPE=i586
IFS='
'
MACHTYPE=i586-mandriva-linux-gnu
MAJOR=81
MINOR=4
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
PHYSDEVBUS=usb
PHYSDEVDRIVER=usb
PHYSDEVPATH=/devices/pci0000:00/0000:00:10.0/usb1/1-1
PIPESTATUS=([0]="0")
POSIXLY_CORRECT=y
PPID=4784
PS4='+ '
PWD=/
SEQNUM=1865
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-commentsTongueosix
SHLVL=1
SUBSYSTEM=video4linux
TERM=dumb
UDEVD_EVENT=1
UDEV_LOG=3
UID=0
_='Triggered at Thu Mar 27 22:07:12 UTC 2008\n'
logfile=/tmp/uvcdynctrl-udev.log
uvcdynctrlpath=uvcdynctrl
xmlpath=/etc/udev/data

VID of new device: '0c45'
PID of new device: '602c'
VID of new device: ''
PID of new device: ''
ERROR: Unable to extract USB VID from '/sys/devices/pci0000:00/0000:00:0a.0/../i
dVendor'.
VID of new device: ''
PID of new device: ''
ERROR: Unable to extract USB VID from '/sys/devices/pci0000:00/0000:00:09.0/../i
dVendor'.
VID of new device: '046d'
PID of new device: '0994'
VID of new device: '0c45'
PID of new device: '602c'
ERROR: Device is not handled by uvcvideo but by 'usb'.
Note: There is a known problem for older versions of the UVC driver where the ph
ysical device path reported by udev ('/sys/devices/pci0000:00/0000:00:10.2/usb3/
3-2' in this case) points to the USB device instead of the USB interface. For th
ese versions of the UVC driver dynamic controls are not supported anyway. Please
update your uvcvideo driver to the latest version if you know that this device
is a UVC device.
ERROR: Device is not handled by uvcvideo but by 'usb'.
Note: There is a known problem for older versions of the UVC driver where the ph
ysical device path reported by udev ('/sys/devices/pci0000:00/0000:00:10.0/usb1/
1-1' in this case) points to the USB device instead of the USB interface. For th
ese versions of the UVC driver dynamic controls are not supported anyway. Please
update your uvcvideo driver to the latest version if you know that this device
is a UVC device.
Found vendor XML file: /etc/udev/data/046d/logitech.xml
Executing command: 'uvcdynctrl -d /dev/v4l/video2 -i /etc/udev/data/046d/logitec
h.xml'
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIV
ATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIV
ATE_BASE + 0)
[libwebcam] Warning: The driver behind device video3 does not seem to support V4
L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4
L2.
[libwebcam] Warning: The driver behind device video3 does not seem to support V4
L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4
L2.
[libwebcam] Warning: The driver behind device video3 does not seem to support V4
L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4
L2.
Importing dynamic controls from file /etc/udev/data/046d/logitech.xml.
/etc/udev/data/046d/logitech.xml: info: device 'video1' skipped because it is no
t a UVC device.
/etc/udev/data/046d/logitech.xml: info: device 'video0' skipped because it is no
t a UVC device.
==============================================================================



after boot a few commands will correct the pb :
[root@venus tmp]# uvcdynctrl -l
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
Listing available devices:
video2 Terratec Cinergy HT PCI
video1 BT848 video (MIRO PCTV)
video0 UVC Camera (046d:0994)
[root@venus tmp]# uvcdynctrl -d video0 -c
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
Listing available controls for device video0:
Exposure, Auto Priority
White Balance Temperature
White Balance Temperature, Auto
Exposure (Absolute)
Exposure, Auto
Sharpness
Power Line Frequency
Backlight Compensation
Gain
Saturation
Contrast
Brightness

[root@venus tmp]# udevtrigger --retry-failed --verbose
/class/sound/controlC0
/class/video4linux/vbi0
/class/video4linux/vbi1
/class/video4linux/video0
/class/video4linux/video1
/class/video4linux/video2
/devices/pci0000:00/0000:00:10.3/usb4/4-1/4-1:1.0
/devices/pci0000:00/0000:00:10.3/usb4/4-1/4-1:1.1
/devices/pci0000:00/0000:00:10.4/usb5/5-3/5-3:1.1
/devices/pci0000:00/0000:00:10.4/usb5/5-3/5-3:1.2
/devices/pci0000:00/0000:00:10.4/usb5/5-3/5-3:1.3
[root@venus tmp]# uvcdynctrl -d video0 -c
[libwebcam] Unknown V4L2 control ID encountered: 10094852
[libwebcam] Unknown V4L2 control ID encountered: 10094853
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
Listing available controls for device video0:
Raw bits per pixel
Disable video processing
LED1 Frequency
LED1 Mode
Focus
Pan/tilt Reset
Exposure, Auto Priority
White Balance Temperature
White Balance Temperature, Auto
Exposure (Absolute)
Exposure, Auto
Sharpness
Power Line Frequency
Backlight Compensation
Tilt Reset
Pan Reset
Tilt (relative)
Pan (relative)
Gain
Saturation
Contrast
Brightness
It's very hard to judge what's going wrong here. The fact that the device names change even during udev seems a little weird. And the log file is not a big help because it seems to suffer from synchronization issues. Could you maybe change the log file name in the uvcdynctrl udev script, so that it becomes unique for each call?

In line 9, changing

Code:
logfile=/tmp/uvcdynctrl-udev.log

to

Code:
logfile=/tmp/uvcdynctrl-udev-$SEQNUM.log

should do the trick.

Once that works, could you post the resulting log files as attachments? That way, our form software won't feel compelled to convert list separators into smileys. ;-)

hello

first sorry for the previous messy post .

I think my coldplugging problem is due to some timing issues or may be the way mandriva 2007 handle udev . Anyway i tried coldplugging on and old pentium II with ubuntu feisty , and several other webcams and coldplugging works perfect

So i sorted the problem on the atlhlon + mandriva 2007 with a script in
/etc/rc3.d/S96udev_trigger that contains :
udevtrigger --retry_failed
udevsettle

---------
this script runs late in the boot process , and redoes initialisations that
udev has missed earlier .
not so elegant , but the coldplugging problem is sorted out ....
It's not a solution but it's at least a workaround that gets the job done. :-) If you have time to do the separate log files anyway, please let us know the results.

We're aware of the fact that udev support is still experimental and untested on different distributions, so I'm very grateful for these bug reports. Thanks!
I removed my script (the one that does udevtrigger -retry-failed) from /etc/rc3.d and did the mod you mentioned to get separate log files , then cleaned /tmp from old log files . then i did a reboot .
I got only one log file in /tmp after (attached (1057) ) .

i should have seven log files i think as my machine has 5 video devices at the moment :
bttv
dvb-t
gspca webcam 1
gspca webcam 2
uvc webcam
plus 2 vbi devices in the tv cards

here is the result of uvcdynctrl -l after the reboot :
[root@venus tmp]# uvcdynctrl -l
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Warning: The driver behind device video3 does not seem to support V4L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4L2.
Listing available devices:
[libwebcam] Warning: The driver behind device video3 does not seem to support V4L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4L2.
[libwebcam] Warning: The driver behind device video3 does not seem to support V4L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4L2.
video2 UVC Camera (046d:0994)
video1 Terratec Cinergy HT PCI
video0 BT848 video (MIRO PCTV)


and

root@venus tmp]# uvcdynctrl -d video2 -c
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
[libwebcam] Warning: The driver behind device video3 does not seem to support V4L2.
[libwebcam] Warning: The driver behind device video4 does not seem to support V4L2.
Listing available controls for device video2:
Exposure, Auto Priority
White Balance Temperature
White Balance Temperature, Auto
Exposure (Absolute)
Exposure, Auto
Sharpness
Power Line Frequency
Backlight Compensation
Gain
Saturation
Contrast
Brightness

obviously , the custom controls did not get loaded .

-------------------------------------------------------
i then cleaned the old log file (1057) from /tmp
and tried a reboot with my new script /etc/rc3.d/S98udevtrigger back in place .
this time i get 8 log files ! [root@venus tmp]# ls -l /tmp/uvc*
-rw-r--r-- 1 root root 1261 Apr 1 00:37 /tmp/uvcdynctrl-udev-1053.log
-rw-r--r-- 1 root root 1245 Apr 1 00:38 /tmp/uvcdynctrl-udev-1197.log
-rw-r--r-- 1 root root 1243 Apr 1 00:38 /tmp/uvcdynctrl-udev-1198.log
-rw-r--r-- 1 root root 1251 Apr 1 00:38 /tmp/uvcdynctrl-udev-1199.log
-rw-r--r-- 1 root root 1247 Apr 1 00:38 /tmp/uvcdynctrl-udev-1200.log
-rw-r--r-- 1 root root 2368 Apr 1 00:38 /tmp/uvcdynctrl-udev-1201.log
-rw-r--r-- 1 root root 1645 Apr 1 00:38 /tmp/uvcdynctrl-udev-1202.log
-rw-r--r-- 1 root root 1645 Apr 1 00:38 /tmp/uvcdynctrl-udev-1203.log

the first one is generated by the mandriva original udev script /etc/rc3.d/S10udev at 00:37 (this script should have generated 7 log files
(one for each device that has "video" as "SUBSYSTEM". (3 web cams 2 tv card and 2 vbi devices = 7 )
it only catches the last webcam (video4 that happens to be a gspca)

(much) later on in the boot process (at 00:38) my "kludge script "/etc/rc3.d/S98uvctrigger runs and and triggers properly 80-uvcdynctrl.rules , for every devices that has video as "SUBSYSTEM"
i.e:
/dev/video0
/dev/video1
/dev/video2
/dev/video3
/dev/video4
/dev/vbi0
/dev/vbi1

in this case the custom control for the uvc device get properly added .
i attach the logs for this reboot as well.
Reference URL's