summaryrefslogtreecommitdiff
path: root/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh')
-rwxr-xr-xmeta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
new file mode 100755
index 000000000..1270427a6
--- /dev/null
+++ b/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# Link in the correct MAX31785 phosphor-hwmon config file to use based on the
+# WaterCooled property, and then start the hwmon service.
+
+# $1: The OF_FULLNAME udev attribute for the MAX31785
+
+base="/etc/default/obmc/hwmon/"$1
+target=$base".conf"
+
+service=$(mapper get-service /xyz/openbmc_project/inventory/system/chassis)
+
+if [ $(busctl get-property $service \
+ /xyz/openbmc_project/inventory/system/chassis \
+ xyz.openbmc_project.Inventory.Decorator.CoolingType \
+ WaterCooled | grep true | wc -l) != 0 ];
+then
+ source=$base'_water.conf'
+else
+ source=$base'_air.conf'
+fi
+
+ln -sf $source $target
+
+instance=$(systemd-escape $1)
+systemctl start xyz.openbmc_project.Hwmon@$instance.service