You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
555 B

#!/bin/sh
usage () {
printf "usage: %s [red|green|blue|white] [0-255]\n" "$0"
exit 1
}
[ $# -lt 2 ] && usage
case "$(cut -d, -f2 < /sys/firmware/devicetree/base/compatible)" in
l8910qcom) # bq-paella
color="white"; type="kbd_backlight";;
*) # assume pinephone/pinetab
case $1 in
red|green|blue) color="$1"; type="indicator" ;;
white) color="$1"; type="flash" ;;
*) usage ;;
esac
;;
esac
if [ "$2" -lt 0 ] || [ "$2" -gt 255 ]
then
usage
fi
brightness="$2"
printf "%s\n" "$brightness" > "/sys/class/leds/$color:$type/brightness"