summaryrefslogtreecommitdiffstats
path: root/sysfs.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-03-21 16:13:27 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-03-30 02:47:11 +0000
commit4e1f30f1da6827945087857f3df7164a352ff5cf (patch)
tree81f37c537a4df3a408a91cfd54423b3db3f366c0 /sysfs.cpp
parent048ac87fa06a2a1c42f51c9f87931271a4f5a401 (diff)
downloadphosphor-hwmon-4e1f30f1da6827945087857f3df7164a352ff5cf.tar.gz
phosphor-hwmon-4e1f30f1da6827945087857f3df7164a352ff5cf.zip
Update sysfs reads
Log an error with a device callout on read failures Change-Id: Ic9cd7ce3964e49879efd4bb19f197fd6a306773c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'sysfs.cpp')
-rw-r--r--sysfs.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/sysfs.cpp b/sysfs.cpp
index 8b67f3e..389b297 100644
--- a/sysfs.cpp
+++ b/sysfs.cpp
@@ -19,6 +19,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <xyz/openbmc_project/Control/Device/error.hpp>
+#include <xyz/openbmc_project/Sensor/Device/error.hpp>
#include "sysfs.hpp"
#include "util.hpp"
@@ -81,12 +82,20 @@ int readSysfsWithCallout(const std::string& root,
// or read system calls that got us here.
auto rc = errno;
instancePath /= "device";
- phosphor::logging::log<phosphor::logging::level::ERR>(
- strerror(rc),
- phosphor::logging::entry(
- "CALLOUT_DEVICE_PATH=%s",
- fs::canonical(instancePath).c_str()),
- phosphor::logging::entry("CALLOUT_ERRNO=%d", rc));
+ using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error;
+ try
+ {
+ elog<ReadFailure>(
+ xyz::openbmc_project::Sensor::Device::
+ ReadFailure::CALLOUT_ERRNO(rc),
+ xyz::openbmc_project::Sensor::Device::
+ ReadFailure::CALLOUT_DEVICE_PATH(
+ fs::canonical(instancePath).c_str()));
+ }
+ catch (ReadFailure& elog)
+ {
+ commit(elog.name());
+ }
exit(EXIT_FAILURE);
}
OpenPOWER on IntegriCloud