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>
openwrt-18.06
Mathias Kresin 2018-01-26 23:36:50 +01:00
parent 64fef8f901
commit 4f4fc993db
1 changed files with 4 additions and 1 deletions

View File

@ -8,7 +8,10 @@ get_dt_led() {
local nodepath="$basepath/aliases/led-$1" local nodepath="$basepath/aliases/led-$1"
[ -f "$nodepath" ] && ledpath=$(cat "$nodepath") [ -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" echo "$label"
} }