FORUMS
Remove All Ads from XDA

Moto G LEDs Custom Controls

3,379 posts
Thanks Meter: 4,769
 
Post Reply Email Thread
Playing With Notification LED
Original source <<< make sure you read the blog article before commenting ....

It's always cool to know at a glance that your device is charging without the need of lighting the screen, here is how:

Requirements :
  • Moto G (tested on XT1032)
  • Rooted
  • SU rights granted
  • adb if you want to monitor all this from a computer

Code:
#include <std_disclaimer.h>
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards, BURNT LEDs,
* thermonuclear war, or you getting fired because the alarm app failed.
* YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you.
*/


in /sys/class/leds/charging/trigger we have these triggers available :
Code:
[none] bkl-trigger usb-online flash0_trigger torch_trigger mmc0 battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid bms-online
easy to change them using :
Code:
echo battery-charging >/sys/class/leds/charging/trigger
The same is available in /sys/class/leds/white/trigger, and /sys/class/leds/white/brightness allows to dim the LED, though :
  • During test i was able to show that using /sys/class/leds/charging/trigger overrides any other trigger (if a notification comes, then it won't change the pattern) After extended test, it turned out that MotoG also have two LEDs
  • Though using /sys/class/leds/white/brightness allows to use 0~255 values to dimm the LED, and /sys/class/leds/white/trigger works; it is overridden by any incoming notification that set brightness back to 0.

edit : Current knowledg is :
  • /sys/class/leds/charging/trigger → first LED, can be set to on/blinking while charging, although at full brightness.
  • /sys/class/leds/white/trigger → second LED, can be dimmed, but the LED turns back off when a notification comes in.

For now, the best way is to set "first" LED (/sys/class/leds/charging/) for charging using dedicated trigger and keeping the "second" one to none and get both working together this way.
What we need is to find a way to dim the "first" LED

______________________________

[YOUTUBE]hYmxhQfwPT8[/YOUTUBE]

Set at boot:
WARNING : if you fail this, you may screw up your device ... (keep a backup somewhere)
  1. Create a blank file and name it like 99charging_LED-blink
  2. paste the following in that file :
    Code:
    #!/system/bin/sh
    # enabling charging LED blinking while charging
    echo "battery-charging-blink-full-solid" >/sys/class/leds/charging/trigger
    echo "1" >/sys/class/leds/charging/brightness
  3. mount /etc/init.d as RW
  4. Paste 99charging_LED-blink there
  5. set permissions as -RWXR-XR-X
  6. Open terminal emulator, and type :
    Code:
    su
    sh /etc/init.d/99charging_LED-blink
    Plug it to charger, it should start blinking ... if not, make sure everything is correctly set
  7. Reboot
  8. Enjoy!

______________________________

The above has only been tested on CM11
Here is the LED related Thread for MotoE

XDA:DevDB Information
Moto G notification LEDs Custom Controls, Tool/Utility for the Moto G

Contributors
matmutant

Version Information
Status: Testing

Created 2014-11-24
Last Updated 2014-12-15
The Following 35 Users Say Thank You to matmutant For This Useful Post: [ View ] Gift matmutant Ad-Free
 
 
24th November 2014, 10:22 AM |#2  
matmutant's Avatar
OP Senior Member
Flag ~/
Thanks Meter: 4,769
 
Donate to Me
More
reserved
reserved
The Following 2 Users Say Thank You to matmutant For This Useful Post: [ View ] Gift matmutant Ad-Free
24th November 2014, 10:22 AM |#3  
matmutant's Avatar
OP Senior Member
Flag ~/
Thanks Meter: 4,769
 
Donate to Me
More
reserved too
....
The Following 2 Users Say Thank You to matmutant For This Useful Post: [ View ] Gift matmutant Ad-Free
24th November 2014, 11:13 AM |#4  
reversegear's Avatar
Senior Member
Thanks Meter: 1,605
 
More
@matmutant where were you so far we were missing you soo much
thanks for the mod
The Following 2 Users Say Thank You to reversegear For This Useful Post: [ View ] Gift reversegear Ad-Free
24th November 2014, 11:24 AM |#5  
matmutant's Avatar
OP Senior Member
Flag ~/
Thanks Meter: 4,769
 
Donate to Me
More
Quote:
Originally Posted by reversegear

@matmutant where were you so far we were missing you soo much
thanks for the mod

I am always around here, though i don't post if un-needed, and i was out of idea regarding customizations
The Following 3 Users Say Thank You to matmutant For This Useful Post: [ View ] Gift matmutant Ad-Free
24th November 2014, 12:19 PM |#6  
sfoot13's Avatar
Senior Member
Thanks Meter: 206
 
More
Working! Good job! Thank you so much for this!

EDIT: Working on CM11 and CM12 (anerik).
The Following User Says Thank You to sfoot13 For This Useful Post: [ View ] Gift sfoot13 Ad-Free
24th November 2014, 01:04 PM |#7  
DeHuMaNiZeD's Avatar
Senior Member
Flag Jastrebarsko
Thanks Meter: 2,409
 
Donate to Me
More
It would be cool if we could change the colors,and i think it would be possible..


Edit: sorry,i haven't read the blog -.-
BUT! I know you from the mini xperia's forums,i was an X8 user. I still have the old x8,and i was thinking,maybie we could make a hardware modification and swap the leds from X8 to Moto G? I have an old broken x8 at home,and the screen is broken but i think the led works. I haven't dissasembled my Moto G yet and i don't know if the led is hard sealed to the Motherboard or Speaker or camera..
The Following User Says Thank You to DeHuMaNiZeD For This Useful Post: [ View ] Gift DeHuMaNiZeD Ad-Free
24th November 2014, 08:54 PM |#8  
matmutant's Avatar
OP Senior Member
Flag ~/
Thanks Meter: 4,769
 
Donate to Me
More
Totally useless, but still classy : you can make the screen blink using :

Code:
echo battery-charging-blink-full-solid >/sys/class/leds/lcd-backlight/trigger
The Following 3 Users Say Thank You to matmutant For This Useful Post: [ View ] Gift matmutant Ad-Free
25th November 2014, 03:44 AM |#9  
wijiji's Avatar
Senior Member
Thanks Meter: 9
 
More
I´m not sure what is this for.. :S
25th November 2014, 05:20 AM |#10  
reversegear's Avatar
Senior Member
Thanks Meter: 1,605
 
More
Quote:
Originally Posted by wijiji

I´m not sure what is this for.. :S

Read, still dont understand read again
25th November 2014, 02:24 PM |#11  
Senior Member
Thanks Meter: 147
 
More
Where is that second LED located?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes