blob: df6618cb4c149d37025acffc2b71961f13bd8eea [file] [log] [blame]
#include "fan_speed.hpp"
#include "hwmon.hpp"
#include "sysfs.hpp"
#include <experimental/filesystem>
namespace hwmon
{
uint64_t FanSpeed::target(uint64_t value)
{
auto curValue = FanSpeedObject::target();
if (curValue != value)
{
//Write target out to sysfs
curValue = writeSysfsWithCallout(value,
sysfsRoot,
instance,
type,
id,
entry::target);
}
return FanSpeedObject::target(value);
}
void FanSpeed::enable()
{
namespace fs = std::experimental::filesystem;
auto path = sysfsRoot + "/" + instance;
auto fullPath = make_sysfs_path(path,
type::pwm,
id,
entry::enable);
if (fs::exists(fullPath))
{
//This class always uses RPM mode
writeSysfsWithCallout(enable::rpmMode,
sysfsRoot,
instance,
type::pwm,
id,
entry::enable);
}
}
} // namespace hwmon