diff options
Diffstat (limited to 'meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon')
5 files changed, 47 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules new file mode 100644 index 0000000000..503b2d002b --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="hwmon", ACTION=="add", RUN="/usr/bin/start_hwmon.sh start %p %E{OF_FULLNAME}" +SUBSYSTEM=="hwmon", ACTION=="remove", RUN="/usr/bin/start_hwmon.sh stop %p %E{OF_FULLNAME}" diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-iio.rules b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-iio.rules new file mode 100644 index 0000000000..45fb4b0fb6 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/70-iio.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="iio", ACTION=="add", RUN="/usr/bin/start_hwmon.sh start %p %E{OF_FULLNAME}" +SUBSYSTEM=="iio", ACTION=="remove", RUN="/usr/bin/start_hwmon.sh stop %p %E{OF_FULLNAME}" diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/phosphor-max31785-msl@.service b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/phosphor-max31785-msl@.service new file mode 100644 index 0000000000..d9de6c0810 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/phosphor-max31785-msl@.service @@ -0,0 +1,11 @@ +[Unit] +Description=Phosphor MAX31785 MSL +ConditionFileNotEmpty={envfiledir}/obmc/hwmon-max31785/%I.conf +Wants=mapper-wait@-xyz-openbmc_project-inventory.service +After=mapper-wait@-xyz-openbmc_project-inventory.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/env max31785-msl -p "${{PATHS}}" -b ${{BUS}} -r ${{REVISION}} +EnvironmentFile={envfiledir}/obmc/hwmon-max31785/%I.conf +SyslogIdentifier=max31785-msl diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/start_hwmon.sh b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/start_hwmon.sh new file mode 100755 index 0000000000..cde0f96ca6 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/start_hwmon.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +action=$1 +devpath=$2 +of_fullname=$3 + +#Use of_fullname if it's there, otherwise use devpath. + +path=$of_fullname +if [ -z "$path" ] +then + path=$devpath + + if [[ "$path" =~ (.*)/hwmon/hwmon[0-9]+$ ]]; + then + path=${BASH_REMATCH[1]} + fi +fi + +path="${path//:/--}" + +systemctl $action 'xyz.openbmc_project.Hwmon@'$path'.service' diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service new file mode 100644 index 0000000000..9d3e2635e3 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service @@ -0,0 +1,10 @@ +[Unit] +Description=Phosphor Hwmon Poller +ConditionFileNotEmpty=/etc/default/obmc/hwmon/%I.conf +After=xyz.openbmc_project.ObjectMapper.service + +[Service] +Restart=on-failure +ExecStart=/usr/bin/env phosphor-hwmon-readd -o %f +SyslogIdentifier=phosphor-hwmon-readd +EnvironmentFile=/etc/default/obmc/hwmon/%I.conf |