diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-05-19 06:06:03 -0500 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-19 13:22:37 +0000 |
commit | 54b8ebd8bc9fbf408f438a69c08a10888cb2c0ea (patch) | |
tree | 8500e2d7b470449593220ec4b8feb8792d301cef | |
parent | b161dc276dd4d2b5f036efbd1f93f071093b255c (diff) | |
download | phosphor-hwmon-54b8ebd8bc9fbf408f438a69c08a10888cb2c0ea.tar.gz phosphor-hwmon-54b8ebd8bc9fbf408f438a69c08a10888cb2c0ea.zip |
Add frequency capability to hwmon publisher
-rw-r--r-- | hwmon.hpp | 4 | ||||
-rw-r--r-- | sensorset.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
@@ -33,6 +33,7 @@ static constexpr auto ccurr = "curr"; static constexpr auto cenergy = "energy"; static constexpr auto cpower = "power"; static constexpr auto cpwm = "pwm"; +static constexpr auto cfreq = "freq"; static const std::string fan = cfan; static const std::string temp = ctemp; @@ -41,6 +42,7 @@ static const std::string curr = ccurr; static const std::string energy = cenergy; static const std::string power = cpower; static const std::string pwm = cpwm; +static const std::string freq = cfreq; } // namespace type static constexpr auto typeAttrMap = { @@ -60,6 +62,8 @@ static constexpr auto typeAttrMap = { "energy"), std::make_tuple(hwmon::type::cpower, ValueInterface::Unit::Watts, -6, "power"), + std::make_tuple(hwmon::type::cfreq, ValueInterface::Unit::MHz, 0, + "frequency"), }; inline auto getHwmonType(decltype(typeAttrMap)::const_reference attrs) diff --git a/sensorset.cpp b/sensorset.cpp index e3f4e9c..ad3cc26 100644 --- a/sensorset.cpp +++ b/sensorset.cpp @@ -24,7 +24,7 @@ // 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|power|energy|curr)([0-9]+)_([a-z]*)", std::regex::extended); + "^(fan|in|temp|power|energy|curr|freq)([0-9]+)_([a-z]*)", std::regex::extended); static const auto sensor_regex_match_count = 4; SensorSet::SensorSet(const std::string& path) |