[OpenWrt-Devel] LEDs in system UCI config (was: Re: [PATCH 19.07] ath79: add support for gl-ar750)

Paul Fertser fercerpav at gmail.com
Sat Dec 14 10:09:50 EST 2019


On Sat, Dec 14, 2019 at 02:12:55PM +0300, Paul Fertser wrote:
> Should a uci-defaults script be added to base-files that would
> populate the system config with all the LEDs present in the DT but not
> added by board config?

cd /sys/class/leds

for i in *; do
	uci show system | grep -q sysfs=\'$i\' || {
		l=${i#*:}
		f=${l#*:}
		c=${l%:*}
		echo ucidef_set_led_default \"$f-$c\" \"$f \($c\)\" \"$i\" \"0\"
	}
done

On my DIR-615-E4 this gives:

ucidef_set_led_default "power-amber" "power (amber)" "d-link:amber:power" "0"
ucidef_set_led_default "wan-amber" "wan (amber)" "d-link:amber:wan" "0"
ucidef_set_led_default "wps-blue" "wps (blue)" "d-link:blue:wps" "0"
ucidef_set_led_default "power-green" "power (green)" "d-link:green:power" "0"
ucidef_set_led_default "wlan-green" "wlan (green)" "d-link:green:wlan" "0"

Does this make sense?

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com

_______________________________________________
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