mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
[v1.06][ARM] Implement automatic SoC inferring from device tree
This is a major change in the SoC detection methodology. Previous to this commit, the SoC (model, vendor and manufacturing process) would only appear if the exact model was found in the LUT. In other words, every supported SoC must be added manually to the LUT. This would allow to show the precise SoC model and the manufacturing process, which can only be hardcoded (i.e., it cannot be dynamically determined). This commit introduces guess_raw_soc_from_devtree, a new way of inferring the SoC. This simply reads from the compatible file in the device tree and tries to find a matching vendor to that string. If there is a match, then we simply copy the model also from the compatible string and show it directly. This new implementation will show a less "precise" SoC name and no manufacturing process because there would be no hardcoded value for that SoC. However, it improves the scalability of the SoC detection significantly because there is no longer a need to hardcode every single SoC. Lastly, there are some SoC vendors intentionally left outside the scope of this function: For now I prefer to keep updating manually the LUT for those to ensure the highest quality detection (e.g., showing precise SoC name and manufacturing process).
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "../arm/uarch.h"
|
||||
#include "../arm/midr.h"
|
||||
#include "../arm/soc.h"
|
||||
#include "../arm/socs.h"
|
||||
#include "../common/soc.h"
|
||||
#elif ARCH_RISCV
|
||||
#include "../riscv/riscv.h"
|
||||
@@ -892,6 +893,11 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
// https://github.com/Dr-Noob/cpufetch/pull/273
|
||||
// Hide manufacturing process
|
||||
#if !defined(_WIN32)
|
||||
// In the case that the model is unknown but the vendor isn't (this is, when
|
||||
// guess_raw_soc_from_devtree succeeded), do not show the manufacturing process
|
||||
// (as it will be unknown)
|
||||
if (cpu->soc->model != SOC_MODEL_UNKNOWN ||
|
||||
(cpu->soc->model == SOC_MODEL_UNKNOWN && cpu->soc->vendor == SOC_VENDOR_UNKNOWN))
|
||||
setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user