Can I control LEDs from command line? - G1 Q&A, Help & Troubleshooting

Hi guys,
I made a little shell script that I run which backs up my settings on the phone. What I'd like to do is make the LED light up green if the process completes and red if it fails, for a few seconds and then clear it.
Is it possible to control the LED from the command line?

Yes you can control LEDs from the command line.
Try something like this:
echo "255" >> /sys/class/leds/<colour>/brightness
Click to expand...
Click to collapse
colour can be one of these:
red
green
blue
jogball-backlight
button-backlight
lcd-backlight
I tried this on my Magic, not sure if it's the same for others.
Changing red/green/blue will affect the led. You can mix colours, so setting red and green to 255 will give you yellow (it's actually more orange - the colour it turns when it is charging).
Values can be 0-255 but anything that is not 0 will turn the led on. There don't seem to be any brightness levels as far as I have found.
jogball-backlight is obvious - the light behind the trackball.
button-backlight is the light behind the keypad. For your Dream you may have something else to control the keypad backlight but since the Magic doesn't have one, this option affects the 6 buttons on the front of the device.
lcd-backlight I have so far not been able to get to work. Changing the value has no effect.
The red/green/blue values also have a blink file which can be set:
echo "255" >> /sys/class/leds/red/blink
Click to expand...
Click to collapse
This will make the led begin to blink. Note that you must set the brightness as well. Brightness of 0 and blink of 255 will not do anything. Only the led has this ability. I'm not sure how the trackball does the fade on and off when you get a text message.
You can mix blink of one colour with constant of another. For example, set:
green brightness to 255,
green blink to 0,
red brightness to 255,
red blink to 255
blue brightness to 0
blue blink to 0
What you will see is an led that is green, but blinks yellow/orange.
Blinks are always synchronised. You cannot use blink to flash green then red one after the other. Setting both brightness and blink to 255 on red and green will cause a yellow/orange flashing led.
However if you make a timer and set green brightness to 0 and red to 255, then after x seconds set red to 0 and green to 255 you can achieve the effect of blinking between two colours. The device itself has no method of doing this automatically though.
You can also change the values when the device is plugged in. If I plug mine in via USB, the led turns orange while it charges. If you check the value of green and red you will see they are now 255 and blue is 0. Set green and red to 0 and the led will be off even though the device is plugged in.
What I have noticed with this though is that when you unplug, the led goes back to orange and then turns off. This happens no matter what you set - if your device is plugged in and then you make the led blue, when you unplug the led will turn orange and then off (or green then off if it is fully charged).
System events can also override whatever values you set. If you set the led blue then plug it in, it will still change to green or orange (green for charged, orange for charging). I assume getting a text message will override and flash green as well.
That's everything I've found out about them. You may want to make a little script that you can pass parameters to, like "setLED r g b" or something. Would make it easier to set colour combinations.
Have fun with the LEDs.

Related

Message light

There is a green light blinking normally, but when a message arrives, it starts blinking as orange. Is there a way to make it blink as red, so it would be a much more noticeable color?
http://www.modaco.com/content/smart...nload-discussion/259413/kaiser-notifications/
That was quick, thanks !

[Q] led notifications on GingerDX

Do LED-Notifications work for you in GingerDX?
In my phone they don't seem to work?!
They work for me
it seems they got messed up somehow? if i set them in cyanogensettings they at least work once (means they blink 1 time)?
just did a full wipe and the problem persists ...
e.g.: missed call: screen goes off, led blinks once green and then stops blinking, but is supposed to blink red?
i have same problem, LED just blinks at once..
Had no problem with any LED notifications to date on any rom, just wish I could change the the charging light. >_<
alphine.zzz said:
i have same problem, LED just blinks at once..
Click to expand...
Click to collapse
You can set how much it blinks by changing that specific setting in blink rate.
by changing the blink rate it just changes the "speed" of blinking?
Ginger DX v21 LED Notifications don't work
Edit: Never Mind! Night-time notification toggle was on!
I installed Ginger DX with a full wipe. The LED notifications don't work, although the LED lights up while charging.
Any suggestions?
Thanks

I can only get the notification light to show green or red - are there other colors?

I have been playing around with light flow and the notification light and so far I have only been able to get the notification light to show either green or red. Does anyone else get other colors? I tried another application from the play store and got the same results - no matter what color I set it to, I get either red or green.
I am trying to figure out if there is a problem with my phone or whether they are all this way and if there is a way to get any other colors?
I checked the reviews on amazon and one said: "- It has a Notification LED (Also shows Red when charging, otherwise green.)" This would also seem to indicate that it only has the two colors.
This is disappointing and, if true, I'll need to start playing around with flash rates in order to be able to differentiate more types of notifications.
Mine is only doing red and green as well. tried playing with light flow and couldn't get it to do anything.
OK, so it's not just my phone, at least. It seemed to me that any color that is not green gets mapped to red. It doesn't even have white, which surprised me.
My original nexus 5 could display any color with the notification led - orange, blue, brown, etc. It was very useful and I'm disappointed the the Blu R1 HD doesn't have the same capability.
yaconsult said:
I have been playing around with light flow and the notification light and so far I have only been able to get the notification light to show either green or red. Does anyone else get other colors? I tried another application from the play store and got the same results - no matter what color I set it to, I get either red or green.
I am trying to figure out if there is a problem with my phone or whether they are all this way and if there is a way to get any other colors?
I checked the reviews on amazon and one said: "- It has a Notification LED (Also shows Red when charging, otherwise green.)" This would also seem to indicate that it only has the two colors.
This is disappointing and, if true, I'll need to start playing around with flash rates in order to be able to differentiate more types of notifications.
Click to expand...
Click to collapse
Its the phone hardware, we turn on both green and red at the same time to make a third color
Sent from my Lenovo A7010a48 using XDA Labs
I wonder if this is a software problem. I suppose it's entirely possible that this phone has a red LED and a green LED and not an RGB LED like most modern phones.
ColtonDRG said:
I wonder if this is a software problem. I suppose it's entirely possible that this phone has a red LED and a green LED and not an RGB LED like most modern phones.
Click to expand...
Click to collapse
So far as I can tell, it just has red and green.
Also so far as I can tell, there are only simple on/off switches.
Code:
~ # cd /sys/class/leds/
/sys/class/leds # ls -1
green
lcd-backlight
red
Checking max values indicates 256 brightness steps (including 0).
Code:
/sys/class/leds # cat red/max_brightness
255
But a physical check shows that values 1-255 appear no different (i.e. all the way on).
Code:
/sys/class/leds # cd red/
/sys/devices/platform/leds-mt65xx/leds/red # cat brightness #checking brightness while off
0
/sys/devices/platform/leds-mt65xx/leds/red # echo 1 > brightness #looks like it's all the way on
/sys/devices/platform/leds-mt65xx/leds/red # echo 255 > brightness #looks exactly the same
/sys/devices/platform/leds-mt65xx/leds/red # echo 0 > brightness #led turns off
Checking lcd-backlight is the screen backlight, as should be expected.
I honestly have no clue if that could be software or hardware (I'm new to this), but I'd guess hardware. This is, after all, a $60 phone... For the money, great, but you lose some of those niceties like RGB lights with multiple brightness levels.
Edit: FWIW, turning both red and green on at the same time only makes an orange-ish red. So that gives us 4 states - all off, red on, green on, and red/green (orange)
Zokoro said:
So far as I can tell, it just has red and green.
Also so far as I can tell, there are only simple on/off switches.
Code:
~ # cd /sys/class/leds/
/sys/class/leds # ls -1
green
lcd-backlight
red
Checking max values indicates 256 brightness steps (including 0).
Code:
/sys/class/leds # cat red/max_brightness
255
But a physical check shows that values 1-255 appear no different (i.e. all the way on).
Code:
/sys/class/leds # cd red/
/sys/devices/platform/leds-mt65xx/leds/red # cat brightness #checking brightness while off
0
/sys/devices/platform/leds-mt65xx/leds/red # echo 1 > brightness #looks like it's all the way on
/sys/devices/platform/leds-mt65xx/leds/red # echo 255 > brightness #looks exactly the same
/sys/devices/platform/leds-mt65xx/leds/red # echo 0 > brightness #led turns off
Checking lcd-backlight is the screen backlight, as should be expected.
I honestly have no clue if that could be software or hardware (I'm new to this), but I'd guess hardware. This is, after all, a $60 phone... For the money, great, but you lose some of those niceties like RGB lights with multiple brightness levels.
Edit: FWIW, turning both red and green on at the same time only makes an orange-ish red. So that gives us 4 states - all off, red on, green on, and red/green (orange)
Click to expand...
Click to collapse
Nice. Thanks for finding that. We'll have to utilize different flash rates in order to get any more detailed than that. As much as I'd like to say I'm disappointed that we got a crappy LED, we only paid $60 for this phone that, despite having a handful of shortcomings, is a very nice piece of hardware. It's got a recent version of Android, is super fast and has great performance, and has a bright and beautiful screen. Every time I learn about a new shortcoming like this, it's hard to feel bad about it because this phone is so good for the price. You get what you pay for and quite a bit more.
On my phone, I also noticed that the red light is much brighter than the green light. I think that they used one of these LED Bi-Color Green/Red: http://www.instructables.com/id/The-RedGreen-LED-Guide/

Led Changer

Hi, is there anyway to totally customize the led notification light on the r1hd, apart fro mthe standerd red and green
thabuff said:
Hi, is there anyway to totally customize the led notification light on the r1hd, apart fro mthe standerd red and green
Click to expand...
Click to collapse
I think gravitybox allows you to do this, you'll need Xposed framework though.
I have looked into this extensively. There is another thread about it already. Unfortunately, the LED is this phone has only red and green colors - that's it. Now, by turning on both the red and green at the same time, you should be able to get a third color - orange. BUT, the red LED is so much brighter than the green LED that the "orange" looks almost the same as the red, so it's really not usable. I emailed back and forth with the developer of the wonderful lightflow app to help figure out if it was a hardware or a software issue. Unfortunately for us, it's a hardware issue. They saved a few cents by using a red and green color LED instead of a much higher quality red, green, blue LED.
The bottom line is that the LED can only be bright red or green. You can use blink rates in combinations with the colors to indicate different things though. If you look at my post in the other thread, you can see how to turn the red and green on and off again with some simple commands.
yaconsult said:
I have looked into this extensively. There is another thread about it already. Unfortunately, the LED is this phone has only red and green colors - that's it. Now, by turning on both the red and green at the same time, you should be able to get a third color - orange. BUT, the red LED is so much brighter than the green LED that the "orange" looks almost the same as the red, so it's really not usable. I emailed back and forth with the developer of the wonderful lightflow app to help figure out if it was a hardware or a software issue. Unfortunately for us, it's a hardware issue. They saved a few cents by using a red and green color LED instead of a much higher quality red, green, blue LED.
The bottom line is that the LED can only be bright red or green. You can use blink rates in combinations with the colors to indicate different things though. If you look at my post in the other thread, you can see how to turn the red and green on and off again with some simple commands.
Click to expand...
Click to collapse
Well thx for the research m8. It's unfortunate tho. But nevertheless thanks very much for the info
I was VERY disappointed to find this out! My previous phone was a Moto G xt1045 and it had a white notification light only. On the models after that, they removed it altogether in favor of "ambient display" - yech! Doesn't do you a damn bit of good when you are across the room and look over at the phone. A blinking light, you can see. A notification that pops up from time to time, you are unlikely to.
I was so looking forward to having a full color LED like the Nexus 5 I had years ago had. But... $60!
Sorry for my english this Led its only "Led charger" or Led notificatiom also?
Chukie022 said:
Sorry for my english this Led its only "Led charger" or Led notificatiom also?
Click to expand...
Click to collapse
No, it's not just for indicating charging. You can use it to indicate anything you like using an application like LightFlow.
But since it can only display the colors red and green, and both together still look like red because red is so much brighter, you really only have two colors to work with.
You can use things like different blink rates and sounds to indicate different notifications as well.

Question Customise notification Led

Hi all,
Wondering if anyone knows if the notification LED can be customised? I've tried light flow but it doesn't work correctly (perhaps because of the lack of colours supported by zenfone LED?).
Sadly, the notification LED is only red green and yellow
Adaoh said:
Sadly, the notification LED is only red green and yellow
Click to expand...
Click to collapse
That is a little unfortunate although if it could be customized it still would be handy (for example green on vs slow flash vs fast flash all for different apps).. Seems strange that the green light flow settings don't work even though the LED has green.

Categories

Resources