True that camera has to be running?

DsyMnapTic

Android Expert
Is it true that the camera had to be running in the background somewhere in order for the LED to be on?
I just emailed the developer of notification toggle, wondering why the camera was operating in the background of Handcent messaging when I had the LED on.


Edit: oh and he told me that there's nothing he could do about it and the camera has to be running in order to have the LED on.
 

Artine

Android Expert
Is it true that the camera had to be running in the background somewhere in order for the LED to be on?
I just emailed the developer of notification toggle, wondering why the camera was operating in the background of Handcent messaging when I had the LED on.


Edit: oh and he told me that there's nothing he could do about it and the camera has to be running in order to have the LED on.

Nope. I have a flashlight app that turns on the LED and the camera is not running in the background. The dev might just need to improve his code.
 

DsyMnapTic

Android Expert
Thread starter
Nope. I have a flashlight app that turns on the LED and the camera is not running in the background. The dev might just need to improve his code.

Here's the thing though Artine, I never would've known it was running if it hadn't have glitched out Handcent. There was nothing showing that any camera app was running, so I couldn't stop it unless I shut the LED off
 

giantpune

Android Enthusiast
The camera doesnt need to be running to turn on the flashlight. In fact, you dont need any java running it all. You can even turn on the camera led from within recovery, where the entire android operating system is not running.

Code:
#include <fcntl.h>
#include <sys/ioctl.h>


int main(int argc, char** argv)
{
    // open camera device
    int led_status;
    int dev = open( "/dev/msm_camera/config0", O_RDONLY );
    if( dev < 0 )
    {
        perror( "open" );
        return 1;
    }
    puts( "opened device" );

    led_status = 1;
    if( ioctl( dev, _IOW( 'm', 22, unsigned *), &led_status ) )
    {
        perror( "ioctl on" );
        close( dev );
        return 1;
    }

    puts( "flashlight on" );
    sleep( 1 );

    led_status = 0;
    if( ioctl( dev, _IOW( 'm', 22, unsigned *), &led_status ) )
    {
        perror( "ioctl off" );
        close( dev );
        return 1;
    }

    puts( "flashlight off" );

    close( dev );
    return 0;
}
 

Artine

Android Expert
The camera doesnt need to be running to turn on the flashlight. In fact, you dont need any java running it all. You can even turn on the camera led from within recovery, where the entire android operating system is not running.

Exactly what I thought.
 

MacFett

Android Expert
I've never been able to get the camera to start if I have the LED on. I've tried with several different apps. I've always figured the two are connected.
 

Artine

Android Expert
I've never been able to get the camera to start if I have the LED on. I've tried with several different apps. I've always figured the two are connected.

They may be connected in that the camera app of choice is calling upon the LED feature, and expecting it to be off when it calls for it. And if it's already on, they don't know what to do, and freak out and refuse to start. At least that's my guess anyway - and if it's right, then developers need to update their camera app coding to start taking into considerations exceptions like these (though I can't imagine they'd typically need to).
 

DsyMnapTic

Android Expert
Thread starter
From what I figured out allot of flashlight app developers say that they need access to the camera in order for the LED to work. Just look around at some on the market. I've also found out, that it doesn't run any app (atleast that I know of) when the light is on. The only way you'd know is when a glitch occurs. I.E. like the one I had in the background of handcent messaging OR now actually I get a glitch of my camera picking up images between screen animations in ADW launcher.
I'm using Tesla LED by the way.
 

DsyMnapTic

Android Expert
Thread starter
I'm even surprised that more of you haven't noticed a decent amount of battery drain while using the LED. Theoretically if the LED is being used by itself it should cause very minimal battery drainage.
 

mrjello

Member
Then developers need to update their camera app coding to start taking into considerations exceptions like these (though I can't imagine they'd typically need to).

I haven't been able to get the stock camera app to work when the flash is already on....
 
Top