Skip to content

Commit 3565012

Browse files
committed
CPU (Linux): detect for model name on unknown platform
1 parent 5a04a2e commit 3565012

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/detection/cpu/cpu_linux.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -297,30 +297,22 @@ static const char* parseCpuInfo(
297297
(cpu->vendor.length == 0 && ffParsePropLine(line, "vendor_id :", &cpu->vendor)) ||
298298
(physicalCoresBuffer->length == 0 && ffParsePropLine(line, "cpu cores :", physicalCoresBuffer)) ||
299299
(cpuMHz->length == 0 && ffParsePropLine(line, "cpu MHz :", cpuMHz)) ||
300-
#endif
301-
302-
#if __arm__ || __aarch64__
300+
#elif __arm__ || __aarch64__
303301
(cpuImplementer->length == 0 && ffParsePropLine(line, "CPU implementer :", cpuImplementer)) ||
304302
(cpu->name.length == 0 && ffParsePropLine(line, "Hardware :", &cpu->name)) || //For Android devices
305-
#endif
306-
307-
#if __powerpc__ || __powerpc
303+
#elif __powerpc__ || __powerpc
308304
(cpuMHz->length == 0 && ffParsePropLine(line, "clock :", cpuMHz)) || //For POWER
309305
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) || //For POWER
310-
#endif
311-
312-
#if __mips__ || __mips
306+
#elif __mips__ || __mips
313307
(cpu->name.length == 0 && ffParsePropLine(line, "cpu model :", &cpu->name)) || //For MIPS
314-
#endif
315-
316-
#if __loongarch__
308+
#elif __loongarch__
317309
(cpu->name.length == 0 && ffParsePropLine(line, "Model Name :", &cpu->name)) ||
318310
(cpuMHz->length == 0 && ffParsePropLine(line, "CPU MHz :", cpuMHz)) ||
319-
#endif
320-
321-
#if __riscv__ || __loongarch__
311+
#elif __riscv__ || __riscv
322312
(cpuIsa->length == 0 && ffParsePropLine(line, "isa :", cpuIsa)) ||
323313
(cpuUarch->length == 0 && ffParsePropLine(line, "uarch :", cpuUarch)) ||
314+
#else
315+
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
324316
#endif
325317

326318
false

0 commit comments

Comments
 (0)