mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 05:05:59 +01:00
Cleanup
This commit is contained in:
parent
c4576043df
commit
8880fccf1b
2 changed files with 30 additions and 37 deletions
|
@ -924,14 +924,9 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
result += "\n\n";
|
result += "\n\n";
|
||||||
|
|
||||||
int fd = open("/dev/dri/card0", O_RDONLY | O_CLOEXEC);
|
int fd = open("/dev/dri/card0", O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd > 0) {
|
||||||
throw std::runtime_error("Failed to open /dev/dri/card0");
|
|
||||||
}
|
|
||||||
drmVersion* version = drmGetVersion(fd);
|
drmVersion* version = drmGetVersion(fd);
|
||||||
if (!version) {
|
|
||||||
close(fd);
|
|
||||||
throw std::runtime_error("Failed to get DRM version");
|
|
||||||
}
|
|
||||||
const std::string name = version->name ? version->name : "Unknown";
|
const std::string name = version->name ? version->name : "Unknown";
|
||||||
const std::string description = version->desc ? version->desc : "Unknown";
|
const std::string description = version->desc ? version->desc : "Unknown";
|
||||||
std::string GPUINFO = "GPU information:\n";
|
std::string GPUINFO = "GPU information:\n";
|
||||||
|
@ -944,7 +939,9 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
|
|
||||||
if (GPUINFO.contains("NVIDIA") && std::filesystem::exists("/proc/driver/nvidia/version"))
|
if (GPUINFO.contains("NVIDIA") && std::filesystem::exists("/proc/driver/nvidia/version"))
|
||||||
result += execAndGet("cat /proc/driver/nvidia/version | grep NVRM");
|
result += execAndGet("cat /proc/driver/nvidia/version | grep NVRM");
|
||||||
|
|
||||||
result += "\n\n";
|
result += "\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
||||||
|
|
||||||
|
|
|
@ -612,27 +612,23 @@ void logSystemInfo() {
|
||||||
Debug::log(NONE, "\n");
|
Debug::log(NONE, "\n");
|
||||||
|
|
||||||
int fd = open("/dev/dri/card0", O_RDONLY | O_CLOEXEC);
|
int fd = open("/dev/dri/card0", O_RDONLY | O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd > 0) {
|
||||||
throw std::runtime_error("Failed to open /dev/dri/card0");
|
|
||||||
}
|
|
||||||
drmVersion* version = drmGetVersion(fd);
|
drmVersion* version = drmGetVersion(fd);
|
||||||
if (!version) {
|
|
||||||
close(fd);
|
|
||||||
throw std::runtime_error("Failed to get DRM version");
|
|
||||||
}
|
|
||||||
const std::string name = version->name ? version->name : "Unknown";
|
const std::string name = version->name ? version->name : "Unknown";
|
||||||
const std::string description = version->desc ? version->desc : "Unknown";
|
const std::string description = version->desc ? version->desc : "Unknown";
|
||||||
std::string GPUINFO;
|
std::string GPUINFO = "GPU information:\n";
|
||||||
GPUINFO += "GPU Type: " + name + "\n";
|
GPUINFO += "GPU Type: " + name + "\n";
|
||||||
GPUINFO += "Driver Description: " + description + "\n";
|
GPUINFO += "Driver Description: " + description + "\n";
|
||||||
|
|
||||||
Debug::log(LOG, "GPU information:\n{}\n", GPUINFO);
|
Debug::log(LOG, "{}\n", GPUINFO);
|
||||||
drmFreeVersion(version);
|
drmFreeVersion(version);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (GPUINFO.contains("NVIDIA")) {
|
if (GPUINFO.contains("NVIDIA")) {
|
||||||
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
|
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// log etc
|
// log etc
|
||||||
Debug::log(LOG, "os-release:");
|
Debug::log(LOG, "os-release:");
|
||||||
|
|
Loading…
Reference in a new issue