From 4186efb290fedef83cf5f396d655fadcc09d6f47 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Wed, 11 Jan 2017 15:30:07 -0500 Subject: Add hwmon systemd unit and udev rule The udev rule invokes phosphor-hwmon with the devicetree path of the hwmon device. The systemd unit is a templated on the devicetree path, which is forwarded directly to phosphor-hwmon. The phosphor-hwmon environment file is also templated, so environment files must be placed in a devicetree like-named directory tree under /etc/defaults/obmc/hwmon/.conf Signed-off-by: Brad Bishop Change-Id: I5001f03ace34cb4e39c82270a98c0c3c902a6e63 --- .../common/recipes-phosphor/sensors/phosphor-hwmon.bb | 11 ++++++++++- .../recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules | 1 + .../sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules create mode 100644 meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service (limited to 'meta-phosphor') diff --git a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb index f6276facb..984aabf12 100644 --- a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb +++ b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon.bb @@ -5,7 +5,9 @@ PR = "r1" LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" -inherit autotools pkgconfig +inherit autotools pkgconfig obmc-phosphor-systemd + +SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.Hwmon@.service" DEPENDS += "autoconf-archive-native" DEPENDS += "sdbusplus" @@ -15,7 +17,14 @@ RDEPENDS_${PN} += "\ " SRC_URI += "git://github.com/openbmc/phosphor-hwmon" +SRC_URI += "file://70-hwmon.rules" SRCREV = "8d89325adccbf7616e34210bb15ec3bebe17fcfe" S = "${WORKDIR}/git" + +do_install_append() { + + install -d ${D}/${base_libdir}/udev/rules.d/ + install ${WORKDIR}/70-hwmon.rules ${D}/${base_libdir}/udev/rules.d/ +} diff --git a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules new file mode 100644 index 000000000..070d88f51 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/70-hwmon.rules @@ -0,0 +1 @@ +SUBSYSTEM=="hwmon", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="xyz.openbmc_project.Hwmon@%E{OF_FULLNAME}.service" diff --git a/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service new file mode 100644 index 000000000..fcfada6c2 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/sensors/phosphor-hwmon/xyz.openbmc_project.Hwmon@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Phosphor Hwmon Poller +ConditionFileNotEmpty=/etc/default/obmc/hwmon/%I.conf + +[Service] +Restart=always +ExecStart={sbindir}/phosphor-hwmon-readd -o %f +EnvironmentFile=/etc/default/obmc/hwmon/%I.conf -- cgit v1.2.1