Fix regex pattern for finding sensors
In case if there are sensors have a single digit and multi digit
index, findSensors() searches a sensor incorrectly. For an example,
if there are 'PWM_1' and 'PWM_16' in sensor list and it searches
'PWM_1', 'PWM_16' is returned as a matched result which is
incorrect. To fix the issue, this commit fixes regex pattern to
search sensors properly.
Tested: Tested it on a system which has multi-digit PWM sensor
index and checked that swampd initialized fan-PWM pairs
correctly.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
Change-Id: I05e8d87996e83b681f0726fa5ba02b01c08cd942
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 02903e0..228248f 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -73,7 +73,7 @@
std::vector<std::pair<std::string, std::string>>& matches)
{
std::smatch match;
- std::regex reg(search);
+ std::regex reg(search + '$');
for (const auto& sensor : sensors)
{
if (std::regex_search(sensor.first, match, reg))