blob: f0910c6f7d1672a43f8d2ea6880f6dc69f6a4d0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include "fan_pwm.hpp"
#include "env.hpp"
#include "hwmon.hpp"
#include "hwmonio.hpp"
#include "sensorset.hpp"
#include "sysfs.hpp"
#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <string>
#include <xyz/openbmc_project/Control/Device/error.hpp>
using namespace phosphor::logging;
namespace hwmon
{
uint64_t FanPwm::target(uint64_t value)
{
using namespace std::literals;
std::string empty;
// Write target out to sysfs
try
{
_ioAccess->write(value, _type, _id, empty, hwmonio::retries,
hwmonio::delay);
}
catch (const std::system_error& e)
{
using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
report<WriteFailure>(
xyz::openbmc_project::Control::Device::WriteFailure::CALLOUT_ERRNO(
e.code().value()),
xyz::openbmc_project::Control::Device::WriteFailure::
CALLOUT_DEVICE_PATH(_devPath.c_str()));
auto file =
sysfs::make_sysfs_path(_ioAccess->path(), _type, _id, empty);
log<level::INFO>("Logging failing sysfs file",
phosphor::logging::entry("FILE=%s", file.c_str()));
exit(EXIT_FAILURE);
}
return FanPwmObject::target(value);
}
} // namespace hwmon
|