From 584d792f5a94e9a819bfa8c35d6fbd695cd72997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 29 Dec 2022 20:12:14 +0800 Subject: [PATCH 1/2] Bios: try supporting FreeBSD It prints nothing on my VM. Don't know if it works on a physical machine. --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- src/detection/bios/bios_bsd.c | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/detection/bios/bios_bsd.c diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d6c7a710..4ff4da131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ Notable Changes: Features: * Windows (7 and newer) is officially and fully supported -* FreeBSD support is improved greatly (Cpu Temp, Cpu Usage, Disk, Host, Processes, Swap, Terminal / Shell, Uptime) +* FreeBSD support is improved greatly (Bios, Cpu Temp, Cpu Usage, Disk, Host, Processes, Swap, Terminal / Shell, Uptime) * Adds a new flag `--stat`, which prints time usage for individual modules * Adds Wifi module which supports Windows and macOS * Adds data source option for logo printing diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d654b9d8..471026b9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,7 +380,7 @@ elseif(BSD) src/common/processing_linux.c src/common/sysctl.c src/detection/battery/battery_nosupport.c - src/detection/bios/bios_nosupport.c + src/detection/bios/bios_bsd.c src/detection/board/board_nosupport.c src/detection/chassis/chassis_nosupport.c src/detection/cpu/cpu_bsd.c diff --git a/src/detection/bios/bios_bsd.c b/src/detection/bios/bios_bsd.c new file mode 100644 index 000000000..8c993f0a9 --- /dev/null +++ b/src/detection/bios/bios_bsd.c @@ -0,0 +1,26 @@ +#include "bios.h" + +#include + +static void kenvLookup(const char* name, FFstrbuf* result) +{ + ffStrbufEnsureFree(result, 255); + int len = kenv(KENV_GET, name, result->chars, 256); + if(len > 0) + result->length = (uint32_t) len; +} + +void ffDetectBios(FFBiosResult* bios) +{ + ffStrbufInit(&bios->error); + ffStrbufInit(&bios->biosDate); + ffStrbufInit(&bios->biosRelease); + ffStrbufInit(&bios->biosVendor); + ffStrbufInit(&bios->biosVersion); + + //https://wiki.ghostbsd.org/index.php/Kenv + kenvLookup("smbios.bios.reldate", &bios->biosDate); + kenvLookup("smbios.system.product", &bios->biosRelease); + kenvLookup("smbios.bios.vendor", &bios->biosVendor); + kenvLookup("smbios.bios.version", &bios->biosVersion); +} From 98acd516b86e2abaee05e25c54ac04b087507c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 29 Dec 2022 20:24:30 +0800 Subject: [PATCH 2/2] CMake: bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 471026b9c..a20b980bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 1.7.5 + VERSION 1.8.0 LANGUAGES C DESCRIPTION "Fast system information tool" HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"