gpu support

This commit is contained in:
2024-03-26 10:39:09 +02:00
parent 7b60e8a42f
commit 0b2b58bd33
32 changed files with 115 additions and 1186 deletions

View File

@ -27,8 +27,6 @@
#include "awdebug.h"
#include "extsysmonaggregator.h"
#include "gpuloadsource.h"
#include "hddtempsource.h"
ExtendedSysMon::ExtendedSysMon(QObject *_parent, const QVariantList &_args)
@ -53,9 +51,6 @@ void ExtendedSysMon::readConfiguration()
settings.beginGroup("Configuration");
rawConfig["ACPIPATH"] = settings.value("ACPIPATH", "/sys/class/power_supply/").toString();
rawConfig["GPUDEV"] = settings.value("GPUDEV", "auto").toString();
rawConfig["HDDDEV"] = settings.value("HDDDEV", "all").toString();
rawConfig["HDDTEMPCMD"] = settings.value("HDDTEMPCMD", "sudo smartctl -a").toString();
rawConfig["MPDADDRESS"] = settings.value("MPDADDRESS", "localhost").toString();
rawConfig["MPDPORT"] = settings.value("MPDPORT", "6600").toString();
rawConfig["MPRIS"] = settings.value("MPRIS", "auto").toString();
@ -71,31 +66,6 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
{
qCDebug(LOG_ESM) << "Raw configuration" << _rawConfig;
// gpudev
if (_rawConfig["GPUDEV"] == "disable")
;
else if (_rawConfig["GPUDEV"] == "auto")
_rawConfig["GPUDEV"] = GPULoadSource::autoGpu();
else if ((_rawConfig["GPUDEV"] != "ati") && (_rawConfig["GPUDEV"] != "nvidia"))
_rawConfig["GPUDEV"] = GPULoadSource::autoGpu();
// hdddev
auto allHddDevices = HDDTemperatureSource::allHdd();
if (_rawConfig["HDDDEV"] == "all") {
_rawConfig["HDDDEV"] = allHddDevices.join(',');
} else if (_rawConfig["HDDDEV"] == "disable") {
_rawConfig["HDDDEV"] = "";
} else {
auto deviceList = _rawConfig["HDDDEV"].split(',', Qt::SkipEmptyParts);
QStringList devices;
auto diskRegexp = QRegularExpression("^/dev/[hms]d[a-z]$");
for (auto &device : deviceList)
if ((QFile::exists(device)) && (device.contains(diskRegexp)))
devices.append(device);
if (devices.isEmpty())
_rawConfig["HDDDEV"] = allHddDevices.join(',');
else
_rawConfig["HDDDEV"] = devices.join(',');
}
// player
if ((_rawConfig["PLAYER"] != "mpd") && (_rawConfig["PLAYER"] != "mpris") && (_rawConfig["PLAYER"] != "disable"))
_rawConfig["PLAYER"] = "mpris";

View File

@ -22,9 +22,6 @@
#include "customsource.h"
#include "desktopsource.h"
#include "extsysmonsensor.h"
#include "gpuloadsource.h"
#include "gputempsource.h"
#include "hddtempsource.h"
#include "loadsource.h"
#include "networksource.h"
#include "playersource.h"
@ -66,13 +63,6 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> &_config)
// desktop
// FIXME causes segfault in kde libs
// createSensor("desktop", i18n("Desktop"), new DesktopSource(this, {}));
// gpu load
createSensor("gpuload", i18n("GPU load"), new GPULoadSource(this, {_config["GPUDEV"]}));
// gpu temperature
createSensor("gputemp", i18n("GPU temperature"), new GPUTemperatureSource(this, {_config["GPUDEV"]}));
// hdd temperature
createSensor("hdd", i18n("HDD temperature"),
new HDDTemperatureSource(this, {_config["HDDDEV"], _config["HDDTEMPCMD"]}));
// network
createSensor("network", i18n("Network"), new NetworkSource(this, {}));
// player

View File

@ -1,13 +1,6 @@
[Configuration]
# ACPI devices
ACPIPATH=/sys/class/power_supply/
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'disable' or 'auto'
GPUDEV=auto
# HDD temperature
## Set block device for hddtemp comma separated or use 'all' or 'disable'
HDDDEV=all
# cmd
HDDTEMPCMD=sudo smartctl -a
# mpd server settings
MPDADDRESS=localhost
MPDPORT=6600