What about a user selectable option to allow 'potentially unsafe' IO operations to continue?If the option is enabled, then instead of failing when TakeSemaphore times out we just revert to the old functionality and call the underlying firmware function without the semaphore protection.There would be minimal risk of triggering the FsIoNotify function since the firmware is already inside an IO loop (for the video recording), it should not be opening and closing other files.This would only apply for open/close/write/opendir/closedir, doing it in fopen would trigger a lockup.I had a quick play with this and it seems to work - the main difference to the 1.2 functionality is that things are slower (due to the 1/2 second timeout in TakeSemaphore). 1/2 second is probably too conservative , I tried it at 200ms and it still seems to work.
Danger of having it too short is it would timeout in the startup fstuff or during jpeg saving and you'd get the FsIoNotify crash. I don't have a good feeling for what a "safe" time would be. I guess it would be possible to record how long is spent waiting for the semaphore.
Unfortunately saving Canon RAW or CHDK RAW/DNG also blocks the semaphore - up to 1.3 seconds on my G12.
I have only done little testing (without changing platform_camera.h) on one of my cameras - the movie recording lock-up is obviously gone. Since several file operations are affected, how should "real" testing look like? Could it be scripted somehow? I guess one ingredient would be a card with only a small free space left (to reliably stop the test movie recording)...The v5 patch has a copy&paste bug in unsafe_io_warning().
I could perhaps add the file access semaphore init function to the sigfinder's list and use a script (I do have such a script) to mass-disassemble its content for visual inspection.
While experimenting with scripts in movie mode I've noticed that the following scenario doesn't work:- start cam- load script- start movie recording- run script (will not start, module loading error instead)... because the interpreter (Lua) will only be loaded when the script is actually started. I'm not sure if this is considered to be a problem.
With the latest patch, setting the 'allow unsafe IO' flag should let the module load:- if the camera has a working 'is_video_recording' function, - and CAM_IS_VID_REC_WORKS is defined.
Quote from: philmoz on 24 / November / 2014, 16:51:32With the latest patch, setting the 'allow unsafe IO' flag should let the module load:- if the camera has a working 'is_video_recording' function, - and CAM_IS_VID_REC_WORKS is defined.Confirmed working on the sx100 (DryOS r23) and s80 (Vx). No lockups on these cameras with or without 'CAM_IS_VID_REC_WORKS', with or without 'allow unsafe IO' (tested while recording video). Except for, of course, event procedures that try to write to files. Scripts fail to open files while recording.edit:Same result on a460 (late Vx).
Started by scroaticle General Discussion and Assistance
Started by emutier Script Writing
Started by muchachotron General Help and Assistance on using CHDK stable releases
Started by flarn2006 General Discussion and Assistance
Started by 123blackjack General Chat