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

Mode dials and Playback pushbuttons

  • 201 Replies
  • 92135 Views
Re: Mode dials and Playback pushbuttons
« Reply #30 on: 07 / March / 2009, 08:07:31 »
Advertisements
With so many cameras to support (and get reliable information from testers), this is all a bit 'messy'.

On the A570, movie and playback works with the PostLogicalStatus.. method.
On the A710, PLS works for movie, I have used my existing switch-override for playback.
On the ixus75, which has a playback button, PLS works for switching to playback.
I used switch-override for movie.

On the S5IS, that has a movie button, a tester reported that a method based on simply 'pressing' the movie button did not work  ... I am not sure I believe that   ;)

It is not elegant but I will use a mix of switch-override and PLS in SDM for now.

Users will have to report which cameras it does not work on.


David
« Last Edit: 07 / March / 2009, 08:10:20 by Microfunguy »

*

Offline fbonomi

  • ****
  • 469
  • A570IS SD1100/Ixus80
    • Francesco Bonomi
Re: Mode dials and Playback pushbuttons
« Reply #31 on: 10 / May / 2009, 01:53:56 »
Do I understand correctly, that the dialmode support hasn't yet made it into the trunk?

I need both dialmode support and Lua scripting because I would like to work on the scripts that I used for my balloon fly in order to make something of more portable...

For that flight, I had my own non-standard version for the Ixus80, her I would like to expand this to a larger number of cameras!



Re: Mode dials and Playback pushbuttons
« Reply #32 on: 10 / May / 2009, 12:20:35 »
I need both dialmode support and Lua scripting


For the record, SDM has dial-mode support (playback and movie) for most cameras.

In a private build, I have added the Lua files and can get it to compile.

I cannot yet get Lua scripts to run, something about calling a global function .....

The memory required by Lua is so great that I will probably not pursue this.


David

*

Offline zeno

  • *****
  • 891
