Mode dials and Playback pushbuttons - page 9 - General Discussion and Assistance - CHDK Forum

Mode dials and Playback pushbuttons

  • 201 Replies
  • 84247 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Mode dials and Playback pushbuttons
« Reply #80 on: 31 / October / 2009, 09:49:11 »
Advertisements
Btw, playrec_mode+0x8 in a570 seems to be
0 in play mode
1 in rec mode (including menu, but not in stitch or movie modes)
2 in movie mode rec
4 in stitch mode rec
It doesn't seem to be confused by mode switches from events.
I haven't tried recreview, would've required more than just looking at the memory browser.

*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #81 on: 03 / November / 2009, 22:08:50 »
Getting ready to check the first part of this pig in (a couple minutes to check some addresses * 80+ firmware variants . :'()

New script functions:
lua and ubasic:
set_record(state)
if state is 0 (or false) the camera is set to play mode. If 1 or true, the camera is set to record mode.
notes:
 * in ubasic, get_mode returns 0 for record, 1 for play and 2 for movie. If you want to restore the original mode, you must modify the value accordingly
 * get_mode() in C or script may return incorrect values after forcing the mode on some cameras, mostly those with a physical play/rec switch. This will be corrected in future versions

lua only (this is essentially unchanged from the earlier patch):
name,id,param = get_levent_def(event)
event is an event id (number) or name (string)
returns nil if event is not found

index=get_levent_index(event)
event is an event id (number) or name (string)
returns index or nil if not found

name,id,param = get_levent_def_by_index(event_index)
event_index is number index into the event table
returns nil if event is not found

post_levent_to_ui(event[,unk])
post_levent_for_npt(event[,unk])
post the event with PostLogicalEventToUI or PostLogicaEventForNotPowerType
This sends the event. The difference between functions isn't clear.
event is an event id (number) or name (string).
unk is an optional number whose meaning is unknown, defaults to zero.
Based on code, other values would probably be a pointer.
This is NOT the 3rd item in the event table.

set_levent_active(event,state)
event is an event id (number) or name (string)
state is a numeric or boolean state. true or non zero numbers turn on zero, false or nil turn off
exact meaning is unknown, but it has something to do with the delivery of the specified event.

set_levent_script_mode(state)
state is numeric or boolean state. true or non zero numbers turn on zero, false or nil turn off
exact meaning is unknown, but it has something to do with the behavior of events and/or SetLogicalEventActive.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #82 on: 03 / November / 2009, 22:16:54 »
changeset 826
First part of mode override support. See http://chdk.kernreaktor.org/mantis/view.php?id=64
+ support for posting logical events, and other event fuctions in lua
+ script support for setting mode to play or rec. Note, get_mode will currently return incorrect values on many cameras if the mode is set this way, which will affect both script and some CHDK functions. This will be addressed in a future version. should be fixed for almost all cameras as of Changeset 835.
+ logical event related entry point SetLogicalEventActive for all cameras except ixus40_sd300
+ logical event related entry points SetScriptMode, PostLogicalEventForNotPowerType, PostLogicalEventToUI for all cameras
+ entry SetCurrentCaptureModeType for all cameras except ixus40_sd300 ixus50_sd400 (might be right, unsure). This will be used to support capture mode overrides in a future version, not currently exposed available in Changeset 836.
+ playrec_mode variable for all cameras except ixus40_sd300 ixus50_sd400. This will allow mode_get in future version to return the right result on cameras that depended on the physw_status bits of the mod/rec hardware switch
+ to tools:
 * generic dump access code dumputil.c, dumputil.h
 * find_levent.c finds and optionally dumps levent table
 * find_eventproc.c very dumb/simple search for name/pointer pairs, useful for eventprocs that are too small for finsig
 These are not added to "make all" in tools, because they are not needed in the normal build process. Use the executable name or "make extras" in tools.

Except as noted above, all the entry points and addresses have been verified with at least a superficial check

New firmware function descriptions:
See comments in lowlevel.h
See: http://chdk.setepontos.com/index.php/topic,3228.msg42218.html#msg42218 for more detail on SetLogicalEventActive and SetScriptMode

New firmware variable descriptions:
levent_table: see description in levent.h
playrec_mode: see description in lowlevel.h

New script functions: see comments in core/luascript.c or http://chdk.setepontos.com/index.php/topic,3228.msg42842.html#msg42842
« Last Edit: 12 / November / 2009, 00:02:56 by reyalp »
Don't forget what the H stands for.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Mode dials and Playback pushbuttons
« Reply #83 on: 08 / November / 2009, 16:25:45 »
Quote
unk is an optional number whose meaning is unknown, defaults to zero.
For "RotateJogDialLeft" (...Right") events this number means rotation angle (clicks count).

BTW, something like list of all available capture modes (useful for SetCaptureModeType) can be found in dumps, starting point of search is "PTM_Init" string ("PTM_Initialize" for very old cameras).
for example:
s2is 1.00e at 0xFF983778
ixus700 1.01a at 0xFF967C0C
a710 1.00a at 0xFFD711A8
sx10 1.01a at 0xFFB74388
sx200 1.00c at 0xFFB6D0A4
for very old cameras this is list of DWORDs, for more modern - list of WORDs.


*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #84 on: 11 / November / 2009, 02:22:27 »
Thanks ewavr, that's useful information. What does "RotateJogDialLeft" do on jogdial cameras if the parameter is 0 ?

I've checked in changeset 835 which uses the playrec_mode variable on almost all cameras that previously used something else. mode_get is now almost entirely generic. I've left (commented for the moment) the original mode getting code, so we may be able to detect if the switch position is overridden on those cameras that have a switch (but not all the physw_status checks necessarily looked at the switch).

The cameras I didn't update are:
ixus40_sd300, ixus50_sd400, ixus700_sd500 and a560
the ixus are all old cameras that seem to be a bit different in this area. I think I've found the corresponding variable, but I'm not sure it behaves the same way. s2is is also similar to these, and has playrec_mode, but treats 1 as record and any other value as play. If someone has any of these cameras and would be willing to help test, please let me know.

a560 uses playrec_mode, but treats 1 or 2 as record and all other values as play. Again, testers would be appreciated.

This checkin means that CHDK on all other cameras should operate correctly with play/record overridden. I think I've got it right, but this is a lot of cameras, so please report any problems!

Next step will be SetCurrentCaptureMode support.

edit:
I tested on my camera, and it appears that playrec_mode becomes 1 briefly when switching from play to rec. Attached small script that records when a variable changes.
« Last Edit: 11 / November / 2009, 02:36:52 by reyalp »
Don't forget what the H stands for.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Mode dials and Playback pushbuttons
« Reply #85 on: 11 / November / 2009, 03:13:34 »
What does "RotateJogDialLeft" do on jogdial cameras if the parameter is 0 ?
SX10 does nothing.

For IXUS700(SD500) playrec_mode variable (0x5378 for 1.01a) is equal 0 or 2 in playback mode, 1 in record mode.
Your script also detecs "3" value, but maybe this is short-term change, I cannot see it in memory browser.

*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #86 on: 11 / November / 2009, 20:26:50 »
For IXUS700(SD500) playrec_mode variable (0x5378 for 1.01a) is equal 0 or 2 in playback mode, 1 in record mode.
Can you check with in canon menu open in record and play mode ? For the script to see it, you'd have to switch to alt mode with the menu open, since it doesn't run in the background (background could be a nice feature for some scripts).
Quote
Your script also detecs "3" value, but maybe this is short-term change, I cannot see it in memory browser.
This is how 1 is in newer cams, the display is blanked when the value is set. First number in script is timestamp, so:
Code: [Select]
     9890 00000000 <- start script in play after power up
    12830 00000001 <- move switch to rec
    14150 00000002
    19310 00000004 <- open menu, press alt
    26530 00000002 <- close menu, go back to alt
    31270 00000003 <- move switch play

a560 is probably like all newer cameras, but if someone has one and can confirm that would be nice.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #87 on: 11 / November / 2009, 23:48:19 »
In changeset 836 I've turned on SetCurrentCaptureModeType support.

This is exposed in lua as
set_capture_mode(modenumber)
modenumber is a PROPCASE_SHOOTING_MODE value. The function accepts either the correct value (as found in the cameras mode map or propcase viewer, or an the incorrectly sign extended value retrieved by get_prop.

I assume it only works if the camera is already in record mode. I haven't tested, and there is no sanity checking in the code.

ixus40_sd300 is not supported: SetCurrentCaptureModeType is nullsub because it was not found. It's possible that PTM_SetCurrentCaptureMode is an alternative.

ixus50_sd400, ixus700_sd500, s2is have poor matches for SetCurrentCaptureModeType. This may or may not work.

This is lua only for now, ubasic support will be added when I decide on the proper interface.

I'm looking for feedback on what the script interface should be. I see several alternatives, which may be used alone or in combination:
1) use PROPCASE_SHOOTING_MODE values.
 Pro: Easy to implement, you can get the current mode and go back to it. Could sanity check values in cameras CHDK modemap or ROM tables mentioned by ewavr
 Con: Values are camera dependent. Currently no sanity checking.

2) use CHDK mode values.
 Pro: Camera independent.
 Con: Can't go directly from propcase to mode (but you could add a function to translate). Modemaps on some cameras are incomplete or incorrect.

3) separate functions for the most common modes, e.g. set_capture_m, set_capture_p, set_capture_video
 Pro: simplest for inexperienced scripters, camera independent (but you have to deal with cameras that don't have M etc)
 Con: lots of functions, limited flexibility.

4) named values, e.g. set_capture_mode("M") or set_capture_mode(modes.M)
 Pro: easy to understand, platform independent. Could be implemented as a standard lua library combined 2)
 Con: not easy in ubasic, external lib needs to be kept in sync with core.

