QuickCam Team Forums

Full Version: Can't get/set "Exposure, Auto Priority" with uvcdynctrl
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I played around with the uvcctrl and I have the problem that I can't set 'Exposure, Auto Priority'.

Debugging it, I saw that controls.c:get_control_id() you look up the ID of the control.

Now, the problem is 'Exposure, Auto Priority' has Control-ID 0.

In main.c line 600++ you do a "if(!controlId)" which gets true with control-id 0.

Would it be ok, if you default id in get_control_id to '-1' and then check the returned control-id to be <0 in the if statement.

Thanks
Philipp
here is a patch, of what I mean:

Code:
--- libwebcam-0.1.1_orig/Apps/uvcdynctrl/controls.c     2008-01-29 08:18:18.000000000 +0100
+++ libwebcam-0.1.1/Apps/uvcdynctrl/controls.c  2008-03-16 22:10:01.000000000 +0100
@@ -72,7 +72,7 @@
CControlId
get_control_id (CHandle handle, const char *name)
{
-       CControlId id = 0;
+       CControlId id = -1;
        CResult res;
        unsigned int count = 0;
        CControl *controls = NULL;
diff -ur libwebcam-0.1.1_orig/Apps/uvcdynctrl/main.c libwebcam-0.1.1/Apps/uvcdynctrl/main.c
--- libwebcam-0.1.1_orig/Apps/uvcdynctrl/main.c 2008-01-29 08:18:18.000000000 +0100
+++ libwebcam-0.1.1/Apps/uvcdynctrl/main.c      2008-03-16 22:06:47.000000000 +0100
@@ -597,7 +597,7 @@
                
                // Resolve the control Id
                CControlId controlId = get_control_id(handle, args_info.get_arg);
-               if(!controlId) {
+               if(controlId < 0) {
                        print_handle_error(handle, "Unknown control specified", -1);
                        goto done;
                }
@@ -625,7 +625,7 @@

                // Resolve the control Id
                CControlId controlId = get_control_id(handle, args_info.set_arg);
-               if(!controlId) {
+               if(controlId<0) {
                        print_handle_error(handle, "Unknown control specified", -1);
                        goto done;
                }


With this change, I can get and set Exposure, Auto Priority with uvcdynctrl.
Philipp

I also noticed that the new "Exposure, Auto Priority" control is broken with libwebcam 0.1.1 and I am working on a fix in the SVN repository (check out this announcement).

mrubli Wrote:
I also noticed that the new "Exposure, Auto Priority" control is broken with libwebcam 0.1.1 and I am working on a fix in the SVN repository (check out this announcement).


Thanks. I just tested the svn co and I was able to set 'Exposure, Auto Priority' now without hassle.

I'll check the other setting parameters later.

pkolmann Wrote:

mrubli Wrote:
I also noticed that the new "Exposure, Auto Priority" control is broken with libwebcam 0.1.1 and I am working on a fix in the SVN repository (check out this announcement).


Thanks. I just tested the svn co and I was able to set 'Exposure, Auto Priority' now without hassle.


I don't know, what I tested back then....

I can't get it to work still.

Code:
philipp@chief:~/test/deb/libwebcam/build$ ./Apps/uvcdynctrl/uvcdynctrl -d video1 -g 'Exposure, Auto Priority'
[libwebcam] Unknown V4L2 control ID encountered: 10094851
[libwebcam] Unknown custom V4L2 control ID encountered: 134217728 (V4L2_CID_PRIVATE_BASE + 0)
controlId: 0
ERROR: Unknown control specified.


I added a

Code:
printf("controlId: %d\n", controlId);

to get the value of controlId. It's still 0 (with uvc rev 198 and libwebcam r20).

Thanks
Philipp

PS: With my previous patch, I can set this control again, without an issue.

Stupid question, but are you sure that the driver loaded is actually revision 198? I've seen similar issues until it turned out that the distribution's old UVC driver had taken over.

Also, can you please post the output of "uvcdynctrl -cv"?

mrubli Wrote:
Stupid question, but are you sure that the driver loaded is actually revision 198? I've seen similar issues until it turned out that the distribution's old UVC driver had taken over.

Also, can you please post the output of "uvcdynctrl -cv"?


Just repcompiled everything. UVC is now on 198. There is no other uvc module in my tree. I only have the svn co:

Code:
pkolmann@pkvoip:~/test/libwebcam/build$ /sbin/modinfo uvcvideo
filename:       /lib/modules/2.6.24-1-686/misc/uvcvideo.ko
version:        SVN r198

Mar 27 07:16:21 pkvoip kernel: uvcvideo: Found UVC 1.00 device <unnamed> (046d:0990)
Mar 27 07:16:21 pkvoip kernel: input: UVC Camera (046d:0990) as /class/input/input3
Mar 27 07:16:21 pkvoip kernel: usbcore: registered new interface driver uvcvideo
Mar 27 07:16:21 pkvoip kernel: USB Video Class driver (SVN r198)


I still get id 0 for EAP:

Code:
pkolmann@pkvoip:~/test/libwebcam/build$ ./Apps/uvcdynctrl/uvcdynctrl -cv
[libwebcam] Unknown V4L2 control ID encountered: 10094851
Listing available controls for device video0:
  Exposure, Auto Priority
    ID      : 0x00000000,
    Type    : Boolean,
    Flags   : { CAN_READ, CAN_WRITE },
    Values  : [ 1 .. 10000, step size: 1 ],
    Default : 166
  Exposure (Absolute)
    ID      : 0x00000011,
    Type    : Dword,
    Flags   : { CAN_READ, CAN_WRITE },
    Values  : [ 1 .. 10000, step size: 1 ],
    Default : 166
  Exposure, Auto
    ID      : 0x0000000f,
    Type    : Choice,
    Flags   : { CAN_READ, CAN_WRITE },
    Values  : { 'Manual Mode'[0], 'Auto Mode'[1], 'Shutter Priority Mode'[2], 'Aperture Priority Mode'[3] },
    Default : 3
[...]


Thanks
Philipp

Reference URL's