Hi Ben, On Saturday 23 April 2011 00:13:27 Ben Mesander wrote: > Hi, > > I'm porting an application which uses the uvc video driver for a logitech > webcam from Ubuntu 8.04 LTS to Ubuntu 10.04 LTS. > > In the 8.04 release, there was some mismatch in the UVC driver from the > V4L2 driver for a few of the ioctl values. The V4L2 headers had: > > #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) > #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) > #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) > > But the uvcvideo driver expected: > > #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_PRIVATE_BASE+10) > #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_PRIVATE_BASE + 11) > #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_PRIVATE_BASE+14) > > I found these values in the private header files that came with the > luvcview software, and similar defines in the logitech libwebcam source, > which also had a comment "Old uvcvideo pre-r178 control IDs" > See > here: > http://svn.quickcamteam.net/svn/qct/webcam-tools/trunk/libwebcam/compat.h > > My desired camera behavior is to allow the camera to control aperture as > necessary to handle lighting conditions, but my application must run at a > fixed frame rate (30fps, set elsewhere), so it must not change the frame > rate. By experimenting & reading sources mentioned above, I finally found > that if I did: > > request.id = (V4L2_CID_PRIVATE_BASE+10); > request.value = 8; > if (ioctl(fd, VIDIOC_S_CTRL, &request) < 0) { > ... > } > > request.id = (V4L2_CID_PRIVATE_BASE+14); > request.value = 0; > if (ioctl(fd, VIDIOC_S_CTRL, &request) < 0 { > ... > } > > I achieved the desired effect. Note that 8 is not defined in > v4l2_exposure_auto_type, but I'm not the only person who's used it, > see http://forums.quickcamteam.net/showthread.php?tid=1227 for an example > of where it seems to mean aperture priority. > > OK, fine, but under Ubuntu 10.04, the ioctls above return EINVAL. So I > figured it was time to use the correct request values in the requests. So > I tried: > > request.id = V4L2_CID_EXPOSURE_AUTO; > request.value = V4L2_EXPOSURE_APERTURE_PRIORITY; > if (ioctl(fd, VIDIOC_S_CTRL, &request) < 0) { > ... I end up here with "Input / Output Error" errno ... > } > > request.id = V4L2_CID_EXPOSURE_AUTO_PRIORITY; > request.value = 0; > if (ioctl(fd, VIDIOC_S_CTRL, &request) < 0 { > ... > }
The interface changed over time as it was getting standardized. You should now use the V4L2_CID_EXPOSURE_AUTO and V4L2_CID_EXPOSURE_AUTO_PRIORITY ioctls as defined in videodev2.h, so your code is correct. > No luck - initially I thought it worked, but after trying in a darkened > room and bright sunlight and rebooting to clear out the current values in > the driver, I see that it is no longer adapting to the lighting > conditions, although it does seem to be correctly pinned to the framerate > I set. Also, the > V4L2_CID_EXPOSURE_AUTO ioctl() always returns "I/O error" - I have tried > various values for the request.value - 0, 1, 3, 8, etc. without any > success. > > I see other people have reported similar issues in the past, but I see no > resolution, for > example: > http://lists.berlios.de/pipermail/linux-uvc-devel/2008-March/003251.html - > for example in that thread this is mentioned: > enum v4l2_exposure_auto_type { > V4L2_EXPOSURE_MANUAL = 0, > V4L2_EXPOSURE_AUTO = 1, > V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, > V4L2_EXPOSURE_APERTURE_PRIORITY = 3 > }; > But in my V4L2 headers, MANUAL = 1, and AUTO = 0. The uvcvideo driver had a bug until 2.6.27 that caused the manual and auto values to be inverted. Ubuntu 10.04 ships a 2.6.32 kernel, so the bug shouldn't be present there. > I also tried the VIDIOC_S_EXT_CTRLS flavor of setting the exposure values, > but no luck - same I/O error. VIDIOC_S_EXT_CTRLS lets you set several controls in an atomic way, it won't help here if the device returns an error. > Any idea on how I can set V4L2_CID_EXPOSURE_AUTO on uvcvideo driver in > Ubuntu 10.04 LTS without getting an Input/Output error? Have you tried setting the control with a command line application such as v4l2-ctl, yavta or uvcdynctrl ? If you don't get an error with them there might be an issue with your code. Otherwise we will need to look somewhere else. What Logitech webcam are you using ? -- Regards, Laurent Pinchart _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel