add some return values to some shit so it shuts down elegantly on crash
This commit is contained in:
@@ -9,19 +9,20 @@
|
||||
|
||||
namespace cpu {
|
||||
|
||||
void detectHwmon(cpuSensors* target, const std::string& pci) {
|
||||
int detect(cpuSensors* target, const std::string& pci) {
|
||||
const std::string path = "/sys/bus/pci/devices/" + pci + "/hwmon";
|
||||
|
||||
try {
|
||||
target->hwmon = utils::getFirstDir(path);
|
||||
} catch (...) {
|
||||
applog(LOG::ERR, "NO CPU HWMON KERNEL MODULE DETECTED");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
target->module = utils::fileExists(target->hwmon + "/in1_input") ? zenpower : k10temp; // idk if this is reliable, we're trying to avoid just reading the name
|
||||
target->num_cores = std::thread::hardware_concurrency();
|
||||
applog(LOG::INF, "Detected {} cores, module enum #{} in path \"{}\"", target->num_cores, static_cast<uint8_t>(target->module), target->hwmon);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void update(cpuSensors* c) {
|
||||
|
||||
Reference in New Issue
Block a user