Quote:
Originally Posted by antawnm26 View Post
how did you do this?
Note, I'm on AOKP 4.3 with its kernel. These very well might not be exactly the same for all ROMs.

Attaching a script, it's just for playing, not really very useful at this point. Your device must be awake for the script to run properly, otherwise you'll find "sleep 1" (sleep 1 second) taking 5-10 seconds

If the devices in the script don't exist to play with, try find /sys | grep brightness to find them on your ROM.

green() etc turn it on the first time you hit the function, turn it off the next. The rear LEDs were a little weird, so I did them differently. They always show as 71 for some reason, where the others show 0 when they're off. Anyway, it works. I'm not checking any arguments, but some expect a second argument, and the third argument isn't used at all. Anyway, just an example, nothing you can directly use.

Code:
#!/bin/sh

rear_left="/sys/devices/leds-qpnp-d8117600/leds/button-backlight1/brightness"
rear_left_max="/sys/devices/leds-qpnp-d8117600/leds/button-backlight1/max_brightness"
rear_right="/sys/devices/leds-qpnp-d8117600/leds/button-backlight2/brightness"
rear_right_max="/sys/devices/leds-qpnp-d8117600/leds/button-backlight2/max_brightness"
red="/sys/devices/leds-qpnp-d8117200/leds/red/brightness"
red_max="/sys/devices/leds-qpnp-d8117200/leds/red/max_brightness"
blue="/sys/devices/leds-qpnp-d8117200/leds/blue/brightness"
blue_max="/sys/devices/leds-qpnp-d8117200/leds/blue/max_brightness"
green="/sys/devices/leds-qpnp-d8117200/leds/green/brightness"
green_max="/sys/devices/leds-qpnp-d8117200/leds/green/max_brightness"
torch="/sys/devices/leds-qpnp-d8117400/leds/led:flash_torch/brightness"
torch_max="/sys/devices/leds-qpnp-d8117400/leds/led:flash_torch/max_brightness"

# These could be useful for blink/rgb but not working from what I've found
# so far, but good info from the Tasker forum
# https://groups.google.com/forum/#!topic/tasker/pKWOQXZv7Hs/discussion
blink_patterns="/sys/devices/virtual/g2_rgb_led/use_patterns/blink_patterns"
input_patterns="/sys/devices/virtual/g2_rgb_led/use_patterns/input_patterns"
onoff_patterns="/sys/devices/virtual/g2_rgb_led/use_patterns/onoff_patterns"

pattern=$1
time_on=$2
time_off=$3

green()
{
echo "green"
  if [ `cat $green_max` == `cat $green` ]; then
    echo 0 > $green
  else
    echo `cat $green_max` > $green
  fi
}

red()
{
echo "red"
  if [ `cat $red_max` == `cat $red` ]; then
    echo 0 > $red
  else
    echo `cat $red_max` > $red
  fi
}

blue()
{
echo "blue"
  if [ `cat $blue_max` == `cat $blue` ]; then
    echo 0 > $blue
  else                                         
    echo `cat $blue_max` > $blue
  fi                              
}

rear_left()
{
  if [ `cat $rear_left` -gt 0 ]; then
    echo 0 > $rear_left
  else                                         
    echo `cat $rear_left_max` > $rear_left
  fi
} 

rear_right()
{
  if [ `cat $rear_right` -gt 0 ]; then
    echo 0 > $rear_right
  else
    echo `cat $rear_right_max` > $rear_right
  fi
}

torch()
{
  if [ `cat $torch_max` == `cat $torch` ]; then
    echo 0 > $torch
  else
    echo `cat $torch_max` > $torch
  fi
}

flashtorch()
{
  flashes=0
  while [ $flashes -lt $time_on ]; do
    let flashes=flashes+1
    torch
    usleep 50000
    torch
    usleep 40000
  done
}

case $pattern in
  testrear)
    rear_left
sleep $time_on
rear_left
sleep $time_on
    rear_right
    sleep $time_on
    rear_right
sleep $time_on
rear_left
rear_right
sleep $time_on
rear_left
rear_right
    ;;
  testfront)
    green
    sleep 1
    green
    blue
    sleep 1
    blue
    red
    sleep 1
    red
    ;;
  testwhite)
    red
    green
    blue
    sleep 1
    red
    green
    blue
    ;;
  flashtorch)
    flashtorch
    ;;
esac
AT&T LG G2 - 4.3, AOKP
Samsung Note i717 - 4.2.2, Unofficial AOKP
Nexus 7 Wifi 2012 - 4.4.2, Stock Rooted (m-kernel)
Try my Alternative XDA CSS Themes (including 2010!)

--
http://theblackmoor.net
http://unlimitedphoto.com