mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
PhysicalMemory: make sure to detect all memory devices
This commit is contained in:
@@ -23,6 +23,12 @@ static inline const char* getVendorString(unsigned vendorId)
|
||||
|
||||
void FFPhysicalMemoryUpdateVendorString(FFPhysicalMemoryResult* device)
|
||||
{
|
||||
if (ffStrbufEqualS(&device->vendor, "Unknown"))
|
||||
{
|
||||
ffStrbufClear(&device->vendor);
|
||||
return;
|
||||
}
|
||||
|
||||
char vendorIdStr[5];
|
||||
if (ffStrbufStartsWithS(&device->vendor, "0x"))
|
||||
{
|
||||
|
||||
@@ -75,10 +75,10 @@ const char* ffDetectPhysicalMemory(FFlist* result)
|
||||
if (!data)
|
||||
return "Memory device is not found in SMBIOS data";
|
||||
|
||||
for (; data->Header.Type == FF_SMBIOS_TYPE_MEMORY_DEVICE;
|
||||
data = (const FFSmbiosMemoryDevice*) ffSmbiosNextEntry(&data->Header))
|
||||
for (; data->Header.Type < FF_SMBIOS_TYPE_END_OF_TABLE;
|
||||
data = (const FFSmbiosMemoryDevice*) ffSmbiosNextEntry(&data->Header))
|
||||
{
|
||||
if (data->Size == 0) continue;
|
||||
if (data->Header.Type != FF_SMBIOS_TYPE_MEMORY_DEVICE || data->Size == 0) continue;
|
||||
|
||||
const char* strings = (const char*) data + data->Header.Length;
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ void ffPrintPhysicalMemory(FFPhysicalMemoryOptions* options)
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.length == 0)
|
||||
{
|
||||
ffPrintError(FF_PHYSICALMEMORY_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No physical memory detected");
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY prettySize = ffStrbufCreate();
|
||||
|
||||
uint32_t i = 0;
|
||||
|
||||
Reference in New Issue
Block a user