Followup of this post:
http://chdk.setepontos.com/index.php?topic=10114.10#msg120143I have finally found the buffer that seems to hold the custom white balance data. Both live view and stills use it. Changes to its content are immediately visible on live view and stills when WB is set to custom on the Canon UI.
The buffer contains all related data, cameras with 2 custom WB settings have a double size buffer.
The very same kind of data is saved in flash ROM when the user takes a WB-shot with the Canon controls.
Changes to the buffer are not saved, so manipulating its content should be relatively safe.
Simple test, camera dependent (I'm using uncached RAM that is shadowed by the instruction TCM and therefore never used).
First execution backs up current WB data, subsequent executions overwrite the WB buffer with the backed up data.
-- Camera: a3200 only
uncached=0x40000000 -- CAM_UNCACHED_BIT from stubs_entry.S, also used as location of the persistent flag
backup=uncached+0x10 -- location for WB data backup copy
magic=0x11121314 -- magic value, not likely occuring in uninitialized RAM
buf=0x557b0 -- custom wb runtime buffer
lngth=0x40 -- custom wb data length
what=peek(uncached)
if what ~= magic then
if call_event_proc("System.Create") == -1 then
error("System.Create failed")
end
call_event_proc("memcpy",backup,buf,lngth) -- back up custom WB prop
poke(uncached,magic) -- set flag
else
call_event_proc("memcpy",buf,backup,lngth) -- replace custom wb data with backed-up copy
end
Now, the question is:
How should we use this?
I'm thinking about providing a facility that allows saving and restoring the buffer. The data should be tagged to prevent loading on incompatible cameras.
Suggestions are welcome. It would also be nice to know how it works on other models.
Attachment: an svn diff that contains the buffer address and length for almost all DryOS cameras (exception: S5IS) and most VxWorks cameras (except the earliest few models).
example, a3200:
// WB property, details correct: ID=2, length=64, buffer @ 0x557b0edit:
updated attachment