Re: Mode dials and Playback pushbuttons
« Reply #33 on: 10 / May / 2009, 12:44:41 »
Do I understand correctly, that the dialmode support hasn't yet made it into the trunk?
I used to maintain dial-mode support for a small set of cameras (a560, A570,A720 and G9 see http://www.zenoshrdlu.com/kapstuff/zchdk.html) and put a diff file in the CHDK bugtracker back in December 2008. It's languished there ever since (see http://chdk.kernreaktor.org/mantis/view.php?id=118).

When David Sykes (Microfunguy) offered to do a much better job adding the support to SDM I happily said yes - having to continually make the same set of mods every time a significant update to CHDK appeared was getting tiresome.
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

*

Offline reyalp

  • ******
  • 14128
Re: Mode dials and Playback pushbuttons
« Reply #34 on: 22 / October / 2009, 19:09:55 »
Some more investigation of PostLogicalEvent*

First, the second argument to the functions is not the 0-3 that shows up in the table. Going by the log format string
Quote
LogicalEvent:0x%04x:adr:%p,Para:%ld
It appears to be an optional pointer. I wasn't able to find any call where anything other than 0 was definitively passed.

Second, has anyone worked out the difference between PostLogicalEventForNotPowerType and PostLogicalEventToUI. More specifically, is there any instance known where one works and the other doesn't ?

The only difference I can see (looking at the a540 code, but even much newer cams seem very similar) is that PostLogicalEventToUI looks up the (0-3) value from the table, where PostLogicalEventForNotPowerType always passes 2

There is also PostEventShootSeqToUI which appears functionally identical to PostLogicalEventToUI

I'm going to add one of these to lua (and ubaisc I guess), since it is easy to find and adds some control that is otherwise unavailable. I'd like to add only one, unless there is a specific reason to use others. In lua, we can easily allow the use of the names rather than numbers.

From my experimenting on the A540, it lets you set play or rec mode, but not override the mode dial. I'm still trying to figure out the cleanest way to deal with getting mode overrides on all the different cameras.

edit:
PostEventShootSeqToUI is not identical to PostLogicalEventToUI on some cameras, e.g. sd990

edit:
Although many of the numbers are consistent between cameras, not all of them are. Good reason to use names.

edit:
quite a few events have empty names (pointer to a null char, not a null ptr). Not clear what these doe.
« Last Edit: 22 / October / 2009, 19:31:55 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14128
Re: Mode dials and Playback pushbuttons
« Reply #35 on: 22 / October / 2009, 20:01:10 »
Another tack on the mode dial problem, I've made a lua script that allows one to easily capture the physwstatus values for mode dial and switch positions.

Note that this is for cameras that have a physical, multiposition dial and a two position switch for play and record. It'll probably also work with cameras that have a PLAY button and a mode dial or multiposition switch that isn't a dial.

If mode is set by a switch (rather than a dial that can rotate 360 degrees) you must start with it at one end, and when prompted move it through each position and then back to the original.

Here's how it works:
Unzip the files from swtest.zip into the CHDK/SCRIPTS directory on your SD card
Turn on the camera in play mode, select the script and run it.
It will ask you to switch to record.
Once you are in record mode, it will ask you to move the mode dial, pausing each time it is changed, and then prompting you to move it again. Once you get back to the original mode, it will ask you to switch back to play.
The script will end when you switch back to play. This will leave a file in the root of your SD card called swtest.csv which contains the values of physw_status, the CHDK mode value, and the canon shooting mode propcase.

Included in the zip is caminfo.lua. This is a lua module which contains all the addresses from stubs_min.S, for each camera. Someone may find this useful for something else. The shell script used to generate it also attached. Note that it is quite hacky and needs a modified version of stubs_asm.h (included in the zip) in the right place.
Don't forget what the H stands for.

*

Offline ewavr

  • ****
  • 1057
  • A710IS
Re: Mode dials and Playback pushbuttons
« Reply #36 on: 22 / October / 2009, 21:19:53 »
Unzip the files from swtest.zip into the CHDK/SCRIPTS directory on your SD card
Turn on the camera in play mode, select the script and run it.

Can't run, 'propcase' module required.

*

Offline reyalp

  • ******
  • 14128
Re: Mode dials and Playback pushbuttons
« Reply #37 on: 22 / October / 2009, 22:01:59 »
Can't run, 'propcase' module required.
This should be included in the full CHDK zip in the autobuilds. Attached a copy here, unzip in CHDK

But I think may have found a better way to handle mode dial, more in a bit.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14128
Re: Mode dials and Playback pushbuttons
« Reply #38 on: 22 / October / 2009, 23:37:08 »
Progress. In a540, I noticed eventprocs (set up in UI_RegistDebugEventProc)
UIFS_SetDialStillRec etc. What they do is call a function (sub_FFD563F8 which I am calling SetLogicalEventActive based on similar code in SD990) which looks like
SetLogicalEventActive (int event_ID, bool active)

active is 1 for the desired mode, and 0 for all the other DialMode* events. At the end, UIFS_SetDialStillRec then posts
PressRecButton
UnpressRecButton
ModeDialToM

Nifty. So I add SetLogicalEventActive to lua, and try reproducing the same steps. Still doesn't work, the new mode pops up briefly, then resets.

But there's another interesting eventproc there: SetScriptMode
All this does is set a variable to it's argument, and other code makes it obvious this is a bool. So, I made another lua script to poke that variable, and when it is set to one, dial mode set like the UIFS functions now work.

If no events are disabled with SetLogicalEventActive, the mode dial seems to work normally after SetScriptMode(1). If they are disabled, changing the dial mode has a similar effect to posting the event before: the mode appears to change momentarily, and then goes back to whatever it was locked on.

I'll post a patch and scripts in a bit.

One other thing I've noticed. Almost all of this can be done with canon event procedures. If we could execute event procedures by name, it would save finding a lot of addresses in a lot of cameras. Adding this ability to lua would be especially handy. So has anyone figure out the event procedure system ? It's been on my list to look at for a while, but I haven't got around to it yet.

Edit:
I guess for many eventprocs, we can find them just by looking for name,pointer in the ROM.
« Last Edit: 22 / October / 2009, 23:39:10 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14128
Re: Mode dials and Playback pushbuttons
« Reply #39 on: 23 / October / 2009, 00:23:01 »
I'll be reworking things a bit, but if anyone wants to try this out on other cameras, here's what I have so far.

To use any other camera than a540, you'll have to find PostLogicalEventToUI, PostLogicalEventForNotPowerType (you can probably just use one, but I haven't tested extensively), the table of logical events, and the address used in the SetScriptMode function.

Included in the zip:
source patch
dmpevent.lua - dumps the event table to a csv file, A/logevent.csv
dmevent - allows you override dial mode. You'll may have to update the dailevents table with the values for your camera, obtained dmpevent.lua You'll also need the right address for the scriptmode variable.
evnt.lua - allows you call either of the post* functions with arbitrary values
scrpmode.lua - just pokes the scriptmode address

edit:
erm, did I really not attach the zip ? lets try again!

I'd appreciate hearing if this method does or does not work on other cameras.
« Last Edit: 23 / October / 2009, 02:40:44 by reyalp »
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal