From 2125ae6d1876231ae94ff28547bd5aba25463de3 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Thu, 3 Sep 2020 16:38:34 +0100 Subject: [PATCH] Do not allow LED operation to be changed unless it is already in a valid state --- raspi-config | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/raspi-config b/raspi-config index f181e22..46239f5 100755 --- a/raspi-config +++ b/raspi-config @@ -1120,14 +1120,23 @@ do_pi4video() { get_leds () { if grep -q "\\[actpwr\\]" /sys/class/leds/led0/trigger ; then echo 0 - else + elif grep -q "\\[default-on\\]" /sys/class/leds/led0/trigger ; then echo 1 + else + echo -1 fi } do_leds() { + CURRENT=$(get_leds) + if [ $CURRENT -eq -1 ] ; then + if [ "$INTERACTIVE" = True ]; then + whiptail --msgbox "The LED behaviour cannot be changed on this model of Raspberry Pi" 20 60 1 + fi + return 1 + fi DEFAULT=--defaultno - if [ $(get_leds) -eq 0 ]; then + if [ $CURRENT -eq 0 ]; then DEFAULT= fi if [ "$INTERACTIVE" = True ]; then