[OpenWrt-Devel] [PATCH 2/3] base-files:fix a bug when add led timer trigger

Christian Lamparter chunkeey at gmail.com
Sat Jun 15 06:38:48 EDT 2019


On Tuesday, June 4, 2019 5:13:39 AM CEST robinson wu wrote:
> When I tried to add a led timer tirgger in "target/linux/ramips/base-files/
> etc/board.d/01_leds" like below
> ucidef_set_led_timer "system" "system" "zhuotk:green:system" "1000" "1000"
> it will be failed to add value to "delayon" and "delayoff". This commit fix this
> bug.
> 
> Signed-off-by: robinson wu <wurobinson at qq.com>
> ---
>  package/base-files/files/lib/functions/uci-defaults.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
> index 315df7b..23bde9a 100755
> --- a/package/base-files/files/lib/functions/uci-defaults.sh
> +++ b/package/base-files/files/lib/functions/uci-defaults.sh
> @@ -463,6 +463,7 @@ _ucidef_set_led_timer() {
>  
>  	_ucidef_set_led_common "$1" "$2" "$3"
>  
> +	json_add_string type timer
Hm, I think I see what's going on. Thank you for noticing this.

I see that _ucidef_set_led_timer is also used by ucidef_set_led_oneshot
which has a different type/trigger.
But package/base-files/files/bin/config_generate's
generate_led() routine's timer|oneshot type case does this:

   set system.$cfg.trigger='$type'

So in a way, for oneshot and timer the type and trigger are the same thing.
(which begs the question if we really need both or not.). But let's worry
about this some other time.

In the mean time, I think this would be a better fit and also fix
the oneshot type in the process. 

json_add_string type "$trigger_name"

>  	json_add_string trigger "$trigger_name"
>  	json_add_int delayon "$delayon"
>  	json_add_int delayoff "$delayoff"
> 

Regards,
Christian



_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list