mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
base-files: add option to set LED brightness
Add option to set LED brightness via uci: config led 'led_blue' option name 'blue' option sysfs 'blue:status' option brightness '1' Signed-off-by: Paweł Owoc <frut3k7@gmail.com> Link: https://github.com/openwrt/openwrt/pull/17190 Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
parent
3710323a46
commit
cbdfd03e42
@ -51,6 +51,7 @@ load_led() {
|
|||||||
local delayon
|
local delayon
|
||||||
local delayoff
|
local delayoff
|
||||||
local interval
|
local interval
|
||||||
|
local brightness
|
||||||
|
|
||||||
config_get sysfs $1 sysfs
|
config_get sysfs $1 sysfs
|
||||||
config_get name $1 name "$sysfs"
|
config_get name $1 name "$sysfs"
|
||||||
@ -67,6 +68,7 @@ load_led() {
|
|||||||
config_get message $1 message ""
|
config_get message $1 message ""
|
||||||
config_get gpio $1 gpio "0"
|
config_get gpio $1 gpio "0"
|
||||||
config_get_bool inverted $1 inverted "0"
|
config_get_bool inverted $1 inverted "0"
|
||||||
|
config_get brightness $1 brightness
|
||||||
|
|
||||||
[ "$2" ] && [ "$sysfs" != "$2" ] && return
|
[ "$2" ] && [ "$sysfs" != "$2" ] && return
|
||||||
|
|
||||||
@ -105,7 +107,8 @@ load_led() {
|
|||||||
echo 0 >/sys/class/leds/${sysfs}/brightness
|
echo 0 >/sys/class/leds/${sysfs}/brightness
|
||||||
|
|
||||||
[ $default = 1 ] &&
|
[ $default = 1 ] &&
|
||||||
cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness
|
[ -z "$brightness" ] && brightness=$(cat /sys/class/leds/${sysfs}/max_brightness)
|
||||||
|
echo $brightness > /sys/class/leds/${sysfs}/brightness
|
||||||
|
|
||||||
led_color_set "$1" "$sysfs"
|
led_color_set "$1" "$sysfs"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user