Whatever method is chosen should offer a to detect if a given mode is valid, without trying to set it. For 1) or 2) this could be is_capture_mode_valid(x) ?

If something other than propcase values is used, there should be a way to get the current mode in that system.
Don't forget what the H stands for.


*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Mode dials and Playback pushbuttons
« Reply #88 on: 12 / November / 2009, 04:25:08 »
Can you check with in canon menu open in record and play mode ?
The same, 1 in record mode, 0 or 2 in playback mode.

ixus50_sd400, ixus700_sd500, s2is have poor matches for SetCurrentCaptureModeType. This may or may not work.

For IXUS700 it works.

*

Offline reyalp

  • ******
  • 14082
Re: Mode dials and Playback pushbuttons
« Reply #89 on: 13 / November / 2009, 03:18:43 »
In changeset 838 i've updated ixus50_sd400 and ixus700_sd500 to use the playrec_mode values described above.

Also found the variable in ixus40_sd300, but not used it yet.

Changed a560 to use the normal later camera playrec_mode check, as the code appears identical.

Quote
ixus50_sd400, ixus700_sd500, s2is have poor matches for SetCurrentCaptureModeType. This may or may not work.
For IXUS700 it works.
Then it should also work on ixus50 and s2is. ixus40_sd300 is still not found.

This means that all cameras except ixus40 should have play/record override and capture mode override, and logical events working correctly.
Don't forget what the H stands for.

 

Related Topics