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

From: Martin Storsjö martin at martin.st
Date: Fri Jul 23 19:20:52 EEST 2010

I'm developing an app that uses the camera, and aiming for Ovi Store.

One of the issues that Ovi QA complained about is that if the lens cover 
isn't opened, I should add a banner saying that to the user. That's easy 
enough, but when the user actually opens the lens cover, the camera app 
opens (but since my app has grabbed the camera, fails to start). Is there 
any way to block this while my app is running - since if the user has 
started my app, and my app displays a banner telling the user to open the 
lens cover, the user obviously don't want the camera app to start.

I've tried to explore different ways to accomplish this, but most of them 
requires the app to run as root. One really simple way would be to do

echo 1 > /sys/devices/platform/gpio-switch/cam_shutter/disable

but that obviously requires root. I also tried to check what other apps, 
such as shortcutd do, but they don't seem to work as intended with the 
camera button on PR 1.2. Other ways to accomplish it would be to 
reroute/remove the signals, as outlined here:


But that requires root, too. And if the camera-ui process is killed, it 
respawns immediately.

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".

I guess I should discuss this issue with Ovi Publisher Support, too, but I 
don't really expect to get coding hints from there.

// Martin
More information about the maemo-developers mailing list