aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2018-01-26 23:36:50 +0100
committerMathias Kresin <dev@kresin.me>2018-03-14 19:04:52 +0100
commit4f4fc993db4cd074fb2b51586dadd10e882604ec (patch)
tree6223f72eda4386130381c280cd375298810c5898 /package
parent64fef8f90172cf35f9ce878390b6535f482d327b (diff)
downloadupstream-4f4fc993db4cd074fb2b51586dadd10e882604ec.tar.gz
upstream-4f4fc993db4cd074fb2b51586dadd10e882604ec.tar.bz2
upstream-4f4fc993db4cd074fb2b51586dadd10e882604ec.zip
base-files: add more name source to get_dt_led helper function
Not all LED driver are using the label devicetree property for the led name. Add support for the TI/National Semiconductor LP55xx Led Drivers, which are using the chan-name property for the led name, as fallback. Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'package')
-rw-r--r--package/base-files/files/lib/functions/leds.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/package/base-files/files/lib/functions/leds.sh b/package/base-files/files/lib/functions/leds.sh
index 83e775fada..e4423b4cc8 100644
--- a/package/base-files/files/lib/functions/leds.sh
+++ b/package/base-files/files/lib/functions/leds.sh
@@ -8,7 +8,10 @@ get_dt_led() {
local nodepath="$basepath/aliases/led-$1"
[ -f "$nodepath" ] && ledpath=$(cat "$nodepath")
- [ -n "$ledpath" ] && label=$(cat "$basepath$ledpath/label")
+ [ -n "$ledpath" ] && \
+ label=$(cat "$basepath$ledpath/label" 2>/dev/null) || \
+ label=$(cat "$basepath$ledpath/chan-name" 2>/dev/null) || \
+ echo "led label not found" 1>&2
echo "$label"
}