I think I've found something.
The original reporter of this bug was Gerhard34:
link to post in CHDK-DE forum (german)Running a certain script via ptp resulted in strange behaviour.
I could reproduce the problem as written in
this post.
Since then I tried that script (with some -DE specific parts removed) with our stable version.
I've simplified the lua script to the following (I guess only the first line is needed):
set_record(1)
sleep(3000)
set_record(0)
When executed via ptp (on a recently switched-on camera), it acts like this:
A410, A430: camera switches to record mode, then immediately starts to zoom in (!)
Ixus65: camera switches to record mode, everything's normal
On one of the (earlier) test runs, the A410 crashed (the reason is probably unrelated). The earliest parts of the romlog look like this:
00064280: DispSwCon_TurnOnDisplayDevice
00064280: TerminateDeliverToZoomController
00064280: DSI_DisplayShootInfo( 0x20 )
00064280: STARTUP_OPTICAL_ZOOM_MAX_POSITION
00064290: PRESS_TELE_BUTTON
00064290: LogicalEvent:0x313d:adr:0x0,Para:0
00064290: _EntryStartRecMode
00064290: CaptModeChanger_CheckRTCRrepared
00064290: DispSwCon_MuteOffPhysicalScreen
00064290: MuteOffPhysicalScreen
00064290: _DecideModeDial
with at least the PRESS_TELE_BUTTON being suspicious.
I remembered to an svn commit by philmoz:
http://chdk.setepontos.com/index.php?topic=7045.msg75340#msg75340In platform/generic/kbd.c (the A410 port uses this one) I changed this part:
static long kbd_new_state[3];
static long kbd_prev_state[3];
static long kbd_mod_state;
into
static long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
static long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
static long kbd_mod_state = 0xFFFFFFFF;
With the above changes, the A410 stopped exhibiting that weird behaviour, no more zooming in after set_record(1).
The kbd.c code of the Ixus65 has kbd_mod_state initialized, and it never showed this problem.
May I ask a developer who knows the keyboard, ptp, scripting code, to look into this?I suspect that some or all of those kbd_ variables need to be initialized, in every port...
update:
http://chdk.wikia.com/wiki/Lua/PTP_Scriptingthe above mentioned set_record() should not be used via ptp
Thx waterwingz, at least I was not completely wrong.
update2: No, I wasn't wrong, for VxWorks cameras, switch_mode_usb() is the same as set_record().