meta-bletchley: motor-ctrl: Change sled numbering to 1-based
switch sled to 1-based numbering to align with multi host systems
tools only accept input sled1 to sled6
Change-Id: Ic372e011716d8de7edf2eebdf8667e44b2179e64
Signed-off-by: Allen.Wang <Allen_Wang@quantatw.com>
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
index eebe50c..83d65df 100755
--- a/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/motor-ctrl/files/power-ctrl
@@ -62,9 +62,9 @@
function get_bus_num() {
SLED_NUM=$1
local bus=0
-
- if [[ "$SLED_NUM" = [0-5] ]]; then
- bus="$SLED_NUM"
+ #Mapping Sled number 1~6 to i2c bus number 0~5
+ if [[ "$SLED_NUM" = [1-6] ]]; then
+ bus=$(( SLED_NUM - 1 ))
fi
echo "$bus"
}
@@ -120,7 +120,7 @@
}
function show_usage(){
- echo "Usage: power-ctrl [sled0 | sled1 | sled2 | sled3 | sled4 | sled5] [on off ac-on ac-off status]"
+ echo "Usage: power-ctrl [sled1 | sled2 | sled3 | sled4 | sled5 | sled6] [on off ac-on ac-off status]"
echo " power-ctrl chassis-cycle"
}
@@ -142,7 +142,7 @@
exit 1;
fi
-if [[ "$1" =~ ^(slot[0-5]{1})$ ]] || [[ "$1" =~ ^(sled[0-5]{1})$ ]]; then
+if [[ "$1" =~ ^(sled[1-6]{1})$ ]]; then
SLED=$1
ACTION=$2
SLED_NUM=${SLED:4}