/sys/class/leds/blue
, /sys/class/leds/flashlight
, etc.brightness
file with the right to write! What I immediately took advantage of./sys/class/leds/blue/brightness
positive number in the /sys/class/leds/blue/brightness
file, we will turn on the blue indicator on the phone, write 0 to turn it off. Similar to the amber and green indicators. Turning two LEDs together, we get new colors: Subdirectory in / sys / class / leds | What is responsible |
---|---|
lcd backlight | The brightness of the display. The brightness file is written number from 0 to 255: more - brighter. |
flashlight | The brightness of the LED flash. Possible values: 0, 127, 128, 255. |
button-backlight | Button illumination (on / off). |
amber green blue | Orange, green and blue indicators (on / off), as well as the purple (amber + blue) and cyan (green + blue) indicators. |
public void ledControl(String name, int brightness) {<br>
try {<br>
FileWriter fw = new FileWriter( "/sys/class/leds/" + name + "/brightness" );<br>
fw.write(Integer.toString(brightness));<br>
fw.close();<br>
} catch (Exception e) {<br>
// LED <br>
}<br>
}<br>
<br>
// <br>
ledControl( "amber" , 255 );<br>
ledControl( "blue" , 255 );<br>
<br>
// <br>
ledControl( "lcd-backlight" , 30 );<br>
<br>
// <br>
ledControl( "button-backlight" , 0 );<br>
<br>
// <br>
ledControl( "flashlight" , 128 );<br>
Source: https://habr.com/ru/post/104627/
All Articles