mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 21:50:08 +01:00
TPM: update description
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
typedef struct FFTPMResult
|
||||
{
|
||||
FFstrbuf version;
|
||||
FFstrbuf interfaceType;
|
||||
FFstrbuf description;
|
||||
} FFTPMResult;
|
||||
|
||||
const char* ffDetectTPM(FFTPMResult* result);
|
||||
|
||||
@@ -1,22 +1,24 @@
|
||||
#include "tpm.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
const char* ffDetectTPM(FF_MAYBE_UNUSED FFTPMResult* result)
|
||||
const char* ffDetectTPM(FFTPMResult* result)
|
||||
{
|
||||
if (!ffPathExists("/sys/class/tpm/tpm0", FF_PATHTYPE_DIRECTORY))
|
||||
{
|
||||
if (!ffPathExists("/sys/class/tpm", FF_PATHTYPE_DIRECTORY))
|
||||
return "TPM is not supported by kernel";
|
||||
return "TPM device is not found";
|
||||
}
|
||||
|
||||
if (ffReadFileBuffer("/sys/class/tpm/tpm0/tpm_version_major", &result->version))
|
||||
{
|
||||
ffStrbufTrimRightSpace(&result->version);
|
||||
if (ffStrbufEqualS(&result->version, "2"))
|
||||
ffStrbufSetStatic(&result->version, "2.0");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ffPathExists("/sys/class/tpm/tpm0", FF_PATHTYPE_DIRECTORY))
|
||||
{
|
||||
ffStrbufSetStatic(&result->version, "unknown");
|
||||
return NULL;
|
||||
}
|
||||
if (ffReadFileBuffer("/sys/class/tpm/tpm0/device/description", &result->description))
|
||||
ffStrbufTrimRightSpace(&result->description);
|
||||
|
||||
return "TPM device is not found";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -60,19 +60,19 @@ const char* ffDetectTPM(FFTPMResult* result)
|
||||
switch (deviceInfo.tpmInterfaceType)
|
||||
{
|
||||
case TPM_IFTYPE_1:
|
||||
ffStrbufSetStatic(&result->interfaceType, "I/O-port or MMIO");
|
||||
ffStrbufSetF(&result->description, "I/O-port or MMIO TPM %s", result->version.chars);
|
||||
break;
|
||||
case TPM_IFTYPE_TRUSTZONE:
|
||||
ffStrbufSetStatic(&result->interfaceType, "Trustzone");
|
||||
ffStrbufSetF(&result->description, "Trustzone TPM %s", result->version.chars);
|
||||
break;
|
||||
case TPM_IFTYPE_HW:
|
||||
ffStrbufSetStatic(&result->interfaceType, "HW TPM");
|
||||
ffStrbufSetF(&result->description, "HW TPM %s", result->version.chars);
|
||||
break;
|
||||
case TPM_IFTYPE_EMULATOR:
|
||||
ffStrbufSetStatic(&result->interfaceType, "SW-emulator");
|
||||
ffStrbufSetF(&result->description, "SW-emulator TPM %s", result->version.chars);
|
||||
break;
|
||||
case TPM_IFTYPE_SPB:
|
||||
ffStrbufSetStatic(&result->interfaceType, "SPB attached");
|
||||
ffStrbufSetF(&result->description, "SPB attached TPM %s", result->version.chars);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user