ipq806x: add support for indicating the boot and upgrade state using four leds
[lede-git/.git] / target / linux / ipq806x / base-files / lib / ipq806x.sh
index 0b11b721a751d4ef431cedcd93264168974181f6..ea45381d91c2fbedab833b76e4597ade7200dbea 100644 (file)
@@ -59,3 +59,15 @@ ipq806x_board_name() {
 
        echo "$name"
 }
+
+ipq806x_get_dt_led() {
+       local label
+       local ledpath
+       local basepath="/sys/firmware/devicetree/base"
+       local nodepath="$basepath/aliases/led-$1"
+
+       [ -f "$nodepath" ] && ledpath=$(cat "$nodepath")
+       [ -n "$ledpath" ] && label=$(cat "$basepath$ledpath/label")
+
+       echo "$label"
+}