summaryrefslogtreecommitdiff
path: root/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh')
-rw-r--r--meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh72
1 files changed, 35 insertions, 37 deletions
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
index c8e328ac62..323be60064 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
+++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-nvme/nvme_json_rewrite.sh
@@ -4,7 +4,7 @@ TARGET_FILE_NAME="/etc/nvme/nvme_config.json"
export_gpio() {
if [ ! -d "/sys/class/gpio/gpio$1" ]; then
- echo $1 >/sys/class/gpio/export
+ echo "$1" >/sys/class/gpio/export
fi
}
@@ -18,8 +18,7 @@ if [ -d "/sys/bus/i2c/drivers/pca953x/1-0024" ]; then
presentPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0024/gpio/gpiochip*/base)"
for i in {0..15};
do
- let presentPinBase[$i]=presentPinBase+$i
- export_gpio ${presentPinBase[$i]}
+ export_gpio $(( presentPinBase + i ))
done
else
echo "Can't find present gpio expander (addr: 0x24) !!"
@@ -29,8 +28,7 @@ if [ -d "/sys/bus/i2c/drivers/pca953x/1-0021" ]; then
PwrGoodPinBase="$(cat /sys/bus/i2c/drivers/pca953x/1-0021/gpio/gpiochip*/base)"
for i in {0..15};
do
- let PwrGoodPinBase[$i]=PwrGoodPinBase+$i
- export_gpio ${PwrGoodPinBase[$i]}
+ export_gpio $(( PwrGoodPinBase + i ))
done
else
echo "Can't find powergood gpio expander (addr: 0x21) !!"
@@ -46,8 +44,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_0_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_0_locate",
- "NVMeDrivePresentPin": ${presentPinBase[3]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[3]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 3)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 3))
},
{
"NVMeDriveIndex": 1,
@@ -56,8 +54,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_1_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_1_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_1_locate",
- "NVMeDrivePresentPin": ${presentPinBase[2]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[2]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 2)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 2))
},
{
"NVMeDriveIndex": 2,
@@ -66,8 +64,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_2_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_2_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_2_locate",
- "NVMeDrivePresentPin": ${presentPinBase[1]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[1]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 1)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 1))
},
{
"NVMeDriveIndex": 3,
@@ -76,8 +74,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_3_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_3_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_3_locate",
- "NVMeDrivePresentPin": ${presentPinBase[0]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[0]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 0)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 0))
},
{
"NVMeDriveIndex": 4,
@@ -86,8 +84,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_4_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_4_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_4_locate",
- "NVMeDrivePresentPin": ${presentPinBase[7]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[7]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 7)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 7))
},
{
"NVMeDriveIndex": 5,
@@ -96,8 +94,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_5_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_5_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_5_locate",
- "NVMeDrivePresentPin": ${presentPinBase[6]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[6]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 6)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 6))
},
{
"NVMeDriveIndex": 6,
@@ -106,8 +104,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_6_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_6_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_6_locate",
- "NVMeDrivePresentPin": ${presentPinBase[5]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[5]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 5)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 5))
},
{
"NVMeDriveIndex": 7,
@@ -116,8 +114,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_7_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_7_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_7_locate",
- "NVMeDrivePresentPin": ${presentPinBase[4]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[4]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 4)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 4))
},
{
"NVMeDriveIndex": 8,
@@ -126,8 +124,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_8_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_8_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_8_locate",
- "NVMeDrivePresentPin": ${presentPinBase[11]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[11]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 11)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 11))
},
{
"NVMeDriveIndex": 9,
@@ -136,8 +134,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_9_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_9_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_9_locate",
- "NVMeDrivePresentPin": ${presentPinBase[10]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[10]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 10)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 10))
},
{
"NVMeDriveIndex": 10,
@@ -146,8 +144,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_10_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_10_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_10_locate",
- "NVMeDrivePresentPin": ${presentPinBase[9]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[9]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 9)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 9))
},
{
"NVMeDriveIndex": 11,
@@ -156,8 +154,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_11_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_11_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_11_locate",
- "NVMeDrivePresentPin": ${presentPinBase[8]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[8]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 8)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 8))
},
{
"NVMeDriveIndex": 12,
@@ -166,8 +164,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_12_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_12_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_12_locate",
- "NVMeDrivePresentPin": ${presentPinBase[15]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[15]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 15)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 15))
},
{
"NVMeDriveIndex": 13,
@@ -176,8 +174,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_13_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_13_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_13_locate",
- "NVMeDrivePresentPin": ${presentPinBase[14]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[14]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 14)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 14))
},
{
"NVMeDriveIndex": 14,
@@ -186,8 +184,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_14_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_14_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_14_locate",
- "NVMeDrivePresentPin": ${presentPinBase[13]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[13]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 13)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 13))
},
{
"NVMeDriveIndex": 15,
@@ -196,8 +194,8 @@ cat > $TARGET_FILE_NAME << EOF1
"NVMeDriveLocateLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_15_locate",
"NVMeDriveLocateLEDControllerBusName": "xyz.openbmc_project.LED.Controller.led_u2_15_locate",
"NVMeDriveLocateLEDControllerPath": "/xyz/openbmc_project/led/physical/led_u2_15_locate",
- "NVMeDrivePresentPin": ${presentPinBase[12]},
- "NVMeDrivePwrGoodPin": ${PwrGoodPinBase[12]}
+ "NVMeDrivePresentPin": $(( presentPinBase + 12)),
+ "NVMeDrivePwrGoodPin": $(( PwrGoodPinBase + 12))
}
],
"threshold": [