diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-11-17 21:58:00 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-11-17 21:58:00 +0000 |
| commit | 1ba050d603dca644aca48872f62388d794c030b9 (patch) | |
| tree | 45f4e3df5f2d79c6e89898cfb926f223fe67a463 /src/helpers/MiscFunctions.cpp | |
| parent | e8717a4fce1eafa44d5b106b8159d56e8d368840 (diff) | |
shell: propagate new machanism from hyprctl to miscfunctions
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
| -rw-r--r-- | src/helpers/MiscFunctions.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index cfaae542..6ad1b37a 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -608,7 +608,24 @@ void logSystemInfo() { #if defined(__DragonFly__) || defined(__FreeBSD__) const std::string GPUINFO = execAndGet("pciconf -lv | grep -F -A4 vga"); #elif defined(__arm__) || defined(__aarch64__) - const std::string GPUINFO = execAndGet("cat /proc/device-tree/soc*/gpu*/compatible"); + const std::string GPUINFO; + const std::filesystem::path dev_tree = "/proc/device-tree"; + try { + if (std::filesystem::exists(dev_tree) && std::filesystem::is_directory(dev_tree)) { + std::for_each(std::filesystem::directory_iterator(dev_tree), std::filesystem::directory_iterator{}, [&](const std::filesystem::directory_entry& entry) { + if (std::filesystem::is_directory(entry) && entry.path().filename().string().starts_with("soc")) { + std::for_each(std::filesystem::directory_iterator(entry.path()), std::filesystem::directory_iterator{}, [&](const std::filesystem::directory_entry& sub_entry) { + if (std::filesystem::is_directory(sub_entry) && sub_entry.path().filename().string().starts_with("gpu")) { + std::filesystem::path file_path = sub_entry.path() / "compatible"; + std::ifstream file(file_path); + if (file) + GPUINFO.append(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()); + } + }); + } + }); + } + } catch (...) { GPUINFO = "error"; } #else const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA"); #endif |
