mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
SunOS: make SMBIOS related modules work
This commit is contained in:
parent
d35490aeef
commit
d727547b1c
@ -743,11 +743,11 @@ elseif(SunOS)
|
||||
src/common/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_nosupport.c
|
||||
src/detection/bios/bios_nosupport.c
|
||||
src/detection/board/board_nosupport.c
|
||||
src/detection/bios/bios_windows.c
|
||||
src/detection/board/board_windows.c
|
||||
src/detection/bootmgr/bootmgr_nosupport.c
|
||||
src/detection/brightness/brightness_nosupport.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/chassis/chassis_windows.c
|
||||
src/detection/cpu/cpu_nosupport.c
|
||||
src/detection/cpucache/cpucache_nosupport.c
|
||||
src/detection/cpuusage/cpuusage_nosupport.c
|
||||
@ -756,7 +756,7 @@ elseif(SunOS)
|
||||
src/detection/disk/disk_nosupport.c
|
||||
src/detection/dns/dns_linux.c
|
||||
src/detection/physicaldisk/physicaldisk_nosupport.c
|
||||
src/detection/physicalmemory/physicalmemory_nosupport.c
|
||||
src/detection/physicalmemory/physicalmemory_linux.c
|
||||
src/detection/diskio/diskio_nosupport.c
|
||||
src/detection/displayserver/linux/displayserver_linux.c
|
||||
src/detection/displayserver/linux/drm.c
|
||||
@ -771,8 +771,8 @@ elseif(SunOS)
|
||||
src/detection/gpu/gpu_nosupport.c
|
||||
src/detection/gpu/gpu_pci.c
|
||||
src/detection/gtk_qt/gtk.c
|
||||
src/detection/host/host_nosupport.c
|
||||
src/detection/icons/icons_nosupport.c
|
||||
src/detection/host/host_windows.c
|
||||
src/detection/icons/icons_linux.c
|
||||
src/detection/initsystem/initsystem_nosupport.c
|
||||
src/detection/libc/libc_nosupport.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "bios.h"
|
||||
#include "util/smbiosHelper.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "util/windows/registry.h"
|
||||
|
||||
#include <ntstatus.h>
|
||||
@ -25,7 +27,7 @@ typedef struct _SYSTEM_BOOT_ENVIRONMENT_INFORMATION
|
||||
};
|
||||
};
|
||||
} SYSTEM_BOOT_ENVIRONMENT_INFORMATION;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct FFSmbiosBios
|
||||
{
|
||||
@ -74,6 +76,7 @@ const char* ffDetectBios(FFBiosResult* bios)
|
||||
if (data->Header.Length > offsetof(FFSmbiosBios, SystemBiosMajorRelease))
|
||||
ffStrbufSetF(&bios->release, "%u.%u", data->SystemBiosMajorRelease, data->SystemBiosMinorRelease);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Same as GetFirmwareType, but support (?) Windows 7
|
||||
// https://ntdoc.m417z.com/system_information_class
|
||||
SYSTEM_BOOT_ENVIRONMENT_INFORMATION sbei;
|
||||
@ -86,6 +89,7 @@ const char* ffDetectBios(FFBiosResult* bios)
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -48,16 +48,19 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
|
||||
return (const FFSmbiosHeader*) (p + 1);
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include "common/properties.h"
|
||||
#else
|
||||
#elif defined(__FreeBSD__)
|
||||
#include "common/settings.h"
|
||||
#define loff_t off_t // FreeBSD doesn't have loff_t
|
||||
#elif defined(__sun)
|
||||
#define loff_t off_t
|
||||
#endif
|
||||
|
||||
bool ffGetSmbiosValue(const char* devicesPath, const char* classPath, FFstrbuf* buffer)
|
||||
@ -134,11 +137,12 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
|
||||
#endif
|
||||
{
|
||||
#ifndef __sun
|
||||
FF_STRBUF_AUTO_DESTROY strEntryAddress = ffStrbufCreate();
|
||||
#ifdef __FreeBSD__
|
||||
if (!ffSettingsGetFreeBSDKenv("hint.smbios.0.mem", &strEntryAddress))
|
||||
return NULL;
|
||||
#else
|
||||
#elif defined(__linux__)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY systab = ffStrbufCreate();
|
||||
if (!ffAppendFileBuffer("/sys/firmware/efi/systab", &systab))
|
||||
@ -165,6 +169,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
memcpy(&entryPoint, p, sizeof(entryPoint));
|
||||
munmap(p, sizeof(entryPoint));
|
||||
}
|
||||
#else
|
||||
FF_AUTO_CLOSE_FD int fd = open("/dev/smbios", O_RDONLY);
|
||||
if (fd < 0) return NULL;
|
||||
|
||||
FFSmbiosEntryPoint entryPoint;
|
||||
if (!ffReadFDData(fd, sizeof(entryPoint), &entryPoint)) return NULL;
|
||||
#endif
|
||||
|
||||
uint32_t tableLength = 0;
|
||||
loff_t tableAddress = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user