diff options
Diffstat (limited to 'fan_speed.cpp')
-rw-r--r-- | fan_speed.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/fan_speed.cpp b/fan_speed.cpp index 13aa266..2652f8d 100644 --- a/fan_speed.cpp +++ b/fan_speed.cpp @@ -1,9 +1,10 @@ +#include <phosphor-logging/elog-errors.hpp> +#include <xyz/openbmc_project/Control/Device/error.hpp> +#include "sensorset.hpp" +#include "env.hpp" #include "fan_speed.hpp" #include "hwmon.hpp" #include "sysfs.hpp" -#include <experimental/filesystem> -#include <phosphor-logging/elog-errors.hpp> -#include <xyz/openbmc_project/Control/Device/error.hpp> using namespace phosphor::logging; @@ -57,20 +58,15 @@ uint64_t FanSpeed::target(uint64_t value) void FanSpeed::enable() { - namespace fs = std::experimental::filesystem; - - auto fullPath = sysfs::make_sysfs_path(ioAccess.path(), - type::pwm, - id, - entry::enable); - - if (fs::exists(fullPath)) + auto enable = getEnv("ENABLE", type, id); + if (!enable.empty()) { - //This class always uses RPM mode + auto val = std::stoul(enable); + try { ioAccess.write( - enable::rpmMode, + val, type::pwm, id, entry::enable, @@ -87,6 +83,12 @@ void FanSpeed::enable() xyz::openbmc_project::Control::Device:: WriteFailure::CALLOUT_DEVICE_PATH(devPath.c_str())); + auto fullPath = sysfs::make_sysfs_path( + ioAccess.path(), + type::pwm, + id, + entry::enable); + log<level::INFO>("Logging failing sysfs file", phosphor::logging::entry("FILE=%s", fullPath.c_str())); |