CPU/GPU (Linux): Improves CPU/GPU temp detection accuracy on Linux/Android

This commit is contained in:
Carter Li
2025-08-28 18:58:00 +08:00
parent cace1a7156
commit 9f5046d69f
2 changed files with 35 additions and 27 deletions
+5 -5
View File
@@ -6,14 +6,14 @@
static double parseTZDir(int dfd, FFstrbuf* buffer)
{
if(!ffReadFileBufferRelative(dfd, "temp", buffer))
if (!ffReadFileBufferRelative(dfd, "type", buffer) || !ffStrbufStartsWithS(buffer, "gpu"))
return FF_GPU_TEMP_UNSET;
if (!ffReadFileBufferRelative(dfd, "temp", buffer))
return FF_GPU_TEMP_UNSET;
double value = ffStrbufToDouble(buffer, FF_GPU_TEMP_UNSET);// millidegree Celsius
if(value == FF_GPU_TEMP_UNSET)
return FF_GPU_TEMP_UNSET;
if (!ffReadFileBufferRelative(dfd, "type", buffer) || ffStrbufStartsWithS(buffer, "gpu"))
if (value == FF_GPU_TEMP_UNSET)
return FF_GPU_TEMP_UNSET;
return value / 1000.;