summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hwmon.hpp6
-rw-r--r--mainloop.cpp12
-rw-r--r--sensorset.cpp3
3 files changed, 20 insertions, 1 deletions
diff --git a/hwmon.hpp b/hwmon.hpp
index 6953492..2202df0 100644
--- a/hwmon.hpp
+++ b/hwmon.hpp
@@ -18,10 +18,16 @@ namespace type
static constexpr auto cfan = "fan";
static constexpr auto ctemp = "temp";
static constexpr auto cvolt = "in";
+static constexpr auto ccurr = "current";
+static constexpr auto cenergy = "energy";
+static constexpr auto cpower = "power";
static const std::string fan = cfan;
static const std::string temp = ctemp;
static const std::string volt = cvolt;
+static const std::string curr = ccurr;
+static const std::string energy = cenergy;
+static const std::string power = cpower;
}
}
diff --git a/mainloop.cpp b/mainloop.cpp
index 78d0b1a..7e579a8 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -46,6 +46,18 @@ static constexpr auto typeAttrMap =
hwmon::type::cvolt,
ValueInterface::Unit::Volts,
-3),
+ std::make_tuple(
+ hwmon::type::ccurr,
+ ValueInterface::Unit::Amperes,
+ -3),
+ std::make_tuple(
+ hwmon::type::cenergy,
+ ValueInterface::Unit::Joules,
+ -6),
+ std::make_tuple(
+ hwmon::type::cpower,
+ ValueInterface::Unit::Watts,
+ -6),
};
auto getHwmonType(decltype(typeAttrMap)::const_reference attrs)
diff --git a/sensorset.cpp b/sensorset.cpp
index e03e37d..b76cef7 100644
--- a/sensorset.cpp
+++ b/sensorset.cpp
@@ -22,7 +22,8 @@
// TODO: Issue#2 - STL regex generates really bloated code. Use POSIX regex
// interfaces instead.
static const std::regex sensors_regex =
- std::regex("^(fan|in|temp)([0-9]+)_([a-z]*)", std::regex::extended);
+ std::regex("^(fan|in|temp|power|energy|curr)([0-9]+)_([a-z]*)",
+ std::regex::extended);
static const auto sensor_regex_match_count = 4;
SensorSet::SensorSet(const std::string& path)
OpenPOWER on IntegriCloud