Fix index checking to support double digit index.
If hwmon sysfs has double digit pwm index, fansensor service
incorrectly creates PWM sensors so some pwm sensors are missing.
For an example, pwm1 and pwm11 are checked as Pwm_1 like below.
/sys/class/hwmon/hwmon0/pwm1 -> Pwm_1
/sys/class/hwmon/hwmon0/pwm11 -> Pwm_1
To fix the issue, this commit changes the index checking logic to
support double digits as well.
Tested: pwm11 was created as Pwm_11 and pwm1 was created as Pwm1.
Change-Id: Icfdec1ce186b22ce95e3582ac6a93285a818f596
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 232144f..1853bb8 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -442,8 +442,8 @@
for (const auto& [index, configPath, name] : pwmNumbers)
{
- if (boost::ends_with(pwm.string(),
- std::to_string(index + 1)))
+ if (pwm.filename().string() ==
+ "pwm" + std::to_string(index + 1))
{
path = &configPath;
pwmName = &name;