mirror of https://github.com/hak5/openwrt.git
leds: support oneshot as well as timer triggers
oneshot and timer have the same configuration options, just a different trigger name. Signed-off-by: Karl Palsson <karlp@etactica.com> SVN-Revision: 48770lede-17.01
parent
56714adb4b
commit
c0c3f2d4c9
|
@ -303,11 +303,11 @@ generate_led() {
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
timer)
|
timer|oneshot)
|
||||||
local delayon delayoff
|
local delayon delayoff
|
||||||
json_get_vars delayon delayoff
|
json_get_vars delayon delayoff
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
set system.$cfg.trigger='timer'
|
set system.$cfg.trigger='$type'
|
||||||
set system.$cfg.delayon='$delayon'
|
set system.$cfg.delayon='$delayon'
|
||||||
set system.$cfg.delayoff='$delayoff'
|
set system.$cfg.delayoff='$delayoff'
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -478,17 +478,18 @@ ucidef_set_led_ide() {
|
||||||
json_select ..
|
json_select ..
|
||||||
}
|
}
|
||||||
|
|
||||||
ucidef_set_led_timer() {
|
__ucidef_set_led_timer() {
|
||||||
local cfg="led_$1"
|
local cfg="led_$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
local sysfs="$3"
|
local sysfs="$3"
|
||||||
local delayon="$4"
|
local trigger="$4"
|
||||||
local delayoff="$5"
|
local delayon="$5"
|
||||||
|
local delayoff="$6"
|
||||||
|
|
||||||
json_select_object led
|
json_select_object led
|
||||||
|
|
||||||
json_select_object "$1"
|
json_select_object "$1"
|
||||||
json_add_string type timer
|
json_add_string type "$trigger"
|
||||||
json_add_string name "$name"
|
json_add_string name "$name"
|
||||||
json_add_string sysfs "$sysfs"
|
json_add_string sysfs "$sysfs"
|
||||||
json_add_int delayon "$delayon"
|
json_add_int delayon "$delayon"
|
||||||
|
@ -498,6 +499,14 @@ ucidef_set_led_timer() {
|
||||||
json_select ..
|
json_select ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ucidef_set_led_oneshot() {
|
||||||
|
__ucidef_set_led_timer $1 $2 $3 "oneshot" $4 $5
|
||||||
|
}
|
||||||
|
|
||||||
|
ucidef_set_led_timer() {
|
||||||
|
__ucidef_set_led_timer $1 $2 $3 "timer" $4 $5
|
||||||
|
}
|
||||||
|
|
||||||
ucidef_set_led_rssi() {
|
ucidef_set_led_rssi() {
|
||||||
local cfg="led_$1"
|
local cfg="led_$1"
|
||||||
local name="$2"
|
local name="$2"
|
||||||
|
|
Loading…
Reference in New Issue