[ intro ]
so as you all are aware the Xperia SP has a nice LED Illumination bar... Sony was kind enough to provide APIs to control this illumination bar but that is only good if you use it in apps...
many devs here were trying to figure out how to control this LED bar by the traditional ways of using sysfs interface...
I was able to figure out how to get this work! following is a short how-to for controlling the LED Illumination bar!
hope this helps!
[ proof ]
[ NOTE ]
all this requires ROOT! to change the values!
[ interface ]
the stock kernel provides a SYSFS interface at:
there are 3 LED locations mapped as:
LED3 - LED1 - LED2
(check the image above for mapping)
each LED control has 3 colors:
each LED control interface has two parameters which are of interest to control LED
traditionally LEDs could be controlled using only the brightness interface BUT on the Xperia SP we first need to control the led_current
each one has limits 0 (minimum) to 255 (maximum)
[ example ]
cheers!
regards,
DooMLoRD
so as you all are aware the Xperia SP has a nice LED Illumination bar... Sony was kind enough to provide APIs to control this illumination bar but that is only good if you use it in apps...
many devs here were trying to figure out how to control this LED bar by the traditional ways of using sysfs interface...
I was able to figure out how to get this work! following is a short how-to for controlling the LED Illumination bar!
hope this helps!
[ proof ]
[ NOTE ]
all this requires ROOT! to change the values!
[ interface ]
the stock kernel provides a SYSFS interface at:
Code:
/sys/devices/i2c-10/10-0047/leds
there are 3 LED locations mapped as:
LED3 - LED1 - LED2
(check the image above for mapping)
each LED control has 3 colors:
- RED
Code:[B][COLOR="Red"] /sys/devices/i2c-10/10-0047/leds/LED1_R/ /sys/devices/i2c-10/10-0047/leds/LED2_R/ /sys/devices/i2c-10/10-0047/leds/LED3_R/ [/COLOR][/B]
- BLUE
Code:[B][COLOR="blue"] /sys/devices/i2c-10/10-0047/leds/LED1_B/ /sys/devices/i2c-10/10-0047/leds/LED2_B/ /sys/devices/i2c-10/10-0047/leds/LED3_B/ [/COLOR][/B]
- GREEN
Code:[B][COLOR="green"] /sys/devices/i2c-10/10-0047/leds/LED1_G/ /sys/devices/i2c-10/10-0047/leds/LED2_G/ /sys/devices/i2c-10/10-0047/leds/LED3_G/ [/COLOR][/B]
each LED control interface has two parameters which are of interest to control LED
- led_current
- brightness
traditionally LEDs could be controlled using only the brightness interface BUT on the Xperia SP we first need to control the led_current
each one has limits 0 (minimum) to 255 (maximum)
[ example ]
- to make left LED GREEN give the command:
Code:[b] echo 255 > /sys/devices/i2c-10/10-0047/leds/LED3_G/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED3_G/brightness; [/b]
- to make center LED BLUE give the command:
Code:[b] echo 255 > /sys/devices/i2c-10/10-0047/leds/LED1_B/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED1_B/brightness; [/b]
- to make right LED RED give the command:
Code:[b] echo 255 > /sys/devices/i2c-10/10-0047/leds/LED2_R/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED2_R/brightness; [/b]
- to power off all the LEDs use:
Code:[B] echo 0 > /sys/devices/i2c-10/10-0047/leds/LED1_B/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED2_B/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED3_B/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED1_G/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED2_G/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED3_G/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED1_R/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED2_R/led_current; echo 0 > /sys/devices/i2c-10/10-0047/leds/LED3_R/led_current; [/B]
- for disco lights:
Code:[B]echo 255 > /sys/devices/i2c-10/10-0047/leds/LED3_G/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED3_G/brightness; sleep 1; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED1_B/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED1_B/brightness; sleep 1; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED2_R/led_current; echo 255 > /sys/devices/i2c-10/10-0047/leds/LED2_R/brightness; sleep 1;[/b]
cheers!
regards,
DooMLoRD
Attachments
Last edited: