mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 09:58:03 +02:00
Smbios (Haiku): add support; enable related modules
This commit is contained in:
+6
-6
@@ -1124,14 +1124,14 @@ elseif(Haiku)
|
||||
src/common/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_haiku.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/btrfs/btrfs_nosupport.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/chassis/chassis_windows.c
|
||||
src/detection/cpu/cpu_haiku.c
|
||||
src/detection/cpucache/cpucache_nosupport.c
|
||||
src/detection/cpucache/cpucache_shared.c
|
||||
src/detection/cpuusage/cpuusage_nosupport.c
|
||||
src/detection/cursor/cursor_nosupport.c
|
||||
src/detection/bluetooth/bluetooth_nosupport.c
|
||||
@@ -1139,14 +1139,14 @@ elseif(Haiku)
|
||||
src/detection/disk/disk_haiku.cpp
|
||||
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/displayserver_haiku.cpp
|
||||
src/detection/font/font_haiku.cpp
|
||||
src/detection/gpu/gpu_haiku.c
|
||||
src/detection/gpu/gpu_pci.c
|
||||
src/detection/gtk_qt/gtk.c
|
||||
src/detection/host/host_nosupport.c
|
||||
src/detection/host/host_windows.c
|
||||
src/detection/icons/icons_nosupport.c
|
||||
src/detection/initsystem/initsystem_linux.c
|
||||
src/detection/keyboard/keyboard_nosupport.c
|
||||
|
||||
+46
-1
@@ -50,7 +50,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
|
||||
return (const FFSmbiosHeader*) (p + 1);
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__HAIKU__)
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -135,6 +135,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
|
||||
if (buffer.chars == NULL)
|
||||
{
|
||||
#ifndef __HAIKU__
|
||||
#ifdef __linux__
|
||||
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
|
||||
#endif
|
||||
@@ -216,6 +217,50 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
munmap(p, tableLength);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
uint32_t tableLength = 0;
|
||||
off_t tableAddress = 0;
|
||||
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
FF_AUTO_FREE uint8_t* smBiosBase = malloc(0x10000);
|
||||
if (pread(fd, smBiosBase, 0x10000, 0xF0000) != 0x10000)
|
||||
return NULL;
|
||||
|
||||
for (off_t offset = 0; offset <= 0xffe0; offset += 0x10)
|
||||
{
|
||||
FFSmbiosEntryPoint* p = (void*)(smBiosBase + offset);
|
||||
if (memcmp(p, "_SM3_", sizeof(p->Smbios30.AnchorString)) == 0)
|
||||
{
|
||||
if (p->Smbios30.EntryPointLength != sizeof(p->Smbios30))
|
||||
return NULL;
|
||||
tableLength = p->Smbios30.StructureTableMaximumSize;
|
||||
tableAddress = (off_t) p->Smbios30.StructureTableAddress;
|
||||
break;
|
||||
}
|
||||
else if (memcmp(p, "_SM_", sizeof(p->Smbios20.AnchorString)) == 0)
|
||||
{
|
||||
if (p->Smbios20.EntryPointLength != sizeof(p->Smbios20))
|
||||
return NULL;
|
||||
tableLength = p->Smbios20.StructureTableLength;
|
||||
tableAddress = (off_t) p->Smbios20.StructureTableAddress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tableLength == 0)
|
||||
return NULL;
|
||||
|
||||
ffStrbufEnsureFixedLengthFree(&buffer, tableLength);
|
||||
if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength)
|
||||
{
|
||||
buffer.length = tableLength;
|
||||
buffer.chars[buffer.length] = '\0';
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (
|
||||
const FFSmbiosHeader* header = (const FFSmbiosHeader*) buffer.chars;
|
||||
|
||||
Reference in New Issue
Block a user