mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Merge pull request #1574 from fastfetch-cli/dev
Some checks failed
CI / spellcheck (push) Has been cancelled
CI / No-features-test (push) Has been cancelled
CI / Linux-amd64 (push) Has been cancelled
CI / Linux-aarch64 (push) Has been cancelled
CI / Linux-armv7l (push) Has been cancelled
CI / Linux-armv6l (push) Has been cancelled
CI / Linux-riscv64 (push) Has been cancelled
CI / Linux-ppc64le (push) Has been cancelled
CI / Linux-s390x (push) Has been cancelled
CI / Musl-amd64 (push) Has been cancelled
CI / macOS-universal (push) Has been cancelled
CI / SunOS-amd64 (push) Has been cancelled
CI / FreeBSD-amd64 (push) Has been cancelled
CI / DragonFly-amd64 (push) Has been cancelled
CI / OpenBSD-amd64 (push) Has been cancelled
CI / NetBSD-amd64 (push) Has been cancelled
CI / Windows-amd64 (push) Has been cancelled
CI / Release (push) Has been cancelled
Some checks failed
CI / spellcheck (push) Has been cancelled
CI / No-features-test (push) Has been cancelled
CI / Linux-amd64 (push) Has been cancelled
CI / Linux-aarch64 (push) Has been cancelled
CI / Linux-armv7l (push) Has been cancelled
CI / Linux-armv6l (push) Has been cancelled
CI / Linux-riscv64 (push) Has been cancelled
CI / Linux-ppc64le (push) Has been cancelled
CI / Linux-s390x (push) Has been cancelled
CI / Musl-amd64 (push) Has been cancelled
CI / macOS-universal (push) Has been cancelled
CI / SunOS-amd64 (push) Has been cancelled
CI / FreeBSD-amd64 (push) Has been cancelled
CI / DragonFly-amd64 (push) Has been cancelled
CI / OpenBSD-amd64 (push) Has been cancelled
CI / NetBSD-amd64 (push) Has been cancelled
CI / Windows-amd64 (push) Has been cancelled
CI / Release (push) Has been cancelled
Release: v2.37.0
This commit is contained in:
commit
ff0236639a
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@ -80,7 +80,7 @@ jobs:
|
||||
run: cat /proc/cpuinfo
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev python3-requests
|
||||
run: sudo apt-get update && sudo apt-get install -y libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev
|
||||
|
||||
- name: install linuxbrew packages
|
||||
run: |
|
||||
@ -93,7 +93,7 @@ jobs:
|
||||
languages: c
|
||||
|
||||
- name: configure project
|
||||
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
@ -149,10 +149,10 @@ jobs:
|
||||
run: cat /proc/cpuinfo
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev python3-requests libchafa-dev libddcutil-dev rpm
|
||||
run: sudo apt-get update && sudo apt-get install -y libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libpulse-dev libdrm-dev libelf-dev directx-headers-dev libchafa-dev libddcutil-dev rpm
|
||||
|
||||
- name: configure project
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_INSTALL_PREFIX=/usr .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
@ -380,12 +380,12 @@ jobs:
|
||||
run: |
|
||||
cat /etc/alpine-release
|
||||
uname -a
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev py3-requests gcc g++
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev gcc g++
|
||||
shell: alpine.sh --root {0}
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -DENABLE_EMBEDDED_PCIIDS=On -GNinja .
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -GNinja .
|
||||
cmake --build . --target package --verbose -j4
|
||||
shell: alpine.sh {0}
|
||||
|
||||
@ -514,8 +514,8 @@ jobs:
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat py311-requests chafa
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On .
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat chafa
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
@ -547,10 +547,10 @@ jobs:
|
||||
prepare: |
|
||||
uname -a
|
||||
pkg update
|
||||
pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat py39-requests chafa libelf
|
||||
pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl libosmesa opencl ocl-icd v4l_compat chafa libelf
|
||||
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On .
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
@ -585,8 +585,8 @@ jobs:
|
||||
version: '7.6'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio hwdata py3-requests
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
|
||||
sudo pkg_add -r cmake git pkgconf wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 xfconf imagemagick chafa pulseaudio hwdata
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
@ -621,8 +621,8 @@ jobs:
|
||||
version: '10.1'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkgin -y install cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick pulseaudio opencl-headers ocl-icd py312-requests
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=ON .
|
||||
sudo pkgin -y install cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick pulseaudio opencl-headers ocl-icd
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
30
CHANGELOG.md
30
CHANGELOG.md
@ -1,3 +1,33 @@
|
||||
# 2.37.0
|
||||
|
||||
Changes:
|
||||
* Option `--escape-bedrock` is removed. The function is always enabled now.
|
||||
|
||||
Features:
|
||||
* Support for Haiku is greatly improved (Haiku)
|
||||
* CPU, GPU, Disk, Sound, Terminal, Terminal Font, Init System, Battery, Mouse, Keyboard, NetIO, CPU Usage, Physical Disk and OpenGL should work on Haiku now
|
||||
* SMBIOS related modules (Host, Bios, Board, Chassis, Physical Memory) should work in platforms with legacy BIOS system.
|
||||
* Support for Gamepad and Bluetooth are WIP.
|
||||
* Some bugs are found and fixed.
|
||||
* Remove `python-requests` dependency in `scripts/gen-*.py`.
|
||||
* Add cmake option `-DENABLE_EMBEDDED_AMDGPUIDS=BOOL` (disabled by default)
|
||||
* If enabled, fastfetch will embed the newest [`amdgpu.ids`](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/data/amdgpu.ids?ref_type=heads) file into fastfetch binary.
|
||||
* Weather module now honors `display.temp.unit` option (#1560, Weather)
|
||||
* Support Physical Memory module in NetBSD (PhysicalMemory, NetBSD)
|
||||
* Requires root permission
|
||||
* Improve non-intel CPU detection in NetBSD (#1573, CPU, NetBSD)
|
||||
|
||||
Bugfixes:
|
||||
* Fix building in macOS 10.13 (GPU, macOS)
|
||||
* Properly round percent values when detecting volume (#1558, Sound)
|
||||
* Fix Physical Memory module doesn't work in `--format json` mode
|
||||
* Add some missing variable inits (GPU, Linux)
|
||||
* Fix `--localip-default-route-only false` not working with `--gen-config` (#1570, LocalIP)
|
||||
|
||||
Logo:
|
||||
* Update Rosa linux
|
||||
* Add Haiku2
|
||||
|
||||
# 2.36.1
|
||||
|
||||
Changes:
|
||||
|
100
CMakeLists.txt
100
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 2.36.1
|
||||
VERSION 2.37.0
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@ -56,7 +56,7 @@ include(CheckIncludeFile)
|
||||
|
||||
include(CMakeDependentOption)
|
||||
|
||||
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD" OFF)
|
||||
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_XRANDR "Enable xrandr" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
@ -64,23 +64,23 @@ cmake_dependent_option(ENABLE_DRM "Enable libdrm" ON "LINUX OR FreeBSD OR OpenBS
|
||||
cmake_dependent_option(ENABLE_DRM_AMDGPU "Enable libdrm_amdgpu" ON "LINUX" OFF)
|
||||
cmake_dependent_option(ENABLE_GIO "Enable gio-2.0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_DCONF "Enable dconf" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_DBUS "Enable dbus-1" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_XFCONF "Enable libxfconf-0" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_SQLITE3 "Enable sqlite3" ON "LINUX OR FreeBSD OR APPLE OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_RPM "Enable rpm" ON "LINUX" OFF)
|
||||
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_IMAGEMAGICK7 "Enable imagemagick 7" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR WIN32 OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_IMAGEMAGICK6 "Enable imagemagick 6" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR APPLE OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_CHAFA "Enable chafa" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
|
||||
cmake_dependent_option(ENABLE_ZLIB "Enable zlib" ON "ENABLE_IMAGEMAGICK6 OR ENABLE_IMAGEMAGICK7" OFF)
|
||||
cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR WIN32 OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR ANDROID OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX OR FreeBSD OR OpenBSD OR NetBSD OR WIN32 OR ANDROID OR SunOS OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_FREETYPE "Enable freetype" ON "ANDROID" OFF)
|
||||
cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_DDCUTIL "Enable ddcutil" ON "LINUX" OFF)
|
||||
cmake_dependent_option(ENABLE_DIRECTX_HEADERS "Enable DirectX headers for WSL" ON "LINUX" OFF)
|
||||
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly" OFF)
|
||||
cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR DragonFly OR Haiku" OFF)
|
||||
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
|
||||
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)
|
||||
cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR OpenBSD OR SunOS" OFF)
|
||||
@ -94,6 +94,7 @@ option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by gith
|
||||
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
||||
option(INSTALL_LICENSE "Install license into /usr/share/licenses" ON)
|
||||
option(ENABLE_EMBEDDED_PCIIDS "Embed pci.ids into fastfetch, requires `python`" OFF)
|
||||
option(ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `python`" OFF)
|
||||
|
||||
set(BINARY_LINK_TYPE_OPTIONS dlopen dynamic static)
|
||||
set(BINARY_LINK_TYPE dlopen CACHE STRING "How to link fastfetch")
|
||||
@ -271,11 +272,16 @@ endif()
|
||||
|
||||
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
|
||||
if(Python_FOUND)
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/pci.ids")
|
||||
message(STATUS "'${PROJECT_BINARY_DIR}/pci.ids' is missing, downloading...")
|
||||
file(DOWNLOAD "https://pci-ids.ucw.cz/v2.2/pci.ids" "${PROJECT_BINARY_DIR}/pci.ids")
|
||||
endif()
|
||||
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py" "${PROJECT_BINARY_DIR}/pci.ids"
|
||||
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc"
|
||||
RESULT_VARIABLE PYTHON_PCIIDS_RETCODE)
|
||||
if(NOT PYTHON_PCIIDS_RETCODE EQUAL 0)
|
||||
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_pciids.c.inc")
|
||||
message(FATAL_ERROR "Failed to generate 'fastfetch_pciids.c.inc'")
|
||||
endif()
|
||||
else()
|
||||
@ -284,6 +290,26 @@ if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_pciids
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_EMBEDDED_AMDGPUIDS AND NOT EXISTS "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
|
||||
if(Python_FOUND)
|
||||
if(NOT EXISTS "${PROJECT_BINARY_DIR}/amdgpu.ids")
|
||||
message(STATUS "'${PROJECT_BINARY_DIR}/amdgpu.ids' is missing, downloading...")
|
||||
file(DOWNLOAD "https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids" "${PROJECT_BINARY_DIR}/amdgpu.ids")
|
||||
endif()
|
||||
message(STATUS "Generating 'fastfetch_amdgpuids.c.inc'")
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-amdgpuids.py" "${PROJECT_BINARY_DIR}/amdgpu.ids"
|
||||
OUTPUT_FILE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc"
|
||||
RESULT_VARIABLE PYTHON_AMDGPUIDS_RETCODE)
|
||||
if(NOT PYTHON_AMDGPUIDS_RETCODE EQUAL 0)
|
||||
file(REMOVE "${PROJECT_BINARY_DIR}/fastfetch_amdgpuids.c.inc")
|
||||
message(FATAL_ERROR "Failed to generate 'fastfetch_amdgpuids.c.inc'")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Python3 is not found, 'fastfetch_amdgpuids.c.inc' will not be generated")
|
||||
set(ENABLE_EMBEDDED_AMDGPUIDS OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Python_FOUND)
|
||||
message(STATUS "Generating 'fastfetch.1'")
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
|
||||
@ -718,13 +744,13 @@ elseif(NetBSD)
|
||||
src/detection/btrfs/btrfs_nosupport.c
|
||||
src/detection/chassis/chassis_nbsd.c
|
||||
src/detection/cpu/cpu_nbsd.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_nbsd.c
|
||||
src/detection/displayserver/linux/displayserver_linux.c
|
||||
src/detection/displayserver/linux/drm.c
|
||||
@ -1092,54 +1118,55 @@ elseif(SunOS)
|
||||
)
|
||||
elseif(Haiku)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/dbus.c
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_haiku.c
|
||||
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/battery/battery_haiku.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/cpu/cpu_nosupport.c
|
||||
src/detection/cpucache/cpucache_nosupport.c
|
||||
src/detection/cpuusage/cpuusage_nosupport.c
|
||||
src/detection/chassis/chassis_windows.c
|
||||
src/detection/cpu/cpu_haiku.c
|
||||
src/detection/cpucache/cpucache_shared.c
|
||||
src/detection/cpuusage/cpuusage_haiku.c
|
||||
src/detection/cursor/cursor_nosupport.c
|
||||
src/detection/bluetooth/bluetooth_nosupport.c
|
||||
src/detection/bluetooth/bluetooth_haiku.cpp
|
||||
src/detection/bluetoothradio/bluetoothradio_nosupport.c
|
||||
src/detection/disk/disk_nosupport.c
|
||||
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/physicaldisk/physicaldisk_haiku.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_nosupport.c
|
||||
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_nosupport.c
|
||||
src/detection/keyboard/keyboard_nosupport.c
|
||||
src/detection/initsystem/initsystem_haiku.c
|
||||
src/detection/keyboard/keyboard_haiku.cpp
|
||||
src/detection/libc/libc_nosupport.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_nosupport.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_nosupport.c
|
||||
src/detection/media/media_nosupport.c
|
||||
src/detection/gamepad/gamepad_haiku.cpp
|
||||
src/detection/media/media_linux.c
|
||||
src/detection/memory/memory_haiku.c
|
||||
src/detection/mouse/mouse_nosupport.c
|
||||
src/detection/netio/netio_nosupport.c
|
||||
src/detection/opengl/opengl_linux.c
|
||||
src/detection/mouse/mouse_haiku.cpp
|
||||
src/detection/netio/netio_haiku.cpp
|
||||
src/detection/opengl/opengl_haiku.cpp
|
||||
src/detection/os/os_haiku.c
|
||||
src/detection/packages/packages_haiku.c
|
||||
src/detection/poweradapter/poweradapter_nosupport.c
|
||||
src/detection/processes/processes_haiku.c
|
||||
src/detection/gtk_qt/qt.c
|
||||
src/detection/sound/sound_nosupport.c
|
||||
src/detection/sound/sound_haiku.cpp
|
||||
src/detection/swap/swap_haiku.c
|
||||
src/detection/terminalfont/terminalfont_linux.c
|
||||
src/detection/terminalshell/terminalshell_linux.c
|
||||
@ -1157,6 +1184,7 @@ elseif(Haiku)
|
||||
src/detection/zpool/zpool_nosupport.c
|
||||
src/util/platform/FFPlatform_unix.c
|
||||
src/util/binary_linux.c
|
||||
src/util/haiku/version.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -1511,6 +1539,9 @@ endif()
|
||||
if(ENABLE_EMBEDDED_PCIIDS)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_PCIIDS=1)
|
||||
endif()
|
||||
if(ENABLE_EMBEDDED_AMDGPUIDS)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_EMBEDDED_AMDGPUIDS=1)
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
target_link_libraries(libfastfetch
|
||||
@ -1616,6 +1647,11 @@ elseif(ANDROID)
|
||||
elseif(Haiku)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "network"
|
||||
PRIVATE "bnetapi"
|
||||
PRIVATE "media"
|
||||
PRIVATE "device"
|
||||
PRIVATE "bluetooth"
|
||||
PRIVATE "GL"
|
||||
PRIVATE "be"
|
||||
PRIVATE "gnu"
|
||||
)
|
||||
|
18
README.md
18
README.md
@ -29,6 +29,10 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
Some distros package an outdated fastfetch version. Older versions receive no support, so please try always to use the latest version.
|
||||
|
||||
<a href="https://repology.org/project/fastfetch/versions">
|
||||
<img src="https://repology.org/badge/vertical-allrepos/fastfetch.svg?columns=2" alt="Packaging status" align="right">
|
||||
</a>
|
||||
|
||||
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or newer)
|
||||
* Debian: `apt install fastfetch` (for Debian 13 or newer)
|
||||
* Debian / Ubuntu: Download `fastfetch-linux-<proper architecture>.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and double-click it (for Ubuntu 20.04 or newer and Debian 11 or newer).
|
||||
@ -47,8 +51,6 @@ Some distros package an outdated fastfetch version. Older versions receive no su
|
||||
|
||||
You may need `sudo`, `doas` or `sup` to run these commands.
|
||||
|
||||
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging).
|
||||
|
||||
If fastfetch is not packaged for your distro or an outdated version is packaged, [linuxbrew](https://brew.sh/) is a good alternative: `brew install fastfetch`
|
||||
|
||||
### macOS
|
||||
@ -95,18 +97,6 @@ Fastfetch uses the JSONC (or JSON with comments) for configuration. [See Wiki fo
|
||||
|
||||
Logos can also be heavily customized; see the [logo documentation](https://github.com/fastfetch-cli/fastfetch/wiki/Logo-options) for more information.
|
||||
|
||||
|
||||
## Packaging
|
||||
|
||||
### Repositories
|
||||
|
||||
[](https://repology.org/project/fastfetch/versions)
|
||||
|
||||
### Manual
|
||||
|
||||
* DEB / RPM package: `cmake --build . --target package`
|
||||
* Install directly: `cmake --install . --prefix /usr/local`
|
||||
|
||||
## FAQ
|
||||
|
||||
### Q: Neofetch is good enough. Why do I need fastfetch?
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
fastfetch (2.36.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.36.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 11 Feb 2025 13:39:55 +0800
|
||||
|
||||
fastfetch (2.36.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.36.0
|
||||
|
2
debian/files
vendored
2
debian/files
vendored
@ -1 +1 @@
|
||||
fastfetch_2.36.0_source.buildinfo universe/utils optional
|
||||
fastfetch_2.36.1_source.buildinfo universe/utils optional
|
||||
|
@ -817,8 +817,8 @@
|
||||
"unit": {
|
||||
"type": "string",
|
||||
"description": "Set the unit of the temperature",
|
||||
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
|
||||
"default": "C"
|
||||
"enum": ["D", "Default", "Celsius", "C", "Fahrenheit", "F", "Kelvin", "K"],
|
||||
"default": "D"
|
||||
},
|
||||
"ndigits": {
|
||||
"type": "integer",
|
||||
@ -2641,6 +2641,7 @@
|
||||
"eopkg",
|
||||
"flatpak",
|
||||
"guix",
|
||||
"hpkg",
|
||||
"linglong",
|
||||
"lpkg",
|
||||
"lpkgbuild",
|
||||
|
@ -90,6 +90,8 @@
|
||||
"sound",
|
||||
"camera",
|
||||
"gamepad",
|
||||
"mouse",
|
||||
"keyboard",
|
||||
{
|
||||
"type": "weather",
|
||||
"timeout": 1000
|
||||
|
@ -92,6 +92,8 @@
|
||||
"sound",
|
||||
"camera",
|
||||
"gamepad",
|
||||
"mouse",
|
||||
"keyboard",
|
||||
{
|
||||
"type": "weather",
|
||||
"timeout": 1000
|
||||
|
43
scripts/gen-amdgpuids.py
Executable file
43
scripts/gen-amdgpuids.py
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
def main(amdgpu_ids_path: str):
|
||||
with open(amdgpu_ids_path, 'r') as f:
|
||||
full_text = f.read()
|
||||
|
||||
products = []
|
||||
for line in full_text.split('\n'):
|
||||
if not line or line[0] == '#' or not ',\t' in line:
|
||||
continue
|
||||
device, revision, name = line.split(',\t', maxsplit=2)
|
||||
products.append((device, revision, name))
|
||||
|
||||
code = """\
|
||||
// SPDX-License-Identifier: MIT
|
||||
// https://opensource.org/license/mit
|
||||
// Generated from https://gitlab.freedesktop.org/mesa/drm/-/raw/main/data/amdgpu.ids
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct FFArmGpuProduct
|
||||
{
|
||||
const uint32_t id; // device << 8 | revision
|
||||
const char* name;
|
||||
} FFArmGpuProduct;
|
||||
|
||||
const FFArmGpuProduct ffAmdGpuProducts[] = {
|
||||
"""
|
||||
|
||||
for device, revision, name in products:
|
||||
code += f" {{ 0x{device} << 8 | 0x{revision}, \"{name}\" }},\n"
|
||||
|
||||
code += "};\n"
|
||||
|
||||
print(code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
len(sys.argv) == 2 or sys.exit('Usage: gen-amdgpuids.py </path/to/amdgpu.ids>')
|
||||
|
||||
main(sys.argv[1])
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from requests import get as http_get
|
||||
import sys
|
||||
|
||||
class PciDeviceModel:
|
||||
def __init__(self, id: int, name: str):
|
||||
@ -13,14 +13,10 @@ class PciVendorModel:
|
||||
self.name = name
|
||||
self.devices = []
|
||||
|
||||
def main(keep_vendor_list: set):
|
||||
def main(keep_vendor_list: set, pci_ids_path: str):
|
||||
vendors = []
|
||||
try:
|
||||
with open('pci.ids', 'r') as f:
|
||||
full_text = f.read()
|
||||
except FileNotFoundError:
|
||||
response = http_get('https://pci-ids.ucw.cz/v2.2/pci.ids')
|
||||
full_text = response.text
|
||||
with open(pci_ids_path, 'r') as f:
|
||||
full_text = f.read()
|
||||
|
||||
dev_list_text = full_text[:full_text.rfind('\n\n\n')] # remove known classes
|
||||
for line in dev_list_text.split('\n'):
|
||||
@ -80,6 +76,8 @@ const FFPciVendor ffPciVendors[] = {{
|
||||
print(code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
len(sys.argv) == 2 or sys.exit('Usage: gen-pciids.py </path/to/pci.ids>')
|
||||
|
||||
# From <src/detection/gpu/gpu.c>
|
||||
main({
|
||||
0x106b, # Apple
|
||||
@ -94,4 +92,4 @@ if __name__ == '__main__':
|
||||
0x1ab8, # Parallel
|
||||
0x1414, # Microsoft
|
||||
0x108e, # Oracle
|
||||
})
|
||||
}, sys.argv[1])
|
||||
|
@ -236,6 +236,9 @@ void ffListFeatures(void)
|
||||
#if FF_HAVE_FREETYPE
|
||||
"freetype\n"
|
||||
#endif
|
||||
#if FF_HAVE_PCIACCESS
|
||||
"libpciaccess\n"
|
||||
#endif
|
||||
#if FF_HAVE_PULSE
|
||||
"libpulse\n"
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ static inline bool ffPathExists(const char* path, FFPathType pathType)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if __APPLE__ // #1395
|
||||
#if (__APPLE__ || __HAIKU__) // #1395
|
||||
struct stat fileStat;
|
||||
if(stat(path, &fileStat) != 0)
|
||||
return false;
|
||||
|
@ -24,10 +24,10 @@ bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
return false;
|
||||
|
||||
int size = config.ifc_value;
|
||||
if (size == 0)
|
||||
if (size <= 0)
|
||||
return false;
|
||||
|
||||
FF_AUTO_FREE void *buffer = malloc(size);
|
||||
FF_AUTO_FREE void *buffer = malloc((size_t) size);
|
||||
if (buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
#elif defined(__NetBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#elif defined(__HAIKU__)
|
||||
#include <OS.h>
|
||||
#include <image.h>
|
||||
#endif
|
||||
|
||||
enum { FF_PIPE_BUFSIZ = 8192 };
|
||||
@ -310,6 +313,21 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
|
||||
}
|
||||
kvm_close(kd);
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
|
||||
while (get_next_image_info(pid, &cookie, &info) == B_OK)
|
||||
{
|
||||
if (info.type != B_APP_IMAGE) continue;
|
||||
ffStrbufSetS(exe, info.name);
|
||||
|
||||
if (exePath)
|
||||
ffStrbufSet(exePath, exe);
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if(exe->length == 0)
|
||||
@ -476,6 +494,18 @@ const char* ffProcessGetBasicInfoLinux(pid_t pid, FFstrbuf* name, pid_t* ppid, i
|
||||
if (!proc)
|
||||
return "kvm_getprocs() failed";
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
team_info info;
|
||||
if (get_team_info(pid, &info) == B_OK)
|
||||
{
|
||||
ffStrbufSetS(name, info.name);
|
||||
if (ppid)
|
||||
*ppid = info.parent;
|
||||
}
|
||||
|
||||
FF_UNUSED(tty);
|
||||
|
||||
#else
|
||||
|
||||
return "Unsupported platform";
|
||||
|
@ -39,6 +39,7 @@ void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig confi
|
||||
|
||||
switch (options->tempUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_DEFAULT:
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.*f°C", options->tempNdigits, celsius);
|
||||
break;
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <synchapi.h>
|
||||
#include <profileapi.h>
|
||||
#include <sysinfoapi.h>
|
||||
#elif defined(__HAIKU__)
|
||||
#include <OS.h>
|
||||
#endif
|
||||
|
||||
static inline double ffTimeGetTick(void) //In msec
|
||||
@ -17,6 +19,8 @@ static inline double ffTimeGetTick(void) //In msec
|
||||
LARGE_INTEGER start;
|
||||
QueryPerformanceCounter(&start);
|
||||
return (double) start.QuadPart * 1000 / (double) frequency.QuadPart;
|
||||
#elif defined(__HAIKU__)
|
||||
return (double) system_time() / 1000.;
|
||||
#else
|
||||
struct timespec timeNow;
|
||||
clock_gettime(CLOCK_MONOTONIC, &timeNow);
|
||||
@ -30,6 +34,8 @@ static inline uint64_t ffTimeGetNow(void)
|
||||
uint64_t timeNow;
|
||||
GetSystemTimeAsFileTime((FILETIME*) &timeNow);
|
||||
return (timeNow - 116444736000000000ull) / 10000ull;
|
||||
#elif defined(__HAIKU__)
|
||||
return (uint64_t) real_time_clock_usecs() / 1000u;
|
||||
#else
|
||||
struct timespec timeNow;
|
||||
clock_gettime(CLOCK_REALTIME, &timeNow);
|
||||
|
@ -104,16 +104,6 @@
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "escape-bedrock",
|
||||
"desc": "On Bedrock Linux, whether to escape the bedrock jail",
|
||||
"remark": "Linux only",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "wmi-timeout",
|
||||
"desc": "Set the timeout (ms) for WMI queries",
|
||||
@ -732,11 +722,12 @@
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
"enum": {
|
||||
"D": "Default",
|
||||
"C": "Celsius",
|
||||
"F": "Fahrenheit",
|
||||
"K": "Kelvin"
|
||||
},
|
||||
"default": "C"
|
||||
"default": "D"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
60
src/detection/battery/battery_haiku.c
Normal file
60
src/detection/battery/battery_haiku.c
Normal file
@ -0,0 +1,60 @@
|
||||
#include "fastfetch.h"
|
||||
#include "battery.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <private/device/power_managment.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
const char* parseBattery(int dfd, const char* battId, FFlist* results)
|
||||
{
|
||||
FF_AUTO_CLOSE_FD int fd = openat(dfd, battId, O_RDWR);
|
||||
if (fd < 0) return "openat() failed";
|
||||
|
||||
acpi_battery_info basic = {};
|
||||
if (ioctl(fd, GET_BATTERY_INFO, &basic, sizeof(basic)) != 0)
|
||||
return "ioctl(GET_BATTERY_INFO) failed";
|
||||
acpi_extended_battery_info extended = {};
|
||||
if (ioctl(fd, GET_EXTENDED_BATTERY_INFO, &extended, sizeof(extended)) != 0)
|
||||
return "ioctl(GET_EXTENDED_BATTERY_INFO) failed";
|
||||
|
||||
FFBatteryResult* battery = (FFBatteryResult*)ffListAdd(results);
|
||||
ffStrbufInitS(&battery->modelName, extended.model_number);
|
||||
ffStrbufInitS(&battery->manufacturer, extended.oem_info);
|
||||
ffStrbufInit(&battery->manufactureDate);
|
||||
ffStrbufInitS(&battery->technology, extended.type); // extended.technology?
|
||||
ffStrbufInit(&battery->status);
|
||||
ffStrbufInitS(&battery->serial, extended.serial_number);
|
||||
battery->temperature = FF_BATTERY_TEMP_UNSET;
|
||||
battery->cycleCount = extended.cycles;
|
||||
battery->timeRemaining = -1;
|
||||
battery->capacity = (double) basic.capacity * 100. / (double) extended.last_full_charge;
|
||||
|
||||
if (basic.state & BATTERY_DISCHARGING)
|
||||
ffStrbufAppendS(&battery->status, "Discharging, ");
|
||||
if (basic.state & BATTERY_CHARGING)
|
||||
ffStrbufAppendS(&battery->status, "Charging, ");
|
||||
if (basic.state & BATTERY_CRITICAL_STATE)
|
||||
ffStrbufAppendS(&battery->status, "Critical, ");
|
||||
if (basic.state & BATTERY_NOT_CHARGING)
|
||||
ffStrbufAppendS(&battery->status, "AC Connected, ");
|
||||
ffStrbufTrimRight(&battery->status, ' ');
|
||||
ffStrbufTrimRight(&battery->status, ',');
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* results)
|
||||
{
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir("/dev/power/acpi_battery/");
|
||||
if (!dir) return "opendir(/dev/power/acpi_battery) failed";
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dir)))
|
||||
{
|
||||
if (entry->d_name[0] == '.') continue;
|
||||
parseBattery(dirfd(dir), entry->d_name, results);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -89,6 +89,9 @@ const char* ffDetectBios(FFBiosResult* bios)
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
#elif __HAIKU__
|
||||
// Currently SMBIOS detection is supported in legency BIOS only
|
||||
ffStrbufSetStatic(&bios->type, "BIOS");
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
29
src/detection/bluetooth/bluetooth_haiku.cpp
Normal file
29
src/detection/bluetooth/bluetooth_haiku.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
extern "C" {
|
||||
#include "bluetooth.h"
|
||||
#include "common/io/io.h"
|
||||
}
|
||||
|
||||
#include <bluetooth/LocalDevice.h>
|
||||
|
||||
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
|
||||
{
|
||||
using namespace Bluetooth;
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
LocalDevice* dev = LocalDevice::GetLocalDevice();
|
||||
if (!dev) return NULL;
|
||||
|
||||
BString devClass;
|
||||
dev->GetDeviceClass().DumpDeviceClass(devClass);
|
||||
|
||||
FFBluetoothResult* device = (FFBluetoothResult*) ffListAdd(devices);
|
||||
ffStrbufInitS(&device->name, dev->GetFriendlyName());
|
||||
ffStrbufInitS(&device->address, bdaddrUtils::ToString(dev->GetBluetoothAddress()).String());
|
||||
ffStrbufInitS(&device->type, devClass.String());
|
||||
device->battery = 0;
|
||||
device->connected = true;
|
||||
|
||||
// TODO: more devices?
|
||||
|
||||
return NULL;
|
||||
}
|
64
src/detection/cpu/cpu_haiku.c
Normal file
64
src/detection/cpu/cpu_haiku.c
Normal file
@ -0,0 +1,64 @@
|
||||
#include "cpu.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <private/shared/cpu_type.h>
|
||||
|
||||
const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
system_info sysInfo;
|
||||
if (get_system_info(&sysInfo) != B_OK)
|
||||
return "get_system_info() failed";
|
||||
|
||||
uint32 topoNodeCount = 0;
|
||||
get_cpu_topology_info(NULL, &topoNodeCount);
|
||||
if (topoNodeCount == 0)
|
||||
return "get_cpu_topology_info(NULL) failed";
|
||||
|
||||
FF_AUTO_FREE cpu_topology_node_info* topology = malloc(sizeof(*topology) * topoNodeCount);
|
||||
if (get_cpu_topology_info(topology, &topoNodeCount) != B_OK)
|
||||
return "get_cpu_topology_info(topology) failed";
|
||||
|
||||
enum cpu_platform platform = B_CPU_UNKNOWN;
|
||||
enum cpu_vendor cpuVendor = B_CPU_VENDOR_UNKNOWN;
|
||||
uint32 cpuModel = 0, frequency = 0;
|
||||
uint16_t packages = 0, cores = 0;
|
||||
|
||||
for (uint32 i = 0; i < topoNodeCount; i++)
|
||||
{
|
||||
switch (topology[i].type) {
|
||||
case B_TOPOLOGY_ROOT:
|
||||
platform = topology[i].data.root.platform;
|
||||
break;
|
||||
|
||||
case B_TOPOLOGY_PACKAGE:
|
||||
cpuVendor = topology[i].data.package.vendor;
|
||||
++packages;
|
||||
break;
|
||||
|
||||
case B_TOPOLOGY_CORE:
|
||||
cpuModel = topology[i].data.core.model;
|
||||
uint32_t freq = (uint32_t) (topology[i].data.core.default_frequency / 1000000);
|
||||
frequency = freq > frequency ? freq : frequency;
|
||||
++cores;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const char *model = get_cpu_model_string(platform, cpuVendor, cpuModel);
|
||||
if (model)
|
||||
ffStrbufSetS(&cpu->name, model);
|
||||
else
|
||||
ffStrbufSetF(&cpu->name, "(Unknown %" B_PRIx32 ")", cpuModel);
|
||||
ffStrbufSetS(&cpu->vendor, get_cpu_vendor_string(cpuVendor));
|
||||
|
||||
ffCPUDetectSpeedByCpuid(cpu);
|
||||
if (cpu->frequencyBase < frequency) cpu->frequencyBase = frequency;
|
||||
cpu->packages = packages;
|
||||
cpu->coresPhysical = cores;
|
||||
cpu->coresOnline = cpu->coresLogical = (uint16_t) sysInfo.cpu_count;
|
||||
return NULL;
|
||||
}
|
@ -42,10 +42,11 @@ static const char* detectCpuTemp(double* current)
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL)
|
||||
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL &&
|
||||
ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL &&
|
||||
ffSysctlGetString("hw.cpu0.name", &cpu->name) != NULL)
|
||||
{
|
||||
if (ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL)
|
||||
return "sysctlbyname(machdep.cpu_brand) failed";
|
||||
ffStrbufSetS(&cpu->name, "Unknown CPU");
|
||||
}
|
||||
|
||||
if (ffSysctlGetString("machdep.dmi.processor-vendor", &cpu->vendor) == NULL)
|
||||
@ -58,6 +59,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
ffCPUDetectSpeedByCpuid(cpu);
|
||||
|
||||
uint32_t freq = (uint32_t) ffSysctlGetInt("machdep.cpu.frequency.target", 0);
|
||||
if (freq == 0) freq = (uint32_t) (ffSysctlGetInt64("hw.cpu0.clock_frequency", 0) / 1000000);
|
||||
if (freq > cpu->frequencyBase) cpu->frequencyBase = freq;
|
||||
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
27
src/detection/cpuusage/cpuusage_haiku.c
Normal file
27
src/detection/cpuusage/cpuusage_haiku.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include "fastfetch.h"
|
||||
#include "detection/cpuusage/cpuusage.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
|
||||
{
|
||||
system_info sysInfo;
|
||||
if (get_system_info(&sysInfo) != B_OK)
|
||||
return "get_system_info() failed";
|
||||
|
||||
FF_AUTO_FREE cpu_info* cpuInfo = malloc(sizeof(*cpuInfo) * sysInfo.cpu_count);
|
||||
if (get_cpu_info(0, sysInfo.cpu_count, cpuInfo) != B_OK)
|
||||
return "get_cpu_info() failed";
|
||||
|
||||
uint64_t uptime = (uint64_t) system_time();
|
||||
|
||||
for (uint32_t i = 0; i < sysInfo.cpu_count; ++i)
|
||||
{
|
||||
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
|
||||
info->inUseAll = (uint64_t) cpuInfo[i].active_time;
|
||||
info->totalAll = uptime;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
59
src/detection/disk/disk_haiku.cpp
Normal file
59
src/detection/disk/disk_haiku.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "disk.h"
|
||||
#include "util/stringUtils.h"
|
||||
}
|
||||
#include <fs_info.h>
|
||||
#include <Directory.h>
|
||||
#include <Path.h>
|
||||
|
||||
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
{
|
||||
int32 pos = 0;
|
||||
|
||||
for (dev_t dev; (dev = next_dev(&pos)) >= B_OK;)
|
||||
{
|
||||
fs_info fs;
|
||||
if (fs_stat_dev(dev, &fs) < -1) continue;
|
||||
|
||||
node_ref node(fs.dev, fs.root);
|
||||
BDirectory dir(&node);
|
||||
BPath path(&dir);
|
||||
if (path.InitCheck() != B_OK) continue;
|
||||
|
||||
if (__builtin_expect(options->folders.length, 0))
|
||||
{
|
||||
if (!ffDiskMatchMountpoint(options, path.Path()))
|
||||
continue;
|
||||
}
|
||||
|
||||
FFDisk* disk = (FFDisk*) ffListAdd(disks);
|
||||
|
||||
disk->bytesTotal = (uint64_t)fs.total_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesFree = (uint64_t)fs.free_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesAvailable = disk->bytesFree;
|
||||
disk->bytesUsed = 0; // To be filled in ./disk. c
|
||||
|
||||
disk->filesTotal = (uint32_t) fs.total_nodes;
|
||||
disk->filesUsed = (uint32_t) (disk->filesTotal - (uint64_t)fs.free_nodes);
|
||||
|
||||
ffStrbufInitS(&disk->mountFrom, fs.device_name);
|
||||
ffStrbufInitS(&disk->mountpoint, path.Path());
|
||||
ffStrbufInitS(&disk->filesystem, fs.fsh_name);
|
||||
ffStrbufInitS(&disk->name, fs.volume_name);
|
||||
disk->type = FF_DISK_VOLUME_TYPE_NONE;
|
||||
if (!(fs.flags & B_FS_IS_PERSISTENT))
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
||||
if (fs.flags & B_FS_IS_READONLY)
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_READONLY_BIT);
|
||||
if (fs.flags & B_FS_IS_REMOVABLE)
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
|
||||
if (disk->type == FF_DISK_VOLUME_TYPE_NONE) disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
disk->createTime = 0;
|
||||
|
||||
time_t crTime;
|
||||
if (dir.GetCreationTime(&crTime) == B_OK)
|
||||
disk->createTime = (uint64_t) crTime * 1000;
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
extern "C" {
|
||||
#include "displayserver.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/processing.h"
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
@ -31,14 +29,16 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
monitor_info monitor;
|
||||
// WARNING: This is experimental new Haiku API
|
||||
status_t err = s.GetMonitorInfo(&monitor);
|
||||
if (err == B_OK) {
|
||||
if (err == B_OK)
|
||||
{
|
||||
ffStrbufSetF(&name, "%s %s", monitor.vendor, monitor.name);
|
||||
ffStrbufTrimRightSpace(&name);
|
||||
}
|
||||
|
||||
uint32_t width = (uint32_t) s.Frame().Width() + 1;
|
||||
uint32_t height = (uint32_t) (uint32_t)s.Frame().Height() + 1;
|
||||
double scaleFactor = (double) 1.0;
|
||||
ffdsAppendDisplay(ds,
|
||||
FFDisplayResult* res = ffdsAppendDisplay(ds,
|
||||
width,
|
||||
height,
|
||||
(double)mode.timing.pixel_clock * 1000 / (mode.timing.v_total * mode.timing.h_total),
|
||||
@ -51,11 +51,16 @@ static void detectDisplays(FFDisplayServerResult* ds)
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
main,
|
||||
s.ID().id,
|
||||
(uint64_t) s.ID().id,
|
||||
0,
|
||||
0,
|
||||
"BScreen"
|
||||
);
|
||||
if (err == B_OK)
|
||||
{
|
||||
res->manufactureWeek = monitor.produced.week;
|
||||
res->manufactureYear = monitor.produced.year;
|
||||
}
|
||||
main = false;
|
||||
} while (s.SetToNext() == B_OK);
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
extern "C" {
|
||||
#include "common/font.h"
|
||||
#include "common/parsing.h"
|
||||
#include "font.h"
|
||||
}
|
||||
|
||||
|
21
src/detection/gamepad/gamepad_haiku.cpp
Normal file
21
src/detection/gamepad/gamepad_haiku.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
extern "C" {
|
||||
#include "gamepad.h"
|
||||
}
|
||||
#include <Joystick.h>
|
||||
|
||||
const char* ffDetectGamepad(FFlist* devices /* List of FFGamepadDevice */)
|
||||
{
|
||||
BJoystick js;
|
||||
for (int32 i = 0, n = js.CountDevices(); i < n; ++i)
|
||||
{
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
if (js.GetDeviceName(i, name) == B_OK)
|
||||
{
|
||||
FFGamepadDevice* device = (FFGamepadDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&device->serial);
|
||||
ffStrbufInitS(&device->name, name);
|
||||
device->battery = 0;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
@ -48,6 +48,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
|
||||
|
||||
const char* ffGPUGetVendorString(unsigned vendorId);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
|
||||
void ffGPUFillVendorAndName(uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
|
||||
void ffGPUQueryAmdGpuName(uint16_t deviceId, uint8_t revisionId, FFGPUResult* gpu);
|
||||
#endif
|
||||
|
@ -115,7 +115,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
|
||||
gpu->coreUsage = 0.0/0.0;
|
||||
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
|
||||
CFDictionaryRef perfStatistics = NULL;
|
||||
uint64_t vramUsed = 0, vramTotal = 0;
|
||||
if (ffCfDictGetDict(properties, CFSTR("PerformanceStatistics"), &perfStatistics) == NULL)
|
||||
|
@ -67,10 +67,10 @@ const char* ffGpuDetectMetal(FFlist* gpus)
|
||||
|
||||
gpu->type = device.location == MTLDeviceLocationBuiltIn ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
|
||||
gpu->index = (uint32_t) device.locationNumber;
|
||||
#endif
|
||||
|
||||
if (device.hasUnifiedMemory && device.recommendedMaxWorkingSetSize > 0)
|
||||
gpu->shared.total = device.recommendedMaxWorkingSetSize;
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "gpu_driver_specific.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "common/properties.h"
|
||||
|
||||
#include <sys/pciio.h>
|
||||
#include <fcntl.h>
|
||||
@ -76,11 +75,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
if (gpu->name.length == 0)
|
||||
{
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) pc->pc_device, (unsigned) pc->pc_revid);
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
}
|
||||
ffGPUQueryAmdGpuName(pc->pc_device, pc->pc_revid, gpu);
|
||||
if (gpu->name.length == 0)
|
||||
ffGPUFillVendorAndName(pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#ifdef FF_HAVE_PCIACCESS
|
||||
|
||||
#include "common/properties.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/library.h"
|
||||
|
||||
@ -37,17 +36,14 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
ffStrbufInit(&gpu->platformApi);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->deviceId = ((uint64_t) dev->domain << 6) | ((uint64_t) dev->bus << 4) | ((uint64_t) dev->dev << 2) | (uint64_t) dev->func;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) dev->device_id, (unsigned) dev->revision);
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
}
|
||||
ffGPUQueryAmdGpuName(dev->device_id, dev->revision, gpu);
|
||||
|
||||
if (gpu->name.length == 0)
|
||||
{
|
||||
|
43
src/detection/gpu/gpu_haiku.c
Normal file
43
src/detection/gpu/gpu_haiku.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include "gpu.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <private/drivers/poke.h>
|
||||
|
||||
const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
FF_AUTO_CLOSE_FD int pokefd = open(POKE_DEVICE_FULLNAME, O_RDWR);
|
||||
if (pokefd < 0) return "open(POKE_DEVICE_FULLNAME) failed";
|
||||
|
||||
pci_info dev;
|
||||
pci_info_args cmd = {
|
||||
.signature = POKE_SIGNATURE,
|
||||
.info = &dev,
|
||||
};
|
||||
|
||||
for (cmd.index = 0; ioctl(pokefd, POKE_GET_NTH_PCI_INFO, &cmd, sizeof(cmd)) == B_OK && cmd.status == B_OK; ++cmd.index)
|
||||
{
|
||||
if (dev.class_base != 0x03 /*PCI_BASE_CLASS_DISPLAY*/)
|
||||
continue;
|
||||
|
||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||
ffStrbufInitStatic(&gpu->vendor, ffGPUGetVendorString(dev.vendor_id));
|
||||
ffStrbufInit(&gpu->name);
|
||||
ffStrbufInit(&gpu->driver);
|
||||
ffStrbufInit(&gpu->platformApi);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->deviceId = ((uint64_t) dev.bus << 4) | ((uint64_t) dev.device << 2) | (uint64_t) dev.function;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
ffGPUQueryAmdGpuName(dev.device_id, dev.revision, gpu);
|
||||
|
||||
if (gpu->name.length == 0)
|
||||
ffGPUFillVendorAndName(dev.class_sub, dev.vendor_id, dev.device_id, gpu);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
#include "detection/gpu/gpu_driver_specific.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/library.h"
|
||||
#include "common/properties.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
@ -491,15 +490,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
char* pend;
|
||||
uint64_t revision = strtoul(buffer->chars, &pend, 16);
|
||||
if (pend != buffer->chars)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
|
||||
#ifdef FF_CUSTOM_AMDGPU_IDS_PATH
|
||||
ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);
|
||||
#else
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
#endif
|
||||
}
|
||||
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
|
||||
}
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "gpu.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/properties.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef __FreeBSD__
|
||||
@ -16,6 +17,9 @@
|
||||
#if FF_HAVE_EMBEDDED_PCIIDS
|
||||
#include "fastfetch_pciids.c.inc"
|
||||
#endif
|
||||
#if FF_HAVE_EMBEDDED_AMDGPUIDS
|
||||
#include "fastfetch_amdgpuids.c.inc"
|
||||
#endif
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
#define FF_STR(x) FF_STR_INDIR(x)
|
||||
@ -45,6 +49,8 @@ static const FFstrbuf* loadPciIds()
|
||||
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", &pciids);
|
||||
#elif __sun
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/usr/share/hwdata/pci.ids", &pciids);
|
||||
#elif __HAIKU__
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_ROOT "/system/data/hwdata/pci.ids", &pciids);
|
||||
#endif
|
||||
|
||||
#endif // FF_CUSTOM_PCI_IDS_PATH
|
||||
@ -189,3 +195,43 @@ void ffGPUFillVendorAndName(uint8_t subclass, uint16_t vendor, uint16_t device,
|
||||
#endif
|
||||
return parsePciIdsFile(loadPciIds(), subclass, vendor, device, gpu);
|
||||
}
|
||||
|
||||
#if FF_HAVE_EMBEDDED_AMDGPUIDS
|
||||
static inline int amdGpuCmp(const uint32_t* key, const FFArmGpuProduct* element)
|
||||
{
|
||||
// Maximum value of *key is 0x00FFFFFF. `(int) *key` should never overflow
|
||||
return (int) *key - (int) element->id;
|
||||
}
|
||||
|
||||
static bool loadAmdGpuIdsInc(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu)
|
||||
{
|
||||
uint32_t key = (deviceId << 8u) | revision;
|
||||
FFArmGpuProduct* product = bsearch(&key, ffAmdGpuProducts, ARRAY_SIZE(ffAmdGpuProducts), sizeof(*ffAmdGpuProducts), (void*) amdGpuCmp);
|
||||
if (product)
|
||||
{
|
||||
ffStrbufSetS(&gpu->name, product->name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void parseAmdGpuIdsFile(uint16_t deviceId, uint8_t revision, FFGPUResult* gpu)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
|
||||
#ifdef FF_CUSTOM_AMDGPU_IDS_PATH
|
||||
ffParsePropFile(FF_STR(FF_CUSTOM_AMDGPU_IDS_PATH), query, &gpu->name);
|
||||
#else
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ffGPUQueryAmdGpuName(uint16_t deviceId, uint8_t revisionId, FFGPUResult* gpu)
|
||||
{
|
||||
#if FF_HAVE_EMBEDDED_AMDGPUIDS
|
||||
bool ok = loadAmdGpuIdsInc(deviceId, revisionId, gpu);
|
||||
if (ok) return;
|
||||
#endif
|
||||
return parseAmdGpuIdsFile(deviceId, revisionId, gpu);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "gpu.h"
|
||||
#include "common/properties.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/processing.h"
|
||||
|
||||
@ -65,11 +64,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, ARRAY_SIZE(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
}
|
||||
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
|
||||
|
||||
if (gpu->name.length == 0)
|
||||
{
|
||||
|
34
src/detection/initsystem/initsystem_haiku.c
Normal file
34
src/detection/initsystem/initsystem_haiku.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include "initsystem.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/haiku/version.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char* ffDetectInitSystem(FFInitSystemResult* result)
|
||||
{
|
||||
// Since it runs first, registrar does not know about it,
|
||||
// so we can't query be_roster for it.
|
||||
const char* path = "/boot/system/servers/launch_daemon";
|
||||
if (!ffPathExists(path, FF_PATHTYPE_FILE))
|
||||
return "launch_daemon is not found";
|
||||
|
||||
ffStrbufSetStatic(&result->exe, path);
|
||||
ffStrbufSetStatic(&result->name, "launch_daemon");
|
||||
|
||||
team_info teamInfo;
|
||||
int32 cookie = 0;
|
||||
while (get_next_team_info(&cookie, &teamInfo) == B_OK)
|
||||
{
|
||||
if (ffStrEquals(teamInfo.args, path))
|
||||
{
|
||||
result->pid = (uint32_t) teamInfo.team;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ffGetFileVersion(path, &result->version);
|
||||
|
||||
return NULL;
|
||||
}
|
27
src/detection/keyboard/keyboard_haiku.cpp
Normal file
27
src/detection/keyboard/keyboard_haiku.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
extern "C" {
|
||||
#include "keyboard.h"
|
||||
}
|
||||
|
||||
#include <interface/Input.h>
|
||||
#include <support/List.h>
|
||||
|
||||
const char* ffDetectKeyboard(FFlist* devices /* List of FFKeyboardDevice */)
|
||||
{
|
||||
BList list;
|
||||
|
||||
if (get_input_devices(&list) != B_OK)
|
||||
return "get_input_devices() failed";
|
||||
|
||||
for (int32 i = 0, n = list.CountItems(); i < n; i++)
|
||||
{
|
||||
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_KEYBOARD_DEVICE || !device->IsRunning())
|
||||
continue;
|
||||
|
||||
FFKeyboardDevice* item = (FFKeyboardDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&item->serial);
|
||||
ffStrbufInitS(&item->name, device->Name());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
27
src/detection/mouse/mouse_haiku.cpp
Normal file
27
src/detection/mouse/mouse_haiku.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
extern "C" {
|
||||
#include "mouse.h"
|
||||
}
|
||||
|
||||
#include <interface/Input.h>
|
||||
#include <support/List.h>
|
||||
|
||||
const char* ffDetectMouse(FFlist* devices /* List of FFMouseDevice */)
|
||||
{
|
||||
BList list;
|
||||
|
||||
if (get_input_devices(&list) != B_OK)
|
||||
return "get_input_devices() failed";
|
||||
|
||||
for (int32 i = 0, n = list.CountItems(); i < n; i++)
|
||||
{
|
||||
BInputDevice *device = (BInputDevice *) list.ItemAt(i);
|
||||
if (device->Type() != B_POINTING_DEVICE || !device->IsRunning())
|
||||
continue;
|
||||
|
||||
FFMouseDevice* item = (FFMouseDevice*) ffListAdd(devices);
|
||||
ffStrbufInit(&item->serial);
|
||||
ffStrbufInitS(&item->name, device->Name());
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -2,8 +2,6 @@
|
||||
|
||||
#include "common/time.h"
|
||||
|
||||
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options);
|
||||
|
||||
static FFlist ioCounters1;
|
||||
static uint64_t time1;
|
||||
|
||||
|
@ -17,3 +17,4 @@ typedef struct FFNetIOResult
|
||||
} FFNetIOResult;
|
||||
|
||||
const char* ffDetectNetIO(FFlist* result, FFNetIOOptions* options);
|
||||
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options);
|
||||
|
49
src/detection/netio/netio_haiku.cpp
Normal file
49
src/detection/netio/netio_haiku.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
extern "C" {
|
||||
#include "netio.h"
|
||||
#include "common/netif/netif.h"
|
||||
}
|
||||
|
||||
#include <NetworkInterface.h>
|
||||
#include <NetworkRoster.h>
|
||||
|
||||
const char* ffNetIOGetIoCounters(FFlist* result, FFNetIOOptions* options)
|
||||
{
|
||||
BNetworkRoster& roster = BNetworkRoster::Default();
|
||||
|
||||
BNetworkInterface interface;
|
||||
uint32 cookie = 0;
|
||||
|
||||
uint32_t defaultRouteIfIndex = ffNetifGetDefaultRouteIfIndex();
|
||||
|
||||
while (roster.GetNextInterface(&cookie, interface) == B_OK)
|
||||
{
|
||||
if (!interface.Exists())
|
||||
continue;
|
||||
|
||||
bool defaultRoute = interface.Index() == defaultRouteIfIndex;
|
||||
if (options->defaultRouteOnly && !defaultRoute)
|
||||
continue;
|
||||
|
||||
if (options->namePrefix.length && strncmp(interface.Name(), options->namePrefix.chars, options->namePrefix.length) != 0)
|
||||
continue;
|
||||
|
||||
ifreq_stats stats = {};
|
||||
if (interface.GetStats(stats) != B_OK) continue;
|
||||
|
||||
FFNetIOResult* counters = (FFNetIOResult*) ffListAdd(result);
|
||||
*counters = (FFNetIOResult) {
|
||||
.name = ffStrbufCreateS(interface.Name()),
|
||||
.defaultRoute = defaultRoute,
|
||||
.txBytes = stats.send.bytes,
|
||||
.rxBytes = stats.receive.bytes,
|
||||
.txPackets = stats.send.packets,
|
||||
.rxPackets = stats.receive.packets,
|
||||
.rxErrors = stats.receive.errors,
|
||||
.txErrors = stats.send.errors,
|
||||
.rxDrops = stats.receive.dropped,
|
||||
.txDrops = stats.send.dropped
|
||||
};
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
39
src/detection/opengl/opengl_haiku.cpp
Normal file
39
src/detection/opengl/opengl_haiku.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include <OpenGLKit.h>
|
||||
|
||||
extern "C" {
|
||||
#include "opengl.h"
|
||||
#include "common/io/io.h"
|
||||
#if FF_HAVE_EGL
|
||||
const char* ffOpenGLDetectByEGL(FFOpenGLResult* result);
|
||||
#endif
|
||||
void ffOpenGLHandleResult(FFOpenGLResult* result, __typeof__(&glGetString) ffglGetString);
|
||||
}
|
||||
|
||||
static const char* oglDetectOpenGL(FFOpenGLResult* result)
|
||||
{
|
||||
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
|
||||
FF_SUPPRESS_IO();
|
||||
|
||||
BGLView glView(BRect(), "ff_ogl_view", B_FOLLOW_NONE, B_WILL_DRAW, BGL_RGB);
|
||||
auto ffglGetString = (decltype(&glGetString)) glView.GetGLProcAddress("glGetString");
|
||||
if (!ffglGetString) return "glView.GetGLProcAddress() failed";
|
||||
ffOpenGLHandleResult(result, ffglGetString);
|
||||
ffStrbufSetStatic(&result->library, "OpenGLKit");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectOpenGL(FFOpenGLOptions* options, FFOpenGLResult* result)
|
||||
{
|
||||
if (options->library == FF_OPENGL_LIBRARY_AUTO)
|
||||
return oglDetectOpenGL(result);
|
||||
else if (options->library == FF_OPENGL_LIBRARY_EGL)
|
||||
{
|
||||
#if FF_HAVE_EGL
|
||||
return ffOpenGLDetectByEGL(result);
|
||||
#else
|
||||
return "fastfetch was compiled without egl support";
|
||||
#endif
|
||||
}
|
||||
else
|
||||
return "Unsupported OpenGL library";
|
||||
}
|
@ -1,20 +1,73 @@
|
||||
#include "os.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <image.h>
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
system_info info;
|
||||
|
||||
ffStrbufSetStatic(&os->name, "Haiku");
|
||||
ffStrbufSetStatic(&os->prettyName, "Haiku");
|
||||
|
||||
ffStrbufSetStatic(&os->id, "haiku");
|
||||
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return;
|
||||
ffStrbufAppendF(&os->version, "R%lld", info.kernel_version);
|
||||
image_info image;
|
||||
int32 cookie = 0;
|
||||
while (get_next_image_info(B_SYSTEM_TEAM, &cookie, &image) == B_OK)
|
||||
{
|
||||
int32 ver = image.api_version;
|
||||
if (ver == 0) continue;
|
||||
|
||||
// TODO: check kernel resources?
|
||||
// https://github.com/haiku/haiku/blob/e63683b2fb337d2034059a7e053c170eaf978142/headers/os/BeBuild.h#L36
|
||||
if (ver < B_HAIKU_VERSION_1_ALPHA_1)
|
||||
{
|
||||
switch (ver)
|
||||
{
|
||||
case B_HAIKU_VERSION_BEOS:
|
||||
ffStrbufSetStatic(&os->version, "BEOS");
|
||||
break;
|
||||
case B_HAIKU_VERSION_BONE:
|
||||
ffStrbufSetStatic(&os->version, "BONE");
|
||||
break;
|
||||
case B_HAIKU_VERSION_DANO:
|
||||
ffStrbufSetStatic(&os->version, "DANO");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int32 relVer = ver / 0x10000;
|
||||
ver %= 0x10000;
|
||||
if (ver == 0)
|
||||
{
|
||||
ffStrbufSetF(&os->version, "R%d", relVer);
|
||||
}
|
||||
else
|
||||
{
|
||||
relVer++;
|
||||
|
||||
bool isPre = !!(ver & 1);
|
||||
if (ver < B_HAIKU_VERSION_1_PRE_BETA_1)
|
||||
{
|
||||
int32 alphaVer = ver / 0x100;
|
||||
if (isPre)
|
||||
ffStrbufSetF(&os->version, "R%dA%d-", relVer, alphaVer + 1);
|
||||
else
|
||||
ffStrbufSetF(&os->version, "R%dA%d", relVer, alphaVer);
|
||||
}
|
||||
else if (ver < 0x00010000 /* B_HAIKU_VERSION_1 */)
|
||||
{
|
||||
int32 betaVer = (ver - B_HAIKU_VERSION_1_ALPHA_4) / 0x100;
|
||||
if (isPre)
|
||||
ffStrbufSetF(&os->version, "R%dB%d-", relVer, betaVer + 1);
|
||||
else
|
||||
ffStrbufSetF(&os->version, "R%dB%d", relVer, betaVer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!os->version.length)
|
||||
{
|
||||
system_info sys;
|
||||
if (get_system_info(&sys) == B_OK)
|
||||
ffStrbufAppendF(&os->version, "R%ldx", sys.kernel_version);
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ static void detectOS(FFOSResult* os)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(instance.config.general.escapeBedrock && parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
|
||||
if(parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
|
||||
{
|
||||
if(os->id.length == 0)
|
||||
ffStrbufAppendS(&os->id, "bedrock");
|
||||
|
@ -18,6 +18,8 @@ typedef struct FFPackagesResult
|
||||
uint32_t guixHome;
|
||||
uint32_t guixSystem;
|
||||
uint32_t guixUser;
|
||||
uint32_t hpkgSystem;
|
||||
uint32_t hpkgUser;
|
||||
uint32_t linglong;
|
||||
uint32_t lpkg;
|
||||
uint32_t lpkgbuild;
|
||||
|
@ -6,8 +6,9 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
||||
{
|
||||
// TODO: Use the Package Kit C++ API instead (would account for disabled packages)
|
||||
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT))
|
||||
result->pkg = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/system/packages", false);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT))
|
||||
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/boot/home/config/packages", false);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_HPKG_BIT))
|
||||
{
|
||||
result->hpkgSystem = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/system/packages", false);
|
||||
result->hpkgUser = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/boot/home/config/packages", false);
|
||||
}
|
||||
}
|
||||
|
91
src/detection/physicaldisk/physicaldisk_haiku.c
Normal file
91
src/detection/physicaldisk/physicaldisk_haiku.c
Normal file
@ -0,0 +1,91 @@
|
||||
#include "physicaldisk.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <OS.h>
|
||||
#include <StorageDefs.h>
|
||||
#include <Drivers.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
static const char* detectDisk(FFstrbuf* path, const char* diskType, FFlist* result)
|
||||
{
|
||||
FF_AUTO_CLOSE_FD int rawfd = open(path->chars, O_RDONLY);
|
||||
if (rawfd < 0) return "detectDisk: open(rawfd) failed";
|
||||
|
||||
device_geometry geometry;
|
||||
if (ioctl(rawfd, B_GET_GEOMETRY, &geometry, sizeof(geometry)) < 0)
|
||||
return "ioctl(B_GET_GEOMETRY) failed";
|
||||
|
||||
char name[B_OS_NAME_LENGTH];
|
||||
if (ioctl(rawfd, B_GET_DEVICE_NAME, name, sizeof(name)) != 0)
|
||||
{
|
||||
// ioctl reports `not a tty` for NVME drives for some reason
|
||||
snprintf(name, sizeof(name), "Unknown %s drive", diskType);
|
||||
}
|
||||
|
||||
FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result);
|
||||
ffStrbufInitS(&device->name, name);
|
||||
ffStrbufInitCopy(&device->devPath, path);
|
||||
ffStrbufInit(&device->serial);
|
||||
ffStrbufInit(&device->revision);
|
||||
ffStrbufInitS(&device->interconnect, diskType);
|
||||
device->temperature = FF_PHYSICALDISK_TEMP_UNSET;
|
||||
device->type = FF_PHYSICALDISK_TYPE_NONE;
|
||||
device->type |= (geometry.read_only ? FF_PHYSICALDISK_TYPE_READONLY : FF_PHYSICALDISK_TYPE_READWRITE) |
|
||||
(geometry.removable ? FF_PHYSICALDISK_TYPE_REMOVABLE : FF_PHYSICALDISK_TYPE_FIXED);
|
||||
device->size = (uint64_t) geometry.cylinder_count * geometry.head_count * geometry.sectors_per_track * geometry.bytes_per_sector;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* searchRawDeviceFile(FFstrbuf* path, const char* diskType, FFlist* result)
|
||||
{
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path->chars);
|
||||
if (!dir) return "detectDiskType: opendir() failed";
|
||||
uint32_t baseLen = path->length;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dir)))
|
||||
{
|
||||
if (entry->d_name[0] == '.') continue;
|
||||
ffStrbufAppendC(path, '/');
|
||||
ffStrbufAppendS(path, entry->d_name);
|
||||
|
||||
struct stat st;
|
||||
if (stat(path->chars, &st) != 0)
|
||||
{
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR(st.st_mode))
|
||||
searchRawDeviceFile(path, diskType, result);
|
||||
else if (ffStrEquals(entry->d_name, "raw"))
|
||||
detectDisk(path, diskType, result);
|
||||
|
||||
ffStrbufSubstrBefore(path, baseLen);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectPhysicalDisk(FFlist* result, FF_MAYBE_UNUSED FFPhysicalDiskOptions* options)
|
||||
{
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir("/dev/disk");
|
||||
if (!dir) return "opendir(/dev/disk) failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateA(64);
|
||||
ffStrbufAppendS(&path, "/dev/disk/");
|
||||
uint32_t baseLen = path.length;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dir)))
|
||||
{
|
||||
if (entry->d_name[0] == '.' || ffStrEquals(entry->d_name, "virtual")) continue;
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
searchRawDeviceFile(&path, entry->d_name, result);
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
87
src/detection/sound/sound_haiku.cpp
Normal file
87
src/detection/sound/sound_haiku.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "sound.h"
|
||||
#include "util/stringUtils.h"
|
||||
}
|
||||
#include <MediaAddOn.h>
|
||||
#include <MediaNode.h>
|
||||
#include <MediaRoster.h>
|
||||
#include <ParameterWeb.h>
|
||||
|
||||
const char* ffDetectSound(FFlist* devices /* List of FFSoundDevice */)
|
||||
{
|
||||
BMediaRoster* roster = BMediaRoster::Roster();
|
||||
media_node mediaNode;
|
||||
live_node_info liveInfo;
|
||||
dormant_node_info dormantInfo;
|
||||
|
||||
if (roster->GetAudioOutput(&mediaNode) != B_OK)
|
||||
return NULL;
|
||||
|
||||
FFSoundDevice* device = (FFSoundDevice*)ffListAdd(devices);
|
||||
ffStrbufInit(&device->identifier);
|
||||
if (roster->GetDormantNodeFor(mediaNode, &dormantInfo) == B_OK)
|
||||
ffStrbufAppendS(&device->identifier, dormantInfo.name);
|
||||
ffStrbufInit(&device->name);
|
||||
if (roster->GetLiveNodeInfo(mediaNode, &liveInfo) == B_OK)
|
||||
{
|
||||
ffStrbufAppendS(&device->name, liveInfo.name);
|
||||
ffStrbufTrimRightSpace(&device->name);
|
||||
}
|
||||
ffStrbufInitStatic(&device->platformApi, "MediaKit");
|
||||
// We'll check the Mixer actually
|
||||
device->volume = 0;
|
||||
device->active = true;
|
||||
device->main = true;
|
||||
|
||||
roster->ReleaseNode(mediaNode);
|
||||
|
||||
media_node mixer;
|
||||
if (roster->GetAudioMixer(&mixer) != B_OK)
|
||||
return NULL;
|
||||
|
||||
BParameterWeb *web;
|
||||
status_t status = roster->GetParameterWebFor(mixer, &web);
|
||||
roster->ReleaseNode(mixer); // the web is all we need :-)
|
||||
if (status != B_OK)
|
||||
return NULL;
|
||||
|
||||
BContinuousParameter *gain = NULL;
|
||||
BParameter *mute = NULL;
|
||||
BParameter *parameter;
|
||||
for (int32 index = 0; (parameter = web->ParameterAt(index)) != NULL; index++)
|
||||
{
|
||||
// assume the mute preceding master gain control
|
||||
if (ffStrEquals(parameter->Kind(), B_MUTE))
|
||||
mute = parameter;
|
||||
|
||||
if (ffStrEquals(parameter->Kind(), B_MASTER_GAIN))
|
||||
{
|
||||
// Can not use dynamic_cast due to fno-rtti
|
||||
//gain = dynamic_cast<BContinuousParameter *>(parameter);
|
||||
gain = (BContinuousParameter *)(parameter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gain == NULL)
|
||||
return NULL;
|
||||
|
||||
bigtime_t when;
|
||||
size_t size;
|
||||
|
||||
if (mute)
|
||||
{
|
||||
int32 isMute = false;
|
||||
size = sizeof(isMute);
|
||||
if (mute->GetValue(&isMute, &size, &when) == B_OK && isMute)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float volume = 0.0;
|
||||
size = sizeof(volume);
|
||||
if (gain->GetValue(&volume, &size, &when) == B_OK)
|
||||
device->volume = (uint8_t) (100 * (volume - gain->MinValue()) / (gain->MaxValue() - gain->MinValue()));
|
||||
|
||||
return NULL;
|
||||
}
|
@ -18,7 +18,7 @@ static void paSinkInfoCallback(pa_context *c, const pa_sink_info *i, int eol, vo
|
||||
ffStrbufInitS(&device->name, i->description);
|
||||
ffStrbufTrimRightSpace(&device->name);
|
||||
ffStrbufTrimLeft(&device->name, ' ');
|
||||
device->volume = i->mute ? 0 : (uint8_t) (i->volume.values[0] * 100 / PA_VOLUME_NORM);
|
||||
device->volume = i->mute ? 0 : (uint8_t) ((i->volume.values[0] * 100 + PA_VOLUME_NORM / 2 /*round*/) / PA_VOLUME_NORM);
|
||||
device->active = i->active_port && i->active_port->available != PA_PORT_AVAILABLE_NO;
|
||||
device->main = false;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ const char* ffDetectSound(FFlist* devices)
|
||||
ffStrbufInitS(&device->name, ad.name);
|
||||
ffStrbufTrimRightSpace(&device->name);
|
||||
ffStrbufInitF(&device->platformApi, "%s", "SunAudio");
|
||||
device->volume = (uint8_t) (ai.play.gain * 100 / AUDIO_MAX_GAIN);
|
||||
device->volume = (uint8_t) ((ai.play.gain * 100 + AUDIO_MAX_GAIN / 2) / AUDIO_MAX_GAIN);
|
||||
device->active = true;
|
||||
device->main = defaultDev == idev;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ const char* ffDetectSound(FFlist* devices)
|
||||
if (!bundle.mute[i])
|
||||
totalLevel += bundle.level[i];
|
||||
}
|
||||
device->volume = (uint8_t) (totalLevel * 100 / bundle.iLevel);
|
||||
device->volume = (uint8_t) ((totalLevel * 100 + bundle.iLevel / 2) / bundle.iLevel);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -418,6 +418,21 @@ static void detectWestonTerminal(FFTerminalFontResult* terminalFont)
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
}
|
||||
|
||||
#ifdef __HAIKU__
|
||||
static void detectHaikuTerminal(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY size = ffStrbufCreate();
|
||||
ffParsePropFileConfigValues("Terminal/Default", 2, (FFpropquery[]) {
|
||||
{"\"Half Font Family\" , ", &font},
|
||||
{"\"Half Font Size\" , ", &size},
|
||||
});
|
||||
if (!font.length) ffStrbufSetStatic(&font, "Noto Sans Mono");
|
||||
if (!size.length) ffStrbufSetStatic(&size, "12");
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "konsole"))
|
||||
@ -455,5 +470,9 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "terminator"))
|
||||
detectTerminator(terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "sakura"))
|
||||
detectFromConfigFile("sakura/sakura.conf", "font=", terminalFont);;
|
||||
detectFromConfigFile("sakura/sakura.conf", "font=", terminalFont);
|
||||
#ifdef __HAIKU__
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "Terminal"))
|
||||
detectHaikuTerminal(terminalFont);
|
||||
#endif
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ static bool getFileVersion(const FFstrbuf* exePath, FFstrbuf* version)
|
||||
if (len <= 0) return false;
|
||||
return ffGetFileVersion(exePathW, version);
|
||||
}
|
||||
#elif __HAIKU__
|
||||
#include "util/haiku/version.h"
|
||||
#endif
|
||||
|
||||
static bool getExeVersionRaw(FFstrbuf* exe, FFstrbuf* version)
|
||||
@ -747,7 +749,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal"))
|
||||
return getTerminalVersionGnome(exe, version);
|
||||
@ -847,6 +849,11 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "zed"))
|
||||
return getTerminalVersionZed(exe, version);
|
||||
|
||||
#if __HAIKU__
|
||||
if(ffStrbufEqualS(processName, "Terminal"))
|
||||
return ffGetFileVersion(exe->chars, version);
|
||||
#endif
|
||||
|
||||
const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION");
|
||||
if(termProgramVersion)
|
||||
{
|
||||
|
@ -359,6 +359,11 @@ static void setTerminalInfoDetails(FFTerminalResult* result)
|
||||
else if(ffStrbufEqualS(&result->processName, "WarpTerminal"))
|
||||
ffStrbufInitStatic(&result->prettyName, "Warp");
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
else if(ffStrbufEqualS(&result->processName, "Terminal"))
|
||||
ffStrbufInitStatic(&result->prettyName, "Haiku Terminal");
|
||||
|
||||
#endif
|
||||
|
||||
else if(strncmp(result->exeName, result->processName.chars, result->processName.length) == 0) // if exeName starts with processName, print it. Otherwise print processName
|
||||
|
@ -1,11 +1,9 @@
|
||||
#include "uptime.h"
|
||||
#include "common/time.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
const char* ffDetectUptime(FFUptimeResult* result)
|
||||
{
|
||||
result->uptime = system_time() / 1000;
|
||||
result->bootTime = (real_time_clock_usecs() / 1000) - result->uptime;
|
||||
result->uptime = (uint64_t) system_time() / 1000;
|
||||
result->bootTime = ffTimeGetNow() - result->uptime;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#define FF_ARCHITECTURE "x86_64"
|
||||
#elif defined(__i386__)
|
||||
#define FF_ARCHITECTURE "i386"
|
||||
#elif defined(__ia64__)
|
||||
#define FF_ARCHITECTURE "ia64"
|
||||
#elif defined(__aarch64__)
|
||||
#define FF_ARCHITECTURE "aarch64"
|
||||
#elif defined(__arm__)
|
||||
@ -18,8 +20,16 @@
|
||||
#define FF_ARCHITECTURE "s390x"
|
||||
#elif defined(__loongarch__)
|
||||
#define FF_ARCHITECTURE "loongarch"
|
||||
#elif defined(__sparc__)
|
||||
#define FF_ARCHITECTURE "sparc"
|
||||
#elif defined(__alpha__)
|
||||
#define FF_ARCHITECTURE "alpha"
|
||||
#elif defined(__hppa__)
|
||||
#define FF_ARCHITECTURE "hppa"
|
||||
#elif defined(__m68k__)
|
||||
#define FF_ARCHITECTURE "m68k"
|
||||
#else
|
||||
#define FF_ARCHITECTURE "unknown"
|
||||
#define FF_ARCHITECTURE "Unknown"
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
@ -45,7 +55,7 @@
|
||||
#elif defined(__HAIKU__)
|
||||
#define FF_SYSNAME "Haiku"
|
||||
#else
|
||||
#define FF_SYSNAME "unknown"
|
||||
#define FF_SYSNAME "Unknown"
|
||||
#endif
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
|
@ -19,6 +19,17 @@ void ffPrepareWeather(FFWeatherOptions* options)
|
||||
ffStrbufAppend(&path, &options->location);
|
||||
ffStrbufAppendS(&path, "?format=");
|
||||
ffStrbufAppend(&path, &options->outputFormat);
|
||||
switch (instance.config.display.tempUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendS(&path, "&m");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
ffStrbufAppendS(&path, "&u");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
status = ffNetworkingSendHttpRequest(&state, "wttr.in", path.chars, "User-Agent: curl/0.0.0\r\n");
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
$3 MMMM MMMM
|
||||
MMMM MMMM
|
||||
MMMM MMMM
|
||||
MMMM MMMM
|
||||
MMMM$4 .ciO| /YMMMMM*"
|
||||
$3 MMMM$4 .cOMMMMM|/MMMMM/`
|
||||
MMMM MMMM
|
||||
MMMM$2 .ciO| /YMMMMM*"
|
||||
$1 MMMM$2 .cOMMMMM|/MMMMM/`
|
||||
, ,iMM|/MMMMMMMMMMMMMMM*
|
||||
`*.__,-cMMMMMMMMMMMMMMMMM/`$3.MMM
|
||||
MM$4MMMMMMM/`:MMM/ $3MMMM
|
||||
`*.__,-cMMMMMMMMMMMMMMMMM/`$1.MMM
|
||||
MM$2MMMMMMM/`:MMM/ $1MMMM
|
||||
MMMM MMMM
|
||||
MMMM MMMM
|
||||
"""" """"
|
||||
"""" """"
|
||||
|
17
src/logo/ascii/haiku2.txt
Normal file
17
src/logo/ascii/haiku2.txt
Normal file
@ -0,0 +1,17 @@
|
||||
${c2} :dc'
|
||||
'l:;'${c1},${c2}'ck. .;dc:.
|
||||
co ${c1}..${c2}k. .;; ':o.
|
||||
co ${c1}..${c2}k. ol ${c1}.${c2}0.
|
||||
co ${c1}..${c2}k. oc ${c1}..${c2}0.
|
||||
co ${c1}..${c2}k. oc ${c1}..${c2}0.
|
||||
.Ol,. co ${c1}...''${c2}Oc;kkodxOdddOoc,.
|
||||
';lxxlxOdxkxk0kd${c1}oooll${c2}dl${c1}ccc:${c2}clxd;
|
||||
..${c1}oOolllllccccccc:::::${c2}od;
|
||||
cx:ooc${c1}:::::::;${c2}cooolcX.
|
||||
cd${c1}.${c2}''cloxdoollc' ${c1}...${c2}0.
|
||||
cd${c1}......${c2}k;${c1}.${c2}xl${c1}.... .${c2}0.
|
||||
.::c${c1};..${c2}cx;${c1}.${c2}xo${c1}..... .${c2}0.
|
||||
'::c'${c1}...${c2}do${c1}..... .${c2}K,
|
||||
cd,.${c1}....:${c2}O,${c1}
|
||||
':clod:'${c1}
|
||||
${c1}
|
@ -1,20 +1,18 @@
|
||||
ROSAROSAROSAROSAR
|
||||
ROSA AROS
|
||||
ROS SAROSAROSAROSAR AROS
|
||||
RO ROSAROSAROSAROSAROSAR RO
|
||||
ARO AROSAROSAROSARO AROS ROS
|
||||
ARO ROSAROS OSAR ROSA ROS
|
||||
RO AROSA ROSAROSAROSA ROSAR RO
|
||||
RO ROSAR ROSAROSAROSAR R ROSARO RO
|
||||
RO ROSA AROSAROSAROSA AR ROSARO AR
|
||||
RO AROS ROSAROSAROSA ROS AROSARO AR
|
||||
RO AROS ROSAROSARO ROSARO ROSARO AR
|
||||
RO ROS AROSAROS ROSAROSA AROSAR AR
|
||||
RO ROSA ROS ROSAROSAR ROSARO RO
|
||||
RO ROS AROSAROSAROSA ROSARO AR
|
||||
ARO ROSA ROSAROSAROS AROSAR ARO
|
||||
ARO OROSA R ROSAROS ROS
|
||||
RO AROSAROS AROSAROSAR RO
|
||||
AROS AROSAROSAROSARO AROS
|
||||
ROSA SARO
|
||||
ROSAROSAROSAROSAR
|
||||
${c2} ⢀⣀⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣄
|
||||
${c2} ⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
|
||||
${c1} ⢀⣤⣄ ${c2}⣿⣿⣿⡇
|
||||
${c1} ⢀⣴⣿⣿⣿⠗ ${c2}⣿⣿⣿⡇
|
||||
${c1} ⢠⣾⣿⣿⡿⠁ ${c2}⣿⣿⣿⡇
|
||||
${c1} ⢠⣿⣿⣿⡟ ${c2}⣿⣿⣿⡇
|
||||
${c1}⢀⣿⣿⣿⡿ ${c2}⣿⣿⣿⡇
|
||||
${c1}⢸⣿⣿⣿⠃ ${c2}⣿⣿⣿⡇
|
||||
${c1}⢸⣿⣿⣿ ${c2}⣿⣿⣿⡇
|
||||
${c1}⢸⣿⣿⣿ ${c2}⣿⣿⣿⡇
|
||||
${c1}⢸⣿⣿⣿⡄ ${c2}⠙⢿⡿
|
||||
${c1}⠘⣿⣿⣿⣷
|
||||
⠘⣿⣿⣿⣦
|
||||
⠙⣿⣿⣿⣷⡀ ⢀⡀
|
||||
⠘⢿⣿⣿⣿⣦⣄ ⣠⣴⣿⣿⡦
|
||||
⠙⢿⣿⣿⣿⣷⣦⣀⣀⡀ ⢀⣀⣠⣴⣾⣿⣿⣿⠟⠁
|
||||
⠈⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠁
|
||||
⠈⠙⠛⠿⠿⠿⠿⠿⠿⠟⠛⠋⠁
|
||||
|
@ -2006,14 +2006,23 @@ static const FFlogo H[] = {
|
||||
.names = {"Haiku"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_HAIKU,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_DEFAULT,
|
||||
FF_COLOR_FG_GREEN,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
.colorTitle = FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
// Haiku2
|
||||
{
|
||||
.names = {"Haiku2"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_HAIKU2,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_DEFAULT,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
.colorTitle = FF_COLOR_FG_YELLOW,
|
||||
},
|
||||
// HaikuSmall
|
||||
{
|
||||
.names = {"Haiku-small"},
|
||||
@ -4056,10 +4065,11 @@ static const FFlogo R[] = {
|
||||
.names = {"rosa", "rosa-linux", "rosalinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ROSA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_RGB "250;250;250",
|
||||
FF_COLOR_FG_RGB "100;165;225",
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_BLUE,
|
||||
.colorKeys = FF_COLOR_FG_RGB "100;165;225",
|
||||
.colorTitle = FF_COLOR_FG_RGB "100;165;225",
|
||||
},
|
||||
// RhinoLinux
|
||||
{
|
||||
|
@ -419,8 +419,8 @@ void ffGenerateLocalIpJsonConfig(FFLocalIpOptions* options, yyjson_mut_doc* doc,
|
||||
|
||||
if (defaultOptions.showType != options->showType)
|
||||
{
|
||||
if (options->showType & FF_LOCALIP_TYPE_IPV4_BIT)
|
||||
yyjson_mut_obj_add_bool(doc, module, "showIpv4", true);
|
||||
if (!(options->showType & FF_LOCALIP_TYPE_IPV4_BIT))
|
||||
yyjson_mut_obj_add_bool(doc, module, "showIpv4", false);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_IPV6_BIT)
|
||||
yyjson_mut_obj_add_bool(doc, module, "showIpv6", true);
|
||||
@ -446,8 +446,8 @@ void ffGenerateLocalIpJsonConfig(FFLocalIpOptions* options, yyjson_mut_doc* doc,
|
||||
if (options->showType & FF_LOCALIP_TYPE_COMPACT_BIT)
|
||||
yyjson_mut_obj_add_bool(doc, module, "compact", true);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT)
|
||||
yyjson_mut_obj_add_bool(doc, module, "defaultRouteOnly", true);
|
||||
if (!(options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT))
|
||||
yyjson_mut_obj_add_bool(doc, module, "defaultRouteOnly", false);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT)
|
||||
yyjson_mut_obj_add_bool(doc, module, "showAllIps", true);
|
||||
|
@ -36,6 +36,7 @@ typedef enum __attribute__((__packed__)) FFPackagesFlags
|
||||
FF_PACKAGES_FLAG_MPORT_BIT = 1 << 26,
|
||||
FF_PACKAGES_FLAG_QI_BIT = 1 << 27,
|
||||
FF_PACKAGES_FLAG_PKGSRC_BIT = 1 << 28,
|
||||
FF_PACKAGES_FLAG_HPKG_BIT = 1 << 29,
|
||||
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT32_MAX,
|
||||
} FFPackagesFlags;
|
||||
static_assert(sizeof(FFPackagesFlags) == sizeof(uint32_t), "");
|
||||
|
@ -51,6 +51,8 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
FF_PRINT_PACKAGE(apk)
|
||||
FF_PRINT_PACKAGE(pkg)
|
||||
FF_PRINT_PACKAGE(pkgsrc)
|
||||
FF_PRINT_PACKAGE_NAME(hpkgSystem, counts.hpkgUser ? "hpkg-system" : "hpkg")
|
||||
FF_PRINT_PACKAGE_NAME(hpkgUser, "hpkg-user")
|
||||
FF_PRINT_PACKAGE_NAME(flatpakSystem, counts.flatpakUser ? "flatpak-system" : "flatpak")
|
||||
FF_PRINT_PACKAGE_NAME(flatpakUser, "flatpak-user")
|
||||
FF_PRINT_PACKAGE(snap)
|
||||
@ -84,6 +86,7 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser;
|
||||
uint32_t brewAll = counts.brew + counts.brewCask;
|
||||
uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome;
|
||||
uint32_t hpkgAll = counts.hpkgSystem + counts.hpkgUser;
|
||||
FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||
FF_FORMAT_ARG(counts.all, "all"),
|
||||
FF_FORMAT_ARG(counts.pacman, "pacman"),
|
||||
@ -123,10 +126,13 @@ void ffPrintPackages(FFPackagesOptions* options)
|
||||
FF_FORMAT_ARG(counts.qi, "qi"),
|
||||
FF_FORMAT_ARG(counts.amUser, "am-user"),
|
||||
FF_FORMAT_ARG(counts.pkgsrc, "pkgsrc"),
|
||||
FF_FORMAT_ARG(counts.hpkgSystem, "hpkg-system"),
|
||||
FF_FORMAT_ARG(counts.hpkgUser, "hpkg-user"),
|
||||
FF_FORMAT_ARG(nixAll, "nix-all"),
|
||||
FF_FORMAT_ARG(flatpakAll, "flatpak-all"),
|
||||
FF_FORMAT_ARG(brewAll, "brew-all"),
|
||||
FF_FORMAT_ARG(guixAll, "guix-all"),
|
||||
FF_FORMAT_ARG(hpkgAll, "hpkg-all"),
|
||||
}));
|
||||
}
|
||||
|
||||
@ -178,6 +184,9 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key,
|
||||
case 'G': if (false);
|
||||
FF_TEST_PACKAGE_NAME(GUIX)
|
||||
break;
|
||||
case 'H': if (false);
|
||||
FF_TEST_PACKAGE_NAME(HPKG)
|
||||
break;
|
||||
case 'L': if (false);
|
||||
FF_TEST_PACKAGE_NAME(LPKG)
|
||||
FF_TEST_PACKAGE_NAME(LPKGBUILD)
|
||||
@ -293,6 +302,9 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module)
|
||||
case 'G': if (false);
|
||||
FF_TEST_PACKAGE_NAME(GUIX)
|
||||
break;
|
||||
case 'H': if (false);
|
||||
FF_TEST_PACKAGE_NAME(HPKG)
|
||||
break;
|
||||
case 'L': if (false);
|
||||
FF_TEST_PACKAGE_NAME(LPKG)
|
||||
FF_TEST_PACKAGE_NAME(LPKGBUILD)
|
||||
@ -365,6 +377,7 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do
|
||||
FF_TEST_PACKAGE_NAME(EOPKG)
|
||||
FF_TEST_PACKAGE_NAME(FLATPAK)
|
||||
FF_TEST_PACKAGE_NAME(GUIX)
|
||||
FF_TEST_PACKAGE_NAME(HPKG)
|
||||
FF_TEST_PACKAGE_NAME(LINGLONG)
|
||||
FF_TEST_PACKAGE_NAME(LPKG)
|
||||
FF_TEST_PACKAGE_NAME(LPKGBUILD)
|
||||
@ -421,6 +434,8 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy
|
||||
FF_APPEND_PACKAGE_COUNT(guixSystem)
|
||||
FF_APPEND_PACKAGE_COUNT(guixUser)
|
||||
FF_APPEND_PACKAGE_COUNT(guixHome)
|
||||
FF_APPEND_PACKAGE_COUNT(hpkgSystem)
|
||||
FF_APPEND_PACKAGE_COUNT(hpkgUser)
|
||||
FF_APPEND_PACKAGE_COUNT(linglong)
|
||||
FF_APPEND_PACKAGE_COUNT(mport)
|
||||
FF_APPEND_PACKAGE_COUNT(nixDefault)
|
||||
@ -491,10 +506,13 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
{"Number of qi packages", "qi"},
|
||||
{"Number of am-user (aka appman) packages", "am-user"},
|
||||
{"Number of pkgsrc packages", "pkgsrc"},
|
||||
{"Number of hpkg-system packages", "hpkg-system"},
|
||||
{"Number of hpkg-user packages", "hpkg-user"},
|
||||
{"Total number of all nix packages", "nix-all"},
|
||||
{"Total number of all flatpak app packages", "flatpak-all"},
|
||||
{"Total number of all brew packages", "brew-all"},
|
||||
{"Total number of all guix packages", "guix-all"},
|
||||
{"Total number of all hpkg packages", "hpkg-all"},
|
||||
}))
|
||||
};
|
||||
|
||||
|
@ -160,6 +160,7 @@ static FFModuleBaseInfo ffModuleInfo = {
|
||||
.parseJsonObject = (void*) ffParsePhysicalMemoryJsonObject,
|
||||
.printModule = (void*) ffPrintPhysicalMemory,
|
||||
.generateJsonConfig = (void*) ffGeneratePhysicalMemoryJsonConfig,
|
||||
.generateJsonResult = (void*) ffGeneratePhysicalMemoryJsonResult,
|
||||
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||
{"Size (in bytes)", "bytes"},
|
||||
{"Size formatted", "size"},
|
||||
|
@ -130,6 +130,8 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(unit, &value, (FFKeyValuePair[]) {
|
||||
{ "DEFAULT", FF_TEMPERATURE_UNIT_DEFAULT },
|
||||
{ "D", FF_TEMPERATURE_UNIT_DEFAULT },
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
@ -418,6 +420,8 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
|
||||
if(ffStrEqualsIgnCase(subkey, "unit"))
|
||||
{
|
||||
options->tempUnit = (FFTemperatureUnit) ffOptionParseEnum(key, value, (FFKeyValuePair[]) {
|
||||
{ "DEFAULT", FF_TEMPERATURE_UNIT_DEFAULT },
|
||||
{ "D", FF_TEMPERATURE_UNIT_DEFAULT },
|
||||
{ "CELSIUS", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "C", FF_TEMPERATURE_UNIT_CELSIUS },
|
||||
{ "FAHRENHEIT", FF_TEMPERATURE_UNIT_FAHRENHEIT },
|
||||
@ -513,7 +517,7 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options)
|
||||
options->keyPaddingLeft = 0;
|
||||
options->keyType = FF_MODULE_KEY_TYPE_STRING;
|
||||
|
||||
options->tempUnit = FF_TEMPERATURE_UNIT_CELSIUS;
|
||||
options->tempUnit = FF_TEMPERATURE_UNIT_DEFAULT;
|
||||
options->tempNdigits = 1;
|
||||
ffStrbufInitStatic(&options->tempColorGreen, FF_COLOR_FG_GREEN);
|
||||
ffStrbufInitStatic(&options->tempColorYellow, instance.state.terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
|
||||
@ -643,6 +647,9 @@ void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_do
|
||||
{
|
||||
switch (options->tempUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_DEFAULT:
|
||||
yyjson_mut_obj_add_str(doc, temperature, "unit", "DEFAULT");
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
yyjson_mut_obj_add_str(doc, obj, "unit", "C");
|
||||
break;
|
||||
|
@ -11,6 +11,7 @@ typedef enum __attribute__((__packed__)) FFSizeBinaryPrefixType
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFTemperatureUnit
|
||||
{
|
||||
FF_TEMPERATURE_UNIT_DEFAULT,
|
||||
FF_TEMPERATURE_UNIT_CELSIUS,
|
||||
FF_TEMPERATURE_UNIT_FAHRENHEIT,
|
||||
FF_TEMPERATURE_UNIT_KELVIN,
|
||||
|
@ -30,9 +30,7 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va
|
||||
else if (ffStrEqualsIgnCase(key, "detectVersion"))
|
||||
options->detectVersion = yyjson_get_bool(val);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
else if (ffStrEqualsIgnCase(key, "escapeBedrock"))
|
||||
options->escapeBedrock = yyjson_get_bool(val);
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
else if (ffStrEqualsIgnCase(key, "playerName"))
|
||||
ffStrbufSetS(&options->playerName, yyjson_get_str(val));
|
||||
else if (ffStrEqualsIgnCase(key, "dsForceDrm"))
|
||||
@ -75,9 +73,7 @@ bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key
|
||||
else if(ffStrEqualsIgnCase(key, "--detect-version"))
|
||||
options->detectVersion = ffOptionParseBoolean(value);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
else if(ffStrEqualsIgnCase(key, "--escape-bedrock"))
|
||||
options->escapeBedrock = ffOptionParseBoolean(value);
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
else if(ffStrEqualsIgnCase(key, "--player-name"))
|
||||
ffOptionParseString(key, value, &options->playerName);
|
||||
else if(ffStrEqualsIgnCase(key, "--ds-force-drm"))
|
||||
@ -106,8 +102,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
|
||||
options->multithreading = true;
|
||||
options->detectVersion = true;
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
options->escapeBedrock = true;
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
ffStrbufInit(&options->playerName);
|
||||
options->dsForceDrm = FF_DS_FORCE_DRM_TYPE_FALSE;
|
||||
#elif defined(_WIN32)
|
||||
@ -117,7 +112,7 @@ void ffOptionsInitGeneral(FFOptionsGeneral* options)
|
||||
|
||||
void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
ffStrbufDestroy(&options->playerName);
|
||||
#endif
|
||||
}
|
||||
@ -135,10 +130,7 @@ void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_do
|
||||
if (options->processingTimeout != defaultOptions.processingTimeout)
|
||||
yyjson_mut_obj_add_int(doc, obj, "processingTimeout", options->processingTimeout);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
if (options->escapeBedrock != defaultOptions.escapeBedrock)
|
||||
yyjson_mut_obj_add_bool(doc, obj, "escapeBedrock", options->escapeBedrock);
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
|
||||
if (!ffStrbufEqual(&options->playerName, &defaultOptions.playerName))
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "playerName", &options->playerName);
|
||||
|
@ -16,9 +16,8 @@ typedef struct FFOptionsGeneral
|
||||
bool detectVersion;
|
||||
|
||||
// Module options that cannot be put in module option structure
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
FFstrbuf playerName;
|
||||
bool escapeBedrock;
|
||||
FFDsForceDrmType dsForceDrm;
|
||||
#elif defined(_WIN32)
|
||||
int32_t wmiTimeout;
|
||||
|
@ -233,7 +233,7 @@ static inline void ffStrbufInit(FFstrbuf* strbuf)
|
||||
strbuf->chars = CHAR_NULL_PTR;
|
||||
}
|
||||
|
||||
FF_C_NODISCARD static inline FFstrbuf ffStrbufCreate()
|
||||
FF_C_NODISCARD static inline FFstrbuf ffStrbufCreate(void)
|
||||
{
|
||||
FFstrbuf strbuf;
|
||||
ffStrbufInit(&strbuf);
|
||||
|
24
src/util/haiku/version.cpp
Normal file
24
src/util/haiku/version.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
extern "C" {
|
||||
#include "version.h"
|
||||
}
|
||||
|
||||
#include <File.h>
|
||||
#include <AppFileInfo.h>
|
||||
|
||||
bool ffGetFileVersion(const char* filePath, FFstrbuf* version)
|
||||
{
|
||||
BFile f(filePath, B_READ_ONLY);
|
||||
if (f.InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
BAppFileInfo fileInfo(&f);
|
||||
if (f.InitCheck() != B_OK)
|
||||
return false;
|
||||
|
||||
version_info info;
|
||||
if (fileInfo.GetVersionInfo(&info, B_SYSTEM_VERSION_KIND) != B_OK)
|
||||
return false;
|
||||
|
||||
ffStrbufSetF(version, "%d.%d.%d", (int)info.major, (int)info.middle, (int)info.minor);
|
||||
return true;
|
||||
}
|
3
src/util/haiku/version.h
Normal file
3
src/util/haiku/version.h
Normal file
@ -0,0 +1,3 @@
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
bool ffGetFileVersion(const char* filePath, FFstrbuf* version);
|
@ -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(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
@ -63,6 +63,9 @@ const FFSmbiosHeader* ffSmbiosNextEntry(const FFSmbiosHeader* header)
|
||||
#define loff_t off_t // FreeBSD doesn't have loff_t
|
||||
#elif defined(__sun)
|
||||
#define loff_t off_t
|
||||
#elif defined(__NetBSD__)
|
||||
#include "common/sysctl.h"
|
||||
#define loff_t off_t
|
||||
#endif
|
||||
|
||||
bool ffGetSmbiosValue(const char* devicesPath, const char* classPath, FFstrbuf* buffer)
|
||||
@ -135,11 +138,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
|
||||
if (buffer.chars == NULL)
|
||||
{
|
||||
ffStrbufInit(&buffer);
|
||||
#ifndef __HAIKU__
|
||||
#ifdef __linux__
|
||||
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
|
||||
#endif
|
||||
{
|
||||
#ifndef __sun
|
||||
#if !defined(__sun) && !defined(__NetBSD__)
|
||||
FF_STRBUF_AUTO_DESTROY strEntryAddress = ffStrbufCreate();
|
||||
#ifdef __FreeBSD__
|
||||
if (!ffSettingsGetFreeBSDKenv("hint.smbios.0.mem", &strEntryAddress))
|
||||
@ -176,7 +181,13 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
if (fd < 0) return NULL;
|
||||
|
||||
FFSmbiosEntryPoint entryPoint;
|
||||
if (!ffReadFDData(fd, sizeof(entryPoint), &entryPoint)) return NULL;
|
||||
#ifdef __NetBSD__
|
||||
off_t addr = (off_t) ffSysctlGetInt64("machdep.smbios", 0);
|
||||
if (addr == 0) return NULL;
|
||||
if (pread(fd, &entryPoint, sizeof(entryPoint), addr) < 1) return NULL;
|
||||
#else
|
||||
if (ffReadFDData(fd, sizeof(entryPoint), &entryPoint) < 1) return NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint32_t tableLength = 0;
|
||||
@ -195,9 +206,11 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
tableLength = entryPoint.Smbios30.StructureTableMaximumSize;
|
||||
tableAddress = (loff_t) entryPoint.Smbios30.StructureTableAddress;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
ffStrbufEnsureFixedLengthFree(&buffer, tableLength);
|
||||
if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength)
|
||||
if (pread(fd, buffer.chars, tableLength, tableAddress) == (ssize_t) tableLength)
|
||||
{
|
||||
buffer.length = tableLength;
|
||||
buffer.chars[buffer.length] = '\0';
|
||||
@ -216,6 +229,53 @@ 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;
|
||||
|
||||
// Works on legacy BIOS only
|
||||
// See: https://wiki.osdev.org/System_Management_BIOS#UEFI_systems
|
||||
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;
|
||||
@ -233,6 +293,9 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.length == 0)
|
||||
return NULL;
|
||||
|
||||
return &table;
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
|
@ -83,7 +83,7 @@ static inline bool ffCharIsDigit(char c)
|
||||
// Copies at most (dstBufSiz - 1) bytes from src to dst; dst is always null-terminated
|
||||
static inline char* ffStrCopy(char* __restrict__ dst, const char* __restrict__ src, size_t dstBufSiz)
|
||||
{
|
||||
if (__builtin_expect(dst == NULL, false)) return dst;
|
||||
if (__builtin_expect(dst == NULL, false) || dstBufSiz == 0) return dst;
|
||||
|
||||
size_t len = strnlen(src, dstBufSiz - 1);
|
||||
memcpy(dst, src, len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user