[maemo-developers] How to block the camera app from starting on lens cover open

From: Eino-Ville Talvala talvala at stanford.edu
Date: Fri Jul 30 12:03:38 EEST 2010
  On 7/30/2010 1:47 AM, Eero Tamminen wrote:
> Hi,
>
> ext Martin Storsjö wrote:
>> On Sat, 24 Jul 2010, Yves-Alexis Perez wrote:
>>> On ven., 2010-07-23 at 19:20 +0300, Martin Storsjö wrote:
>>>> Any hints on how to solve this in the best way? I don't want my app 
>>>> to fail in the next QA round with the reason "camera app is 
>>>> launched and closes immediately if the lens cover is opened while 
>>>> your app is running". 
>>> Did you check how fcamera is doing it?
>>
>> Thanks for the pointer!
>>
>> It seems that the FCam library kills camera-ui using dsmetool - which 
>> totally makes sense for an application that tries to grab the camera 
>> button for itself, too.
>
> And what happens in the application crashes without restoring camera-ui,
> user needs to reboot to get camera working again?
>
>
>     - Eero
>
> (better may be a small wrapper / watchdog for the process that does
> the camera-ui removal before launching the program and restores it
> after the program terminates?)

In the case of FCam programs, which as mentioned use the dsmetool tool 
hack: If the program crashes, normal camera function isn't restored.  
The camera can be started from the app menu manually, which I believe 
restores normal lens cover function, but at that point the camera app is 
running as a regular app, not under dsmetool (so it can't be killed 
through dsmetool). Alternatively, starting and then quitting an FCam 
program will restore the lens cover function.  As a safety fallback, 
FCam first tries to kill the camera program with dsmetool, and then with 
regular kill - the regular kill is needed in the second case (regular 
camera program started outside of dsmetool).

A wrapper shellscript or a watchdog process might be a better idea, 
although if an app only uses the camera part of the time, it might be 
nice to be able to re-enable the normal camera function sooner (so if 
camera functionality is only a small part of the app's functionality, 
you're not hogging the camera for the whole of program execution).

Eddy Talvala
Stanford University
More information about the maemo-developers mailing list