[cpia] CPiA colour balance problem [patch]

rich@annexia.org rich@annexia.org
Mon, 6 Mar 2000 21:48:02 +0000


On Sun, Mar 05, 2000 at 11:19:51PM +0100, Peter Pregler wrote:
> No idea, but please try the following. There are exactly two points in cpia.c
> that control if the _comp-values are actually written to the camera. If you
> switch that off the compensation is only controlled by firmware. So we should
> be able to determine if this is a firmware-problem or some driver stuff. The
> lines in question are:
> 
> - in reset_camera_struct set cam->params.exposure.compMode = 0;
> - in set_camera_state change the first do_command_extened from
> 
>         do_command_extended(cam, CPIA_COMMAND_SetExposure
>                             cam->params.exposure.gainMode, 1, 1,
> to
>         do_command_extended(cam, CPIA_COMMAND_SetExposure
>                             cam->params.exposure.gainMode, 1, 0,
> 
> After that the exposure compensations for the color channels are not changed
> anymore by the driver (unless I missed something ;). 

Erm, that fixes it, indeed :-) I've attached an `official' patch,
so that other people can try it out too, in particular David Cougle
who had a similar problem with the 1.20 firmware version.

I'm going to take a deeper look at this problem.

Rich.

PS. egrep '_comp' /proc/cpia/video0 with the patch gives much
more believable results ...

red_comp:                    220       220       255       220
green1_comp:                 214       214       255       214
green2_comp:                 214       214       255       214
blue_comp:                   230       230       255       230

----------------------------------------------------------------------
--- cpia.c~     Sun Mar  5 14:54:55 2000
+++ cpia.c      Mon Mar  6 21:45:21 2000
@@ -2356,7 +2356,7 @@
 
 
        do_command_extended(cam, CPIA_COMMAND_SetExposure,
-                           cam->params.exposure.gainMode, 1, 1,
+                           cam->params.exposure.gainMode, 1, 0, // RWMJ
                            cam->params.exposure.centreWeight,
                            cam->params.exposure.gain,
                            cam->params.exposure.fineExp,
@@ -3099,7 +3099,7 @@
        cam->params.colourParams.saturation = 50;
        cam->params.exposure.gainMode = 2;
        cam->params.exposure.expMode = 2;               /* AEC */
-       cam->params.exposure.compMode = 1;
+       cam->params.exposure.compMode = 0; // RWMJ
        cam->params.exposure.centreWeight = 1;
        cam->params.exposure.gain = 0;
        cam->params.exposure.fineExp = 0;


-- 
rich@annexia.org | Is your school part of http://www.schoolmaster.net ?
BiblioTech Ltd, Unit 2 Piper Centre, 50 Carnwath Road, London, SW6 3EG.
+44 20 7384 6917 | Click here to play XRacer: http://xracer.annexia.org
Copyright © 2000 Richard Jones | GnuPG/PGP key from www.annexia.org