[Q] Controlling Torch / Camera Flash through Terminal - General Questions and Answers

I'm not sure if there's a better place to post this, i there is let me know and sorry.
My main problem: If I use the terminal to turn the Flash on / off (# echo 0 > /sys/class/leds/led:flash_torch/brightness), my Torch control apps (i.e Torch, TeslaLED), somehow lose the ability to turn the Flash on and off. The only thing that can still control the Flash is the camera app for taking pictures or by using the terminal to turn in back on. Does anyone have any ideas about why this happens, how I can fix it, or where I should go for more help? Or is there a way I can use the terminal to tell my app (Torch -- net.cactii.flash2) to turn off the Flash instead of forcing it off by writing directly to the brightness file?
Background as to why I need to even do this: My phone (Oneplus One, 4.4.4, CM11), has gesture controls that allows me to control the flash while the screen is off and locked. The phone uses the Torch app to do this (net.cactii.flash2). Sometimes it turns on accidentally and I don't notice. So I made a tasker profile that essentially turns the Torch off it's been on for more than 30 seconds. It runs the command (# echo 0 > /sys/class/leds/led:flash_torch/brightness). This works to turn the Flash off, but then I can no longer use Torch or TeslaLED to control the torch. The only way it turns back on is by running a (# echo 1 > ...) (The camera app can also use the Flash for pictures). I've tried to just kill the torch app, but that doesn't turn the flash off.
Oh also, It's not that the Torch apps still work but the "Brightness" is 0 (AFAIK). If that were the case, I feel that the Camera Flash wouldn't work. And When I do Echo 1 > ... to turn it back on, the Apps can't turn it off either.
Thanks guys and girls!

Related

[MOD] Turn off the light on the keys

Hi, there if any of the xda developers can make an application to turn the light on the keys, because when you see a video is a bit annoying that are lit, battery-consuming as well.
Thank you very much for your cooperation.
Regards
Here you go(tnx to mercianary
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Download of the market LEDs hack,that does exactly what we want.
Thanks to friend velazcod for the contribution.
using the following command in 2.1 turns on the blue led.
echo 1 > /sys/devices/platform/leds-microp/blue/brightness
there is a very similar command, cant tell you what it is cuz i am on 2.2 at the minute, that will turn off the key lights.
just change echo 1 to echo 0 and blue to keyled or something, you have too look in the leds-microp dir to find out.
when you have the right command install gscript lite from the market and add a shortcut to the homescreen to your command.
don't think it will work in 2.2 though.
easy peasy!
edit:i know it turns of the led but i'm not sure if it keeps it off, dont remember.
but I do not want the blue LED, what I want is a small application that allows me to turn off lights or turning on the power when I want to watch a video.
thanks anyway for your help
mercianary said:
using the following command in 2.1 turns on the blue led.
echo 1 > /sys/devices/platform/leds-microp/blue/brightness
there is a very similar command, cant tell you what it is cuz i am on 2.2 at the minute, that will turn off the key lights.
just change echo 1 to echo 0 and blue to keyled or something, you have too look in the leds-microp dir to find out.
when you have the right command install gscript lite from the market and add a shortcut to the homescreen to your command.
don't think it will work in 2.2 though.
easy peasy!
edit:i know it turns of the led but i'm not sure if it keeps it off, dont remember.
Click to expand...
Click to collapse
read my post again
thanks again but I'm a rookie and I have no idea of why I say, anyway thank you very much for your attention, I would like is an app that does that, like the one made to turn the blue LED but for the keys.
Thanks
solution:
Here you go.
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Ole Ole, hahahaha very good friend of mine works perfectly, many thanks for your great help, you're a crack mate.
a hug
no problem.
the problem is that when putting a rock video with one player or the act, turn to turn on the lights again, is not likely to be permanent?.
Thanks
mercianary said:
Here you go.
1. install gscript lite from market and run it once, this should create a directory gscript on your sdcard
2. put memory card in pc
3. create a text file and put this command in it.
echo 0 > /sys/devices/platform/leds-microp/leds/button-backlight/brightness
4. save the file as "buttonled.sh" not "buttonled.sh.txt" in sdcard/gscript
5. put the card back in your phone, hold your finger on the home screen and select shortcut, gscript lite, menu, add script, load file, buttonled.sh, save, buttonled.
6. press the new icon on your screen.
this will only work on 2.1
everytime you press this icon the button lights turn off.
they will come back on after certain events, ie locking the screen.
if you know adb you could edit the file trigger in the same directory to permanently disable the light, i think. you will have to figure that out yourself.
Click to expand...
Click to collapse
next time use the "quote"
http://forum.xda-developers.com/showpost.php?p=6855691&postcount=4
kingchris said:
next time use the "quote"
http://forum.xda-developers.com/showpost.php?p=6855691&postcount=4
Click to expand...
Click to collapse
Lol. I would have. But I didn't read that thread.
I noticed button-backlight when I was messing around with the blue led.
They say great minds think alike.
I suppose the moral of the story is to use the search button.
PS. Do you knowhow to get this or led to work on fro yo?
mercianary said:
Lol. I would have. But I didn't read that thread.
I noticed button-backlight when I was messing around with the blue led.
They say great minds think alike.
I suppose the moral of the story is to use the search button.
PS. Do you knowhow to get this or led to work on fro yo?
Click to expand...
Click to collapse
+1 I want this too
When I open my shortcut on the homescreen, this pops up:
Is it normal? Seems like the lights go out shortly, but then returns...
Thanks in advance
EDIT:
I ran the gscript lite once and no folder was created on my sdcard. Had to create it myself.
That scree is meant to pop up bit the writing on the bottom is saying something is wrong.
Install connectbot and run the command directly from terminal.
mercianary said:
That scree is meant to pop up bit the writing on the bottom is saying something is wrong.
Install connectbot and run the command directly from terminal.
Click to expand...
Click to collapse
I have no knowledge about Connectbot at all...
I got it working now You have to be really careful NOT to move your hand across the light censor...
Would it be possible to disable the hardware light for good? (With an option to get it back again)
Thanks
/CK
Using Defrost Froyo on mine. I've got these to play with instead:
Code:
./sys/class/leds
./sys/class/leds/lcd-backlight
./sys/class/leds/green
./sys/class/leds/amber
./sys/class/leds/red
./sys/class/leds/blue
./sys/class/leds/jogball-backlight
./sys/class/leds/button-backlight
./sys/class/leds/flashlight
How to permanent turn off the button-backlight?
Is there any way to turn off the button-backlight permanent?
Maybe over adb in recovery-mode? Tried myself, but didn't find a suitable solution
try this
Stiegi said:
Is there any way to turn off the button-backlight permanent?
Maybe over adb in recovery-mode? Tried myself, but didn't find a suitable solution
Click to expand...
Click to collapse
maybe.
try pulling the file triggers located at "/sys/devices/platform/leds-microp/leds/button-backlight/" removing the contents and pushing it back (or just push an empty file)
my thinking is that if nothing triggers the light to come on it will stay off, maybe.
try it and let us know.
I've been wanting to do this on my Evo, thanks guys for giving me a place to start.
I've taken what I've learned here and progressed it just a tiny bit in this thread here:
http://forum.xda-developers.com/showpost.php?p=7003710&postcount=4
Anyone know of a way to get the script to run automatically during/after boot?

Making Keyboard Backlight Stay on with Tasker App - Stock ROM Rooted

I'm a new Relay user and I can't use CM-10 (need wifi calling) so I'm trying to make the best out of the stock ROM Rooted. I don't like that the keyboard backlight goes out after a few seconds and doesn't seem to even have a sensor to keep it on in dark rooms so I re-downloaded the Tasker App from the Play Store which I haven't used in a while.
To get the keyboard to stay on when slid open I had to do the following:
1. Open Tasker.
2. Choose [Profiles] from the top menu.
3. Click the [plus sign] at the bottom to add a new profile and select [State] from the drop down.
4. Select [Hardware] from the State Category menu.
5. Select [Keyboard Out] from the list of choices here.
6. Tap on the Tasker Icon at the top of the screen and select [Backlight On] from the popup menu.
7. Make sure the toggle switch is set to on for your new profile.
8. Now go to you phone's Sytem Settings > Display > Touch Key Light Duration > and select Always Off (This will allow tasker to take control and have the keyboard backlight stay on when slid open but the Relay's back and menu keys will no longer light up. I can live with this to have my keyboard light on when typing.
9. If this didn't work, make sure Tasker is set to on in System Settings > Accessibility
BTW if someone knows a better way to accomplish this please share.
Edit: Sorry I forgot to mention that I'm using Nova Launcher. I think with the Touchwiz Launcher, apps that use accessibility cause Talkback to speak even if you have it turned off. I could be wrong about that but I had problems with the Light Flow app and accessibility before.
Nice
Good tip. the lights going out bugged me too.
please help. cant find menu with backlight on
Can't find menu with backlight on. Please help.
hey there,
i just figured out how to do this with a non-rooted phone on ics without tasker.
go to settings, display and touch key light duration. increase it to 6 seconds and that will give you enough time to type..
Weird.
I'm on CM10.2 (131117) and since I set the backlight time (in CM10.2 1309xx, I think) to 5 seconds it will always stay on if I open the hardware keyboard.
Maybe I should write me something with tasker to change this in the opposite direction :laugh:

Torch / Flash seems "Locked" from app use

I'm not sure if there's a better place to post this, i there is let me know and sorry.
My main problem: If I use the terminal to turn the Flash on / off (# echo 0 > /sys/class/leds/led:flash_torch/brightness), my Torch control apps (i.e Torch, TeslaLED), somehow lose the ability to turn the Flash on and off. The only thing that can still control the Flash is the camera app for taking pictures or by using the terminal to turn in back on. Does anyone have any ideas about why this happens, how I can fix it, or where I should go for more help? Or is there a way I can use the terminal to tell my app (Torch -- net.cactii.flash2) to turn off the Flash (instead of forcing it off through the echo 0 to the brightness file?
Background as to why I need to even do this: My phone (Oneplus One, 4.4.4, CM11), has gesture controls that allows me to control the flash while the screen is off and locked. The phone uses the Torch app to do this (net.cactii.flash2). Sometimes it turns on accidentally and I don't notice. So I made a tasker profile that essentially turns the Torch off it's been on for more than 30 seconds. It runs the command (# echo 0 > /sys/class/leds/led:flash_torch/brightness). This works to turn the Flash off, but then I can no longer use Torch or TeslaLED to control the torch. The only way it turns back on is by running a (# echo 1 > ...) (The camera app can also use the Flash for pictures). I've tried to just kill the torch app, but that doesn't turn the flash off.
Oh also, It's not that the Torch apps still work but the "Brightness" is 0 (AFAIK). If that were the case, I feel that the Camera Flash wouldn't work. And When I do Echo 1 > ... to turn it back on, the Apps can't turn it off either.
Also, restarting my phone fixes the issue. But I can't just restart every time.
Thanks!

The constantly turning on capacitive buttons...

The capacitive button lights....turn on...all the time. Every time I touch the screen, they flash on....then after half a second, back off. I touch the screen again, they flash at me. I was ready to move on from on screen buttons on my nexus 5...but the lights are so annoying. And even if you turn them off by going to power saver (which you shouldn't have to), then they don't vibrate! And there's nothing printed on the phone at all...so you're just pressing a blank corner of the phone.
Even if they do give the option to turn the lights off in the future, there won't be anything labeling the button to press. Ugh.
I guess you have to pick your poison. You don't want the lights on but at the same time you don't want to touch a blank corner of the bottom of the phone
twoeleven99 said:
I guess you have to pick your poison. You don't want the lights on but at the same time you don't want to touch a blank corner of the bottom of the phone
Click to expand...
Click to collapse
They could have printed something on the phone...but for the sake of making the phone prettier and more iphone like, they didn't. Not to mention the power save mode throttles cpu too...so that's hardly a long term solution. Not keeping a $700 phone in hopes that they'll add an option to turn the lights off.
That sounds really annoying. I have a galaxy s4 on stock touchwiz lollipop and the capacitive button lights don't turn on unless they are pressed. It's always been like that on the s4 and it's the same on my tab 10.1. The only time I've seen the lights turn on whenever I touch the screen is on some aosp roms. Maybe this is a bug on the s6.
I can turn the key lights off on my AT&T S6. Settings, Display, Touch key light duration, always off.
yeah only the ATT s6's have the setting for turning off the lights.
Every other version has had the setting removed. And now the bloody lights turn on anytime you interact with the phone...even if you're not touching the buttons!
But none of the versions have any label printed there right?so even if they add the option to turn off the lights, you won't even have labels to pish will you?
But you know where the buttons are and what they do why do you need them to be labeled?
twoeleven99 said:
But you know where the buttons are and what they do why do you need them to be labeled?
Click to expand...
Click to collapse
OCD mainly. I shouldn't have to push a general area of the phone and have it do something. Heck, half the promo shots of the phone make it look like there is a light printing of the buttons, but in reality it's blank.
If the ATT version has the option to disable or set a timer, it's definitely software bound. Probably will be added to future updates, hoping so.
I'm sure it could be tweaked with software. Hell, they wouldn't really bother me that much if they just faded in and out.
adb fix for capacitive buttons
0dBu said:
I'm sure it could be tweaked with software. Hell, they wouldn't really bother me that much if they just faded in and out.
Click to expand...
Click to collapse
Hi, using my Note 3 and adb I figured out the fix for this. On the Note 3 these settings were under Settings/Display/Touch Key Light. Assuming you have ADB installed and the phone put into developer mode (root is not required, this is 'standard' stuff) + usb debugging to on, take the following steps (tested on an S6 Edge):
* on the PC running adb, connect it to the device and use the command 'adb usb'. Perform the requested action to allow the PC access to the S6 (Edge)
* next, use the following commands to change the light-out period:
"adb shell settings put system button_key_light 0" -> always disable the capacitive button lights
"adb shell settings put system button_key_light -1" -> always enable the capacitive button lights
"adb shell settings put system button_key_light 1500" -> always disable the capacitive button lights after 1.5 seconds
"adb shell settings put system button_key_light 6000" -> always disable the capacitive button lights after 6.0 seconds
"adb shell settings get system button_key_light" -> get the current setting (standard: 1500, ie. 1.5 seconds)
Good luck,
Sander761 (I posted this same instruction on Tweakers.net in Dutch btw)
Interesting, thank you.
So it's either disable the capacitive backlights or enable them? I'm not sure about the S5, but I know the S3 and S4 will only turn on the backlights for the buttons if you actually press them, and they will stay off when you are touching the screen. It's much better that way.
mupet0000 said:
So it's either disable the capacitive backlights or enable them? I'm not sure about the S5, but I know the S3 and S4 will only turn on the backlights for the buttons if you actually press them, and they will stay off when you are touching the screen. It's much better that way.
Click to expand...
Click to collapse
I get the exact same behaviour on my S6 as I get on my Note 3: if I touch them they will light up, if I touch the screen they will stay off. So I don't think that has changed.
I can assure you that at least on a T-Mobile GS6 when you touch the screen the capacitive buttons light up.
0dBu said:
I can assure you that at least on a T-Mobile GS6 when you touch the screen the capacitive buttons light up.
Click to expand...
Click to collapse
Confirming as true.
sander761 said:
Hi, using my Note 3 and adb I figured out the fix for this. On the Note 3 these settings were under Settings/Display/Touch Key Light. Assuming you have ADB installed and the phone put into developer mode (root is not required, this is 'standard' stuff) + usb debugging to on, take the following steps (tested on an S6 Edge):
* on the PC running adb, connect it to the device and use the command 'adb usb'. Perform the requested action to allow the PC access to the S6 (Edge)
* next, use the following commands to change the light-out period:
"adb shell settings put system button_key_light 0" -> always disable the capacitive button lights
"adb shell settings put system button_key_light -1" -> always enable the capacitive button lights
"adb shell settings put system button_key_light 1500" -> always disable the capacitive button lights after 1.5 seconds
"adb shell settings put system button_key_light 6000" -> always disable the capacitive button lights after 6.0 seconds
"adb shell settings get system button_key_light" -> get the current setting (standard: 1500, ie. 1.5 seconds)
Good luck,
Sander761 (I posted this same instruction on Tweakers.net in Dutch btw)
Click to expand...
Click to collapse
Thanks for the fix, disabled them. Sad there isn't a way to have them only go on when you press them.
I'm sure it can be customized to only light up if pressed on a custom rom. If there are enough requests maybe a dev making roms for us can implement it
sander761 said:
I get the exact same behaviour on my S6 as I get on my Note 3: if I touch them they will light up, if I touch the screen they will stay off. So I don't think that has changed.
Click to expand...
Click to collapse
This is the behaviour we all want I think. Which variant do you have?
mupet0000 said:
This is the behaviour we all want I think. Which variant do you have?
Click to expand...
Click to collapse
I have the European variant S6 Edge SM-925F, build LRX22G.G925FXXU1AOCV. But just to confirm: my behaviour is that *once the display is on*, using the touchscreen (except cap. button area) does not light the buttons. When unlocking the device, the buttons always light up briefly (unless you turned them off, of course). If that is the wanted behaviour, I guess this is the build you want

Is there a way to turn off Capacitive Buttons light ?

I bought the Phab2 Pro and one of the first things I noticed is that the light of the navigation bar (back, home, recent buttons), is always on, and the settings option to disable it, it's gone.
I tried to manage it with some apps and they don't work.
Also tried trampling with the adb usb debugging "adb shell settings put system button_key_light 0" and it doesn't work, but change it for screen_brighteness for example and it works perfectly.
I just want to turn it off because it's really annoying when I'm watching videos or just playing landscape. Anyone knows a way?

Categories

Resources