sysfs.hpp (75e56c67a10e9f4c617f9c72a87deb695322e212) | sysfs.hpp (043d32306e00484afc446a44789b61869ea14f84) |
---|---|
1#pragma once 2 3#include <chrono> 4#include <exception> 5#include <fstream> 6#include <string> 7 | 1#pragma once 2 3#include <chrono> 4#include <exception> 5#include <fstream> 6#include <string> 7 |
8namespace sysfs { | 8namespace sysfs 9{ |
9 10inline std::string make_sysfs_path(const std::string& path, 11 const std::string& type, 12 const std::string& id, 13 const std::string& entry) 14{ 15 using namespace std::literals; 16 | 10 11inline std::string make_sysfs_path(const std::string& path, 12 const std::string& type, 13 const std::string& id, 14 const std::string& entry) 15{ 16 using namespace std::literals; 17 |
17 if (entry.empty()) { | 18 if (entry.empty()) 19 { |
18 return path + "/"s + type + id; 19 } 20 21 return path + "/"s + type + id + "_"s + entry; 22} 23 24/** @brief Return the path to the phandle file matching value in io-channels. 25 * --- 4 unchanged lines hidden (view full) --- 30 * The 4 byte phandle value and 4 byte index value is read from io-channels. 31 * When a match is found, the path to the matching phandle file is returned. 32 * 33 * @param[in] iochanneldir - Path to file for getting phandle from io-channels 34 * @param[in] phandledir - Path to use for reading from phandle file 35 * 36 * @return Path to phandle file with value matching that in io-channels 37 */ | 20 return path + "/"s + type + id; 21 } 22 23 return path + "/"s + type + id + "_"s + entry; 24} 25 26/** @brief Return the path to the phandle file matching value in io-channels. 27 * --- 4 unchanged lines hidden (view full) --- 32 * The 4 byte phandle value and 4 byte index value is read from io-channels. 33 * When a match is found, the path to the matching phandle file is returned. 34 * 35 * @param[in] iochanneldir - Path to file for getting phandle from io-channels 36 * @param[in] phandledir - Path to use for reading from phandle file 37 * 38 * @return Path to phandle file with value matching that in io-channels 39 */ |
38std::string findPhandleMatch( 39 const std::string& iochanneldir, 40 const std::string& phandledir); | 40std::string findPhandleMatch(const std::string& iochanneldir, 41 const std::string& phandledir); |
41 42/** @brief Find hwmon instances from an open-firmware device tree path 43 * 44 * Look for a matching hwmon instance given an 45 * open firmware device path. 46 * 47 * @param[in] ofNode- The open firmware device path. 48 * --- 32 unchanged lines hidden --- | 42 43/** @brief Find hwmon instances from an open-firmware device tree path 44 * 45 * Look for a matching hwmon instance given an 46 * open firmware device path. 47 * 48 * @param[in] ofNode- The open firmware device path. 49 * --- 32 unchanged lines hidden --- |