Getting live view exposure (was Re: Improving CHDK ND filter support) - page 2 - General Discussion and Assistance - CHDK Forum

Getting live view exposure (was Re: Improving CHDK ND filter support)

  • 26 Replies
  • 27380 Views
*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #10 on: 18 / November / 2018, 22:29:59 »
Advertisements
Attached diff is for finding the mentioned fw variable (I named it imager_active, suggestions for a better name are welcome).
Thanks for doing this.  That seems like a reasonable name to me. Verified it on A540 (same address I found), and D10, SX160, ELPH130, ELPH180 (tested playback, rec, screen off sleep mode in rec)

Edit: Also checked S2IS and A410 by disassembly, look correct.

Quote
vx and dryos, t2 version is still to be done. I only checked some of the results, but the others also look reasonable.
Same variable causing different trouble here: https://chdk.setepontos.com/index.php?topic=11078.msg136913#msg136913
Seems like a useful thing to have. I'll look into a t2 match.

Apologies for the slow response, RL has been keeping me busy. I should have a bit more time now.
« Last Edit: 18 / November / 2018, 22:45:21 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #11 on: 20 / November / 2018, 02:41:26 »
Here's patch for imager_active on thumb2. This match is more complicated than I like but it seems to work.

A few notes
* The "Fail ImagerActivate(ErrorCode:%x)" string is referenced twice. The match uses the first one. The second one is similar but would end up with a different function for ImagerActivate
* M10 has an assert in the function found via "Fail ImagerActivate" (fc12821a in 110d) that doesn't seem to be present in any of the other firmwares. It still looks like the correct function, but it would be good to verify
* I made the callback a separate match just because it makes it easier to dump the disassembly for verification
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #12 on: 20 / November / 2018, 16:55:06 »
* The "Fail ImagerActivate(ErrorCode:%x)" string is referenced twice. The match uses the first one. The second one is similar but would end up with a different function for ImagerActivate
I put a note about that in source (I'm not sure why the string is the same for both functions - perhaps a copy&paste error that they never fixed).
Quote
* M10 has an assert in the function found via "Fail ImagerActivate" (fc12821a in 110d) that doesn't seem to be present in any of the other firmwares. It still looks like the correct function, but it would be good to verify
The variable seems to behave as expected (I tested it), and the place it's found also looks ok.
Quote
* I made the callback a separate match just because it makes it easier to dump the disassembly for verification
I'll look into adding that. Probably worth it if we're about to use this variable.

What's interesting is that going into the rec menu does not touch imager_active, even though liveview stops while in menu.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #13 on: 20 / November / 2018, 21:22:21 »
I put a note about that in source (I'm not sure why the string is the same for both functions - perhaps a copy&paste error that they never fixed).
The other function ends up calling the same callback too, though the code is different enough that the t2 match wouldn't work.
Quote
Quote
* I made the callback a separate match just because it makes it easier to dump the disassembly for verification
I'll look into adding that. Probably worth it if we're about to use this variable.
FWIW, I wasn't asking for this to be added to the other sig finders, though I certainly have no objection if you want to.

I check t2 matches with a shell script that disassembles the function for each camera model, and then visually verify they look similar. This works OK with the 17 models I have dumps for, but is pretty overwhelming with the number of older cams.
Quote
What's interesting is that going into the rec menu does not touch imager_active, even though liveview stops while in menu.
It doesn't close the shutter, which the other sensor off modes seem to (on non-EOS cams at least)
I wonder menu just stops updating the live view frame buffer, rather than actually turning the sensor off?

edit:
As far as using this variable, I think it makes sense for the get_current_tv function, and maybe for other stuff like the MF issue. Exposing it in script could also be good, so scripts can detect when the camera has gone to "sleep"
« Last Edit: 20 / November / 2018, 21:25:22 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #14 on: 23 / November / 2018, 21:29:02 »
Here's a patch that adds get_current_tv96 and includes the imager_active stuff.

get_imager_active is exposed to script and returns a boolean.
shooting_get_current_tv96 returns 0 if imager_active is true. It should maybe return a special value (PHOTO_PARAM_TV_NONE in, nil in Lua?) instead. GetCurrentShutterSpeed returns -576 (64s) on newer cameras, -129 (~2.54s) on a540 (before crashing).
The check could be ifdef'd for just the cameras that need it if we figured out what those are, but using it all the seems OK to me if it's in the sigfinder.

I verified a540 does not crash if GetCurrentShutterSpeed is called with the shoot menu open. Both a540 and elph180 seem to just return the last valid value.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #15 on: 24 / November / 2018, 23:50:16 »
An observation: GetCurrentAvValue does not appear to reflect Av override values in half press. e.g
Code: [Select]
=av=get_max_av96() set_av96_direct(av) press'shoot_half' repeat sleep(10) until hook_preshoot.count() > 0 return av,get_current_av96(), get_av96()
9:return:672
9:return:352
9:return:672
The override value returned when the shot is taken:
Code: [Select]
=av=get_max_av96() set_av96_direct(av) press'shoot_half' repeat sleep(10) until hook_preshoot.count() > 0 press'shoot_full' repeat sleep(10) until hook_shoot.count() > 0 return av,get_current_av96(), get_av96()
10:return:672
10:return:672
10:return:672
This DOF calculator uses GetCurrentAvValue, so it probably doesn't work correctly with overrides.
Don't forget what the H stands for.

*

Offline srsa_4c

  • ******
  • 4451
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #16 on: 26 / November / 2018, 19:16:27 »
FWIW, I wasn't asking for this to be added to the other sig finders, though I certainly have no objection if you want to.
I'm now not so sure it makes much sense - the function has to pass several checks to be accepted and it looks quite boring when disassembled (doesn't reference anything known other than the variable).
Adding the following two lines before
gotit = 1;
in the patch makes the function appear in the csv files.
Code: [Select]
void add_func_name(char*, uint32_t, char*);
 add_func_name("imager_active_callback", a, "");
Quote
I check t2 matches with a shell script that disassembles the function for each camera model, and then visually verify they look similar.
I also have a script but it predates capdis and haven't updated it. I usually do step through the resulting mass-disassembly if the function to be added is important (i.e. used in CHDK).
Quote
It doesn't close the shutter, which the other sensor off modes seem to (on non-EOS cams at least)
I wonder menu just stops updating the live view frame buffer, rather than actually turning the sensor off?
The silent picture experiment is related (the sensor doesn't turn off but there seems to be no readout).

Quote
edit:
As far as using this variable, I think it makes sense for the get_current_tv function, and maybe for other stuff like the MF issue. Exposing it in script could also be good, so scripts can detect when the camera has gone to "sleep"
As for other stuff, I seem to recall camera crashes when mode change was attempted with cam asleep. I don't know if this is a general issue or just a few models.

Can't comment on shooting_get_current_tv96.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #17 on: 03 / December / 2018, 00:52:30 »
FWIW, I wasn't asking for this to be added to the other sig finders, though I certainly have no objection if you want to.
I'm now not so sure it makes much sense - the function has to pass several checks to be accepted and it looks quite boring when disassembled (doesn't reference anything known other than the variable).
That makes sense to me. I'm inclined to check in the current patches. I verified that the stubs are found on all firmwares. I haven't checked every camera, but the ones did look at all seemed reasonable.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #18 on: 09 / December / 2018, 22:55:14 »
I checked this in (r5137-5138) with the minor change that get_current_tv96 returns -10000  in C and nil in Lua when imager_active is not set.

-10000 is also used as the invalid indicator for shooting_get_tv96_from_shutter_speed, and is now defined as SHOOTING_TV96_INVALID.
Don't forget what the H stands for.

*

Offline Ant

  • *****
  • 509
Re: Getting live view exposure (was Re: Improving CHDK ND filter support)
« Reply #19 on: 28 / December / 2018, 16:24:50 »
On EOS M3 the "ShowCurrentExp_FW" function prints  the Gain value in the range -96...480.
Does anybody found the way to change this gain? This could be usefull for FRSP.

My camera has many Gains: CMOS, CDS, DFE, Degeen. Some of them can be set and have affect. But I don't know how to calculate them from desired ISO.
 

 

Related Topics


SimplePortal © 2008-2014, SimplePortal