#include #include #include #include using namespace std; namespace fs = std::filesystem; vector> PWMControlFacade::PWMControls() { vector> controls; const regex re_ctrl_enable("pwm[0-9]_enable"); const regex re_ctrl_mode("pwm[0-9]_mode"); const regex re_ctrl("pwm[0-9]"); if (!fs::exists(HWMON_BASE_PATH)) { cout << HWMON_BASE_PATH << " doesn't exist" << endl; } else { for (const fs::directory_entry &hwmon_device : fs::directory_iterator{HWMON_BASE_PATH}) { for (const fs::directory_entry &control : fs::directory_iterator{hwmon_device}) { auto filename = control.path().filename().string(); if (regex_match(filename, re_ctrl)) { auto controlPath = control.path().string(); controls.push_back(make_shared(controlPath)); } } } } return controls; }