Smbios (OpenBSD): add support for legency BIOS

This commit is contained in:
李通洲
2025-03-23 10:36:15 +08:00
parent ab1bfffbd4
commit a3f50f32bf
3 changed files with 16 additions and 9 deletions
+6 -5
View File
@@ -817,22 +817,22 @@ elseif(OpenBSD)
src/common/processing_linux.c
src/common/sysctl.c
src/detection/battery/battery_obsd.c
src/detection/bios/bios_nosupport.c
src/detection/bios/bios_windows.c
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/board/board_nosupport.c
src/detection/board/board_windows.c
src/detection/bootmgr/bootmgr_nosupport.c
src/detection/brightness/brightness_obsd.c
src/detection/btrfs/btrfs_nosupport.c
src/detection/chassis/chassis_nosupport.c
src/detection/chassis/chassis_windows.c
src/detection/cpu/cpu_obsd.c
src/detection/cpucache/cpucache_nosupport.c
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_bsd.c
src/detection/cursor/cursor_linux.c
src/detection/disk/disk_bsd.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_obsd.c
src/detection/displayserver/linux/displayserver_linux.c
src/detection/displayserver/linux/drm.c
@@ -889,6 +889,7 @@ elseif(OpenBSD)
src/detection/zpool/zpool_nosupport.c
src/util/platform/FFPlatform_unix.c
src/util/binary_linux.c
src/util/smbiosHelper.c
)
elseif(APPLE)
list(APPEND LIBFASTFETCH_SRC
+1 -1
View File
@@ -89,7 +89,7 @@ const char* ffDetectBios(FFBiosResult* bios)
default: break;
}
}
#elif __HAIKU__
#elif __HAIKU__ || __OpenBSD__
// Currently SMBIOS detection is supported in legency BIOS only
ffStrbufSetStatic(&bios->type, "BIOS");
#endif
+9 -3
View File
@@ -50,7 +50,7 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
return (const FFSmbiosHeader*) (p + 1);
}
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__) || defined(__OpenBSD__)
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
@@ -139,7 +139,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
if (buffer.chars == NULL)
{
ffStrbufInit(&buffer);
#ifndef __HAIKU__
#if !__HAIKU__ && !__OpenBSD__
#ifdef __linux__
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
#endif
@@ -233,7 +233,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
{
uint32_t tableLength = 0;
off_t tableAddress = 0;
FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY);
FF_AUTO_CLOSE_FD int fd = open(
#if __HAIKU__
"/dev/misc/mem"
#else
"/dev/mem"
#endif
, O_RDONLY);
if (fd < 0)
return NULL;