From 2eea01aac3a68e5630007e3fc04fa5e3bf819394 Mon Sep 17 00:00:00 2001 From: Kushagra Kumar Date: Sat, 31 Oct 2026 02:07:37 +0530 Subject: [PATCH] GPU (Linux): pad device and revision IDs when querying amdgpu.ids In libdrm/amdgpu.ids, device IDs are formatted with 4 hex digits and revision IDs with 2 uppercase hex digits (e.g. `1681,\t0B,`). Using `%04X,\t%02X,` ensures both fields match the file syntax even when values have leading zeros. --- CHANGELOG.md | 1 + src/detection/gpu/gpu_pci.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c22d2ef91..da119ce59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased Bugfixes: +* Fixed AMD GPU name detection in amdgpu.ids when PCI device ID or revision ID has leading zeros. (GPU, Linux) * Improved uptime detection on SunOS via kstat. (#2674, Uptime, SunOS) * Fixed substring formatting returning the remaining string when a negative end index is before the start of the string. (General) diff --git a/src/detection/gpu/gpu_pci.c b/src/detection/gpu/gpu_pci.c index 2aa98745c..02f82d6a4 100644 --- a/src/detection/gpu/gpu_pci.c +++ b/src/detection/gpu/gpu_pci.c @@ -272,7 +272,7 @@ static bool loadAmdGpuIdsInc(uint16_t deviceId, uint8_t revision, FFGPUResult* g static void parseAmdGpuIdsFile(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu) { char query[32]; - snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision); + snprintf(query, ARRAY_SIZE(query), "%04X,\t%02X,", (unsigned) deviceId, (unsigned) revision); #ifdef FF_CUSTOM_AMDGPU_IDS_PATH FF_DEBUG("Searching AMD GPU IDs at custom path '%s' for device=0x%04x revision=0x%02x", FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), deviceId, revision); ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);