Checked this in,
changeset 944Both lua and ubasic accept reboot by itself or with a file name. On lua, it will return false on failure (file not found, out of memory etc). It doesn't return a value on ubasic, but the fact the script is still running indicates failure.
This feature should be considered experimental. It appears to work on d10 and a540, so it will probably work on a range of vxworks and dryos cams.
example lua script:
--[[
@title reboot
@param a use file
@default a 0
--]]
if a == 0 then
reboot()
end
reboot("A/MAIN.BIN")
and ubasic
@title reboot
@param a use file
@default a 0
if a=0 then reboot else reboot "A/MAIN.BIN"
Description
shut down the display and reboot the camera.
bootfile is the name of the file to boot.
Must be an unencoded ARM binary, will be loaded at 0x1900
For cameras which use encoded diskboot, loader/<camera>/main.bin may be used
For cameras which do not use encoded diskboot, DISKBOOT.BIN may be used
No sanity checking is performed on the binary, except that the size is >= 4 bytes
If bootfile is NULL, camera firmware is rebooted. DISKBOOT.BIN will be loaded or not according to normal rules
returns 0 on failure, does not return on success
does NOT save camera settings to flash
does NOT retract lens before rebooting
calling from playback mode is recommended
Regarding retracting the lens, the event proc StoreLensForShutDown may be of interest. I haven't tried it. If not retracted when you call reboot, the freshly booted OS will (probably) retract the lens, and then re-extend it if in rec mode.
I haven't checked whether Restart syncs files to disk, but it is a good idea to close any files you had open before rebooting.
If diskboot is present, rebooting with a file is slightly faster, since it boots CHDK directly instead of booting the canon OS and then rebooting again for CHDK.
The Restart function is not identified really well by sigs. I've tried to verify, but with so many cameras, errors are likely
The following cameras were matched 100%. I have not not checked most of them against dumps
a430 a480 a610 a620 a650 a700 a720 g9 ixus100 ixus55 ixus60 ixus65 ixus750 ixus800 ixus80 ixus85 ixus860 ixus90 ixus95 ixus960 ixus970 s90 ixusizoom s3is sx100 sx200
The following were manually verified (some were also 100%). If one sub was correct, I haven't checked the others
a450 a460 a470 a530 a540 a550 a560 a570 a590 a630 a640 a710 d10 ixus70 ixus75 ixus850 ixus950 tx1
The following were corrected in stubs_entry_2.s
a2000 g11 g7 ixus40 ixus50 ixus700 ixus870 ixus980 s2is s5is sx10 sx110 sx1 sx20
The function is pretty easy to find. On older cameras (vxworks and early dryos) just look for "Restart Called". On newer cameras look for the constant 0x12345678 and then look around for cp15 code. It is also usually very close to the function detected by finsig.