I don't know that part of the code, but I suspect that a file operation is attempted upon leaving ALT mode.
Index: platform/generic/wrappers.c===================================================================--- platform/generic/wrappers.c (revision 3457)+++ platform/generic/wrappers.c (working copy)@@ -366,14 +366,21 @@ return _open(name, flags, mode); #endif */+ if ( !is_video_recording() )+ { #if CAM_DRYOS- _TakeSemaphore(fileio_semaphore,0);- int fd = _Open(name, flags, mode);- _GiveSemaphore(fileio_semaphore);- return fd;+ _TakeSemaphore(fileio_semaphore,0);+ int fd = _Open(name, flags, mode);+ _GiveSemaphore(fileio_semaphore);+ return fd; #else- return _Open(name, flags, mode);+ return _Open(name, flags, mode); #endif+ }+ else+ {+ return -1;+ } } int close (int fd)
Code: [Select]Index: platform/generic/wrappers.c===================================================================--- platform/generic/wrappers.c (revision 3457)+++ platform/generic/wrappers.c (working copy)@@ -366,14 +366,21 @@ return _open(name, flags, mode); #endif */+ if ( !is_video_recording() )+ { #if CAM_DRYOS- _TakeSemaphore(fileio_semaphore,0);- int fd = _Open(name, flags, mode);- _GiveSemaphore(fileio_semaphore);- return fd;+ _TakeSemaphore(fileio_semaphore,0);+ int fd = _Open(name, flags, mode);+ _GiveSemaphore(fileio_semaphore);+ return fd; #else- return _Open(name, flags, mode);+ return _Open(name, flags, mode); #endif+ }+ else+ {+ return -1;+ } } int close (int fd)This appears to solve the problem on my a3200 ( fopen() would need similar treatment ).Now, the problem is that is_video_recording() is not reliable on every port:some ports would need CAM_HAS_MOVIE_DIGEST_MODE even though they have no digest mode - I have fixed this on the a3200, but there's likely more.
What happens if you call _Open instead of just returning -1? This has the risk of triggering the FsIoNotify issue; but that was a pretty rare occurrence.
Quote from: philmoz on 07 / June / 2014, 19:03:24What happens if you call _Open instead of just returning -1? This has the risk of triggering the FsIoNotify issue; but that was a pretty rare occurrence.On at least some cameras, this problem predates the addition of the semaphore check.Making open and fopen fail would probably be better than hanging, though I wouldn't be surprised if there is code that assumes open works and behaves badly.
A lot of ALT mode functionality relies on file I/O (modules, file browser, scripts) - maybe it's better to just block ALT mode when video is recording.
I'd still vote for making open and fopen fail.
The bad thing is that we can't safely enable such measures automatically for all ports due to problems with is_video_recording() on some cameras as mentioned above.
Assuming that the TakeSemaphore does get blocked in this case, one thing we could do is put a timeout on it and make open fail if it times out.
Turns out the value of 'movie_status' can be 6 on some models which pre-date the "movie digest" feature (sx130, s95 for example). It also seems like testers/users don't notice the inappropriate appearance of the CHDK "movie bitrate / remaining recording time" display - several ports would need CAM_HAS_MOVIE_DIGEST_MODE to correct that.That means is_video_recording() can't be trusted enough to disallow file operations based on its value.Next idea is to find the 'master semaphore' that blocks file operations...
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