Skip to content

Commit c1b211c

Browse files
committed
query: gpu: fix bug of when gpu is not detected because file doesn't exist
happened when I accidentaly booted in rescue mode and then it would open /sys/class/drm/card0/device/vendor but it doesn't exists, only in /sys/class/drm/card1/device/vendor
1 parent 003f795 commit c1b211c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/query/unix/gpu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ GPU::GPU(std::uint16_t& id, std::vector<std::uint16_t>& queried_gpus)
6262
for (; i <= max_iter; i++)
6363
{
6464
sys_path = "/sys/class/drm/card" + fmt::to_string(id_iter);
65-
if (std::filesystem::exists(sys_path))
65+
if (std::filesystem::exists(sys_path + "/device/device") &&
66+
std::filesystem::exists(sys_path + "/device/vendor"))
6667
break;
6768
else
6869
id_iter++;

0 commit comments

Comments
 (0)