JoJo jojo schrieb:
describing the problem you faced helps ;-)-JoJo On Mon, Dec 8, 2008 at 1:58 AM, GWater <[EMAIL PROTECTED]> wrote:New ToDo: I talked to the v4l2ucp maintainer(Scott bertin) because auto exposure didn'T show up in v4l2ucp. I made a patch which worked but solved the problem rather unelegantly. He however knew how to do it right. Unfortunatly that didn't work and auto expousre is still missing again. But this time the problem is not in his code but in ours. If we want to use V4L2_CID_EXPOSURE_AUTO and other CIDs from the V4L2_CAMERA_CLASS then we need to implement V4L2 enxtended controls. Actually I wanted to do that myself this weekend but some other stuff came up. So if anyone feels bored - get this task done ;) . If I got some concept wrong again - I couldn't even read up on all this. Maybe it's much easier to solve than I thought. GWater--~--~---------~--~----~------------~-------~--~----~ Lets make microdia webcams plug'n play, (currently plug'n pray) To post to this group, send email to [email protected] Visit us online https://groups.google.com/group/microdia -~----------~----~----~----~------~----~------~--~---
OK,currently V4L2ucp does not query for controls in the new v4l2 camera class. One of them is auto exposure.
I fixed the problem as described in v4l2ucp-kernel-2.6.25.patch . It's not very elegant but works. Scott Bertin suggested another method in v4l2ucp-extcontrols.patch . However that did not work and I suspect it is because I implemented V4L2_CID_EXPOSURE_AUTO incorrectly.
GWater
--- old/v4l2ucp-1.2/mainWindow.cpp 2006-03-05 03:13:18.000000000 +0100
+++ new/v4l2ucp-1.2/mainWindow.cpp 2008-12-02 23:05:48.000000000 +0100
@@ -164,6 +164,15 @@
}
}
+ /* Check all the camera controls */
+ for(int i=V4L2_CID_CAMERA_CLASS_BASE; i<V4L2_CID_CAMERA_CLASS_BASE+13;
i++) {
+ struct v4l2_queryctrl ctrl;
+ ctrl.id = i;
+ if(ioctl(fd, VIDIOC_QUERYCTRL, &ctrl) == 0) {
+ mw->add_control(ctrl, fd, grid);
+ }
+ }
+
/* Check any custom controls */
for(int i=V4L2_CID_PRIVATE_BASE; ; i++) {
struct v4l2_queryctrl ctrl;
Index: mainWindow.cpp
===================================================================
RCS file: /cvsroot/v4l2ucp/v4l2ucp/mainWindow.cpp,v
retrieving revision 1.8
diff -u -r1.8 mainWindow.cpp
--- mainWindow.cpp 5 Mar 2006 06:06:06 -0000 1.8
+++ mainWindow.cpp 4 Dec 2008 02:44:07 -0000
@@ -155,24 +155,37 @@
new QLabel(grid);
new QLabel(grid);
- /* Check all the standard controls */
- for(int i=V4L2_CID_BASE; i<V4L2_CID_LASTP1; i++) {
- struct v4l2_queryctrl ctrl;
- ctrl.id = i;
- if(ioctl(fd, VIDIOC_QUERYCTRL, &ctrl) == 0) {
- mw->add_control(ctrl, fd, grid);
- }
- }
- /* Check any custom controls */
- for(int i=V4L2_CID_PRIVATE_BASE; ; i++) {
- struct v4l2_queryctrl ctrl;
- ctrl.id = i;
- if(ioctl(fd, VIDIOC_QUERYCTRL, &ctrl) == 0) {
- mw->add_control(ctrl, fd, grid);
- } else {
- break;
- }
+ struct v4l2_queryctrl ctrl;
+#ifdef V4L2_CTRL_FLAG_NEXT_CTRL
+ /* Try the extended control API first */
+ ctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
+ if(0 == ioctl (fd, VIDIOC_QUERYCTRL, &ctrl)) {
+ do {
+ mw->add_control(ctrl, fd, grid);
+ ctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
+ } while(0 == ioctl (fd, VIDIOC_QUERYCTRL, &ctrl));
+ } else
+#endif
+ {
+ /* Fall back on the standard API */
+ /* Check all the standard controls */
+ for(int i=V4L2_CID_BASE; i<V4L2_CID_LASTP1; i++) {
+ ctrl.id = i;
+ if(ioctl(fd, VIDIOC_QUERYCTRL, &ctrl) == 0) {
+ mw->add_control(ctrl, fd, grid);
+ }
+ }
+
+ /* Check any custom controls */
+ for(int i=V4L2_CID_PRIVATE_BASE; ; i++) {
+ ctrl.id = i;
+ if(ioctl(fd, VIDIOC_QUERYCTRL, &ctrl) == 0) {
+ mw->add_control(ctrl, fd, grid);
+ } else {
+ break;
+ }
+ }
}
mw->setCentralWidget(sv);
signature.asc
Description: OpenPGP digital signature
