Wikia

CHDK Wiki

LogicalEvent

Talk0
565pages on
this wiki
Revision as of 07:27, January 20, 2012 by Fe50 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting a page to document these. this is an early, incomplete draft please update with your observations. This forum thread contains related discussion and test code http://chdk.setepontos.com/index.php/topic,3228.0.html

Logical events (correct terminology is unclear) are a component of the Canon firmware used to communicate events such as button presses, switch position changes etc to the rest of the firmware.

Event related functionsEdit

Known useful functionsEdit

The following functions are at least partially understood and known to be useful

  • PostLogicalEventToUI(int id,int unk)
  • PostEventShootSeqToUI(int id, int unk)
  • PostLogicalEventForNotPowerType(int id, int unk)

All 3 of these functions "post" an event, causing the camera to act as the actual button press had taken place. The meaning of the second parameter is unknown, but is normally zero. Based on strings, it appears that it would be a pointer. The difference between the functions is unclear. On some cameras, the first two are identical.

  • SetLogicalEventActive(int id, int state)
  • SetScriptMode(int state)

Other functions of interestEdit

  • ShowLogicalEventName

There may be (probably are) functions that allow you to listen for events. This could be very useful! A function to determine if a given event was valid, without causing a crash or assert would also be useful.

Event tableEdit

Each camera contains a table in the format

const char *name, int event_number, int value

Some events have an empty name. This is a pointer to a zero length string, not a null pointer.

The event_number values are not entirely consistent between cameras

Not every event in a cameras table is valid for that camera. E.g. ModeDialToSport on a camera without a sport position on the dial.

The first event number in the table appears to always be 0x800, and the last two appear to be 0 and 0xFFFFFFFF respectively.

CHDK uses for logical eventsEdit

Events can be use to do almost anything that can be done with the camera buttons and switches: shut down the camera cleanly, change between play and record mode, change recording settings, simulate button presses etc. They can also be used to simulate events such as plugging in the external video cable.

Lua APIEdit

There is now a Lua API to access the event functions and table.

Advertisement | Your ad here

Around Wikia's network

Random Wiki