What is the main problem? Can you explain, what will you do?
I don't have a workflow problem, however i'm still a little quizzical about a different matter (that I thought about while considering "get_alt_mode"). My original query [re: get_alt_mode()] is now no problem all.
Why not? You can start or stop a script only in ALT mode
Your comment prompted this quick investigation using multicam.lua - this a a trace of the test CLI I used:
__> !mc=require('multicam')
___> !mc:connect({list='C:/CHDKPTP/listfile'})
+ 1:Canon PowerShot SX150 IS b=\\.\libusb0-0001--0x04a9-0x3234 d=bus-0 s=9A95243
8E0A647E9AC0179DDC30582D5
___> !mc:start()
___> !return mc:cmdwait('test_alt')
test_alt
___> !return mc:cmdwait('enter_alt')
enter_alt
___> !return mc:cmdwait('test_alt')
test_alt
___> !return mc:cmdwait('exit_alt')
exit_alt
___> !return mc:cmdwait('test_alt')
test_alt
___> !mc:cmd('exit')
exit
___> !mc:start()
___> !return mc:cmdwait('test_alt')
test_alt
___> !mc:cmd('exit')
exit
___>
These are the extra cameraside multicam functions to enable that:
function cmds.enter_alt()
--e.g. to run !return mc:cmdwait('enter_alt')
enter_alt()
write_status(true)
function cmds.exit_alt()
--e.g. to run !return mc:cmdwait('exit_alt')
exit_alt()
write_status(true)
--testing only below
function cmds.test_alt()
--e.g. to run !return mc:cmdwait('test_alt')
local log_name = "A/get_alt_mode_log.csv"
logalt = io.open(log_name,"a")
local alt_value
local alt_boolean_test = get_alt_mode()
sleep(2000) --not sure if required
if alt_boolean_test then
alt_value_text = "true" else
alt_value_text = "false"
end
logalt:write(alt_value_text,"\n")
logalt:close()
write_status(true)
end
and this is the resulting content of "get_alt_mode_log.csv":
true
true
false
true
Since my last command, prior to exiting the script, was to exit_alt() [and that, correctly, tested as get_alt_mode "false"] i'm a bit unclear how, exactly, the chdkptp implementation of ptp.h:
PTP_CHDK_ExecuteScript, // data is script to be executed
// param2 is language of script
// in proto 2.6 and later, language is the lower byte, rest is used for PTP_CHDK_SCRIPT_FL* flags
// return param1 is script id, like a process id
// return param2 is status, PTP_CHDK_S_ERRTYPE*
gets the camera into alt mode so that the script data sent over to the camera can start execution?
Edit: if it is the chdkptp implementation of that which does put it into alt mode.