mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-09 08:20:20 +01:00
23 lines
675 B
C
23 lines
675 B
C
#include "tpm.h"
|
|
#include "common/sysctl.h"
|
|
#include "common/kmod.h"
|
|
|
|
const char* ffDetectTPM(FFTPMResult* result) {
|
|
if (ffSysctlGetString("dev.tpmcrb.0.%desc", &result->description) != nullptr) {
|
|
if (!ffKmodLoaded("tpm")) {
|
|
return "`tpm` kernel module is not loaded";
|
|
}
|
|
return "TPM device is not found";
|
|
}
|
|
|
|
if (ffStrbufContainS(&result->description, "2.0")) {
|
|
ffStrbufSetStatic(&result->version, "2.0");
|
|
} else if (ffStrbufContainS(&result->description, "1.2")) {
|
|
ffStrbufSetStatic(&result->version, "1.2");
|
|
} else {
|
|
ffStrbufSetStatic(&result->version, "unknown");
|
|
}
|
|
|
|
return nullptr;
|
|
}
|