meta-quanta: gbs: boot status led action
The sys_boot_status LED would be set blinking
until host post done. When host post done, the
action of sys_boot_status would be set on
Note:
1. LED action is set in led.yaml under
"gbs-led-manager-config" directory
2. sys_boot_status LED gpio is set in kernel dts
Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: Ieaa377a74a55afbe9ede670876b2e4a2d03316f2
diff --git a/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh b/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh
new file mode 100644
index 0000000..65fc0bc
--- /dev/null
+++ b/meta-gbs/recipes-gbs/boot-status-led/files/boot-status-led.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host"
+BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/os"
+BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status"
+BOOT_Property="OperatingSystemState"
+
+LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager"
+LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive"
+LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby"
+LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group"
+LED_Property="Asserted"
+
+dbus_state=0
+boot_status=""
+check_flag=0
+
+mapper wait $LED_INACTIVE_OBJPATH
+mapper wait $LED_STANDBY_OBJPATH
+while true; do
+ boot_status=$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')
+
+ if [ $boot_status != "\"Standby\"" ] && [ $check_flag -eq 0 ];then
+ busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
+ check_flag=1
+ elif [ $boot_status == "\"Standby\"" ];then
+ busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false
+ busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
+ break
+ fi
+ sleep 1
+done
+
+exit 0