Disable OCC active on host stop
The OCC active sensor drives the binding and unbinding
of the OCC device driver to the OCC's. Need to ensure
if the host is stopped for any reason, that the OCC
sensors are set to non-active.
Resolves openbmc/openbmc#2148
Change-Id: I5e4bc5469ddda16c961b9f46c771c101b7092cd6
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh b/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
new file mode 100755
index 0000000..0d4857c
--- /dev/null
+++ b/common/recipes-phosphor/occ/openpower-occ-control/occ-active.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# set and unset occ active for all occ's in system
+
+if [ "$1" == "disable" ]; then
+ value='false'
+elif [ "$1" == "enable" ]; then
+ value='true'
+else
+ echo "Usage: occ-active.sh [argument]"
+ echo " enable - set occ's to active state"
+ echo " disable - set occ's to inactive state"
+ exit -1
+fi
+busctl tree org.open_power.OCC.Control --list | grep occ | xargs -n1 -I{} \
+ busctl set-property org.open_power.OCC.Control {} \
+ org.open_power.OCC.Status OccActive b $value
+exit 0