summaryrefslogtreecommitdiff
path: root/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh')
-rwxr-xr-x[-rw-r--r--]meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh14
1 files changed, 6 insertions, 8 deletions
diff --git a/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh b/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh
index 65bff9dc1..37a3ce301 100644..100755
--- a/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh
+++ b/meta-ampere/meta-jade/recipes-phosphor/gpio/psu-hotswap-reset/ampere_psu_reset_hotswap.sh
@@ -29,10 +29,10 @@ STATUS_MFR_SPECIFIC=0x80
# $1 will be the name of the psu
PSU=$1
-if [[ $PSU == 1 ]]; then
+if [ "$PSU" = 1 ]; then
HSC_PMBUS_NUM=$HSC1_PMBUS_NUM
HSC_SLAVE_ADDR=$HSC1_SLAVE_ADDR
-elif [[ $PSU == 2 ]]; then
+elif [ "$PSU" = 2 ]; then
HSC_PMBUS_NUM=$HSC2_PMBUS_NUM
HSC_SLAVE_ADDR=$HSC2_SLAVE_ADDR
else
@@ -43,22 +43,20 @@ fi
# Check HOST state
chassisstate=$(obmcutil chassisstate | awk -F. '{print $NF}')
-if [[ "$chassisstate" == 'Off' ]]; then
+if [ "$chassisstate" = 'Off' ]; then
echo "HOST is being OFF, so can't access the i2c $HSC_PMBUS_NUM. Please Turn ON HOST !"
exit 1
fi
# Check FET health problems
-data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC)
-
-if [[ $? -ne 0 ]]; then
+if ! data=$(i2cget -f -y $HSC_PMBUS_NUM $HSC_SLAVE_ADDR $STATUS_MFR_SPECIFIC); then
echo "ERROR: Can't access the i2c. Please check /dev/i2c-$HSC_PMBUS_NUM"
exit 1
fi
psu_sts=$(((data & 0x80) != 0))
-if [[ $psu_sts == 1 ]]; then
+if [ $psu_sts = 1 ]; then
echo "PSU $PSU: FET health problems have been detected"
echo "Reset Hot swap output on PSU $PSU"
# Disable Hot swap output
@@ -71,4 +69,4 @@ if [[ $psu_sts == 1 ]]; then
else
echo "PSU $PSU: FET health problems have not been detected"
-fi \ No newline at end of file
+fi