diff options
Diffstat (limited to 'meta-phosphor/recipes-phosphor/sensors')
9 files changed, 188 insertions, 0 deletions
diff --git a/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor.bb b/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor.bb new file mode 100644 index 0000000000..5eacac0671 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor.bb @@ -0,0 +1,20 @@ +SUMMARY = "OpenBMC sensor manager" +DESCRIPTION = "OpenBMC sensor manager." +PR = "r1" + +inherit skeleton-python +inherit obmc-phosphor-dbus-service + +VIRTUAL-RUNTIME_skeleton_workbook ?= "" + +RDEPENDS_${PN} += "\ + python-dbus \ + python-json \ + python-pygobject\ + pyphosphor \ + pyphosphor-dbus \ + ${VIRTUAL-RUNTIME_skeleton_workbook} \ + " + +SKELETON_DIR = "pysensormgr" +DBUS_SERVICE_${PN} += "org.openbmc.Sensors.service" diff --git a/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor/org.openbmc.Sensors.service b/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor/org.openbmc.Sensors.service new file mode 100644 index 0000000000..a4cb16439c --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/obmc-mgr-sensor/org.openbmc.Sensors.service @@ -0,0 +1,15 @@ +[Unit] +Description=Phosphor Sensor Manager +Wants=mapper-wait@-xyz-openbmc_project-control-power_supply_redundancy.service +After=mapper-wait@-xyz-openbmc_project-control-power_supply_redundancy.service + +[Service] +Restart=always +ExecStart=/usr/bin/env sensor_manager2.py +SyslogIdentifier=sensor_manager2.py +Type=dbus +BusName={BUSNAME} +Environment="PYTHONUNBUFFERED=1" + +[Install] +WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb new file mode 100644 index 0000000000..c6d0cba731 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon-config-mrw.bb @@ -0,0 +1,53 @@ +SUMMARY = "Phosphor hwmon configuration generator" +DESCRIPTION = "Generate phosphor-hwmon configuration from an MRW." +PR = "r1" + +inherit obmc-phosphor-license +inherit allarch +inherit mrw-xml + +DEPENDS += "mrw-perl-tools-native mrw-native" + +do_compile_append() { + ${STAGING_BINDIR_NATIVE}/perl-native/perl \ + ${STAGING_BINDIR_NATIVE}/hwmon.pl \ + -x ${mrw_datadir}/${MRW_XML} \ + -d ${WORKDIR}/mrw-config-files +} + +def find_conf_files(dir): + from fnmatch import fnmatch + myfiles = [] + + #These conf files generated by hwmon.pl are in + #subdirectories which we need to preserve the path to. + for root, dirs, files in os.walk(dir): + for name in files: + if fnmatch(name, "*.conf"): + myfiles.append(os.path.join(root, name)) + + return myfiles + +python install_conf_files() { + from shutil import copy + + conf_file_dir = os.path.join( + d.getVar("WORKDIR", True), + 'mrw-config-files') + files = find_conf_files(conf_file_dir) + + install_dir = os.path.join(d.getVar("D", True), + "etc", "default", "obmc", "hwmon") + + dir_len = len(conf_file_dir) + + for f in files: + dest = os.path.join(install_dir, f[dir_len + 1:]) + parent = os.path.dirname(dest) + if not os.path.exists(parent): + os.makedirs(parent) + + copy(f, dest) +} + +do_install[postfuncs] += "install_conf_files" diff --git a/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon.bb b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon.bb new file mode 100644 index 0000000000..fe051b57a9 --- /dev/null +++ b/meta-phosphor/recipes-phosphor/sensors/phosphor-hwmon.bb @@ -0,0 +1,53 @@ +SUMMARY = "OpenBMC hwmon poller" +DESCRIPTION = "OpenBMC hwmon poller." +PR = "r1" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=fa818a259cbed7ce8bc2a22d35a464fc" + +inherit autotools pkgconfig obmc-phosphor-systemd + +PACKAGE_BEFORE_PN = "max31785-msl" +SYSTEMD_PACKAGES = "${PN} max31785-msl" + +SYSTEMD_SERVICE_${PN} = "xyz.openbmc_project.Hwmon@.service" +SYSTEMD_SERVICE_max31785-msl = "phosphor-max31785-msl@.service" + +DEPENDS += "autoconf-archive-native" +DEPENDS += " \ + sdbusplus \ + phosphor-dbus-interfaces \ + phosphor-logging \ + " + + +RDEPENDS_${PN} += "\ + sdbusplus \ + phosphor-dbus-interfaces \ + phosphor-logging \ + bash \ + " + +RRECOMMENDS_${PN} += "${VIRTUAL-RUNTIME_phosphor-hwmon-config}" + +FILES_max31785-msl = "${bindir}/max31785-msl" +RDEPENDS_max31785-msl = "${VIRTUAL-RUNTIME_base-utils} i2c-tools" + +SRC_URI += "git://github.com/openbmc/phosphor-hwmon" +SRC_URI += "file://70-hwmon.rules" +SRC_URI += "file://70-iio.rules" +SRC_URI += "file://start_hwmon.sh" + +SRCREV = "c9c818ed854f23a87dd77c2209b6a27805825adb" + +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/ + install ${WORKDIR}/70-iio.rules ${D}/${base_libdir}/udev/rules.d/ + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/start_hwmon.sh ${D}${bindir} +} 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 |