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