a570 100e needs this stub:
NHSTUB(add_ptp_handler, 0xffd9b9d8 ) // via ptp handler table 0xffda8f70
Couldn't quite figure out where I task creation should go so I just dropped it in platform/generic/main.c after SpyTask creation:
void CreateTask_init_chdk_ptp() {
_CreateTask("InitCHDKPTP", 0x19, 0x2000, init_chdk_ptp, 0);
};
static void task_start_hook(
long p0, long p1, long p2, long p3, long p4,
long p5, long p6, long p7, long p8, long p9)
{
_CreateTask("SpyTask", 0x19, 0x2000, spytask, 0);
task_prev(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 );
CreateTask_init_chdk_ptp();
}
hald in Ubuntu causes a little bit of trouble (first invocation if ptpcam always fails to connect but it works on the second attempt...I didn't try without hald yet):
./ptpcam --chdk
ERROR: Could not open session!
< > q
./ptpcam --chdk
<conn> upload ptp.o A/ptp.o
<conn> download A/ptp.o foo
<conn> q
diff foo ptp.o
It works!
./ptpcam --chdk
<conn> lua shut_down
<conn> q
ERROR: Could not close session!
So that Lua part works too (the camera did shut down).
All this was in PLAY mode, I didn't try tackling the REC mode stuff yet but DisableNotificationPTP() and PB2Rec() ought to do it since they have before but didn't have those in this first build. I did have reyalp's levent patches added, so I tried
lua set_levent_script_mode(1); post_levent("PressRecButton"); post_levent("UnpressRecButton"); set_levent_script_mode(0)
but that didn't have any effect. This is not surprising, because the REC switch actually shuts down the camera if USB cable is plugged in (even without CHDK).