Enable MT6797 Wi-Fi/BT, PipeWire audio GUI, cursor autohide, and dev tools
- Add MT6797 CONSYS Wi-Fi/BT factory-firmware patch (0005), native EAPOL TX, 5 GHz NO_IR/regulatory-notifier fixes, TKIP/CCMP admission, initramfs regdb, and geminux-wifi-nvram - Order OpenRC polkit startup before NetworkManager/ModemManager and harden geminux-net with non-blocking scans, mesh SSID grouping, password masking toggle, and BT A2DP/HFP/LE/HID support - Add geminux-audio PipeWire/WirePlumber/UCM2 playback & recording control GUI alongside st and dmenu XFixes cursor autohide - Preinstall requested CLI/dev tools (bash, coreutils, build-base, git, nmtui, perl/SSL, curl-dev, janet, jpm, etc.) and set bash as system-wide default shell
This commit is contained in:
1 parent
ba7b86e570
commit
6aea73cbeb
92 files changed
+5524
-198
No files matched your search
@@ -135,6 +135,7 @@ if command -v glib-compile-schemas >/dev/null 2>&1 && \
|
||||
fi
|
||||
|
||||
rm -f "$TARGET_ROOTFS/etc/runlevels/sysinit/hwdrivers"
|
||||
rm -f "$TARGET_ROOTFS/etc/runlevels/default/wpa_supplicant"
|
||||
if [ -f "$TARGET_ROOTFS/etc/inittab" ]; then
|
||||
sed -i 's/^tty1::respawn:/#tty1::respawn:/' "$TARGET_ROOTFS/etc/inittab"
|
||||
fi
|
||||
@@ -154,19 +155,36 @@ if [ -e "$TARGET_ROOTFS/etc/init.d/geminux-usb-gadget" ]; then
|
||||
fi
|
||||
rm -f "$TARGET_ROOTFS/etc/runlevels/default/geminux-usb-gadget"
|
||||
|
||||
for svc in geminux-hwinit geminux-ccci geminux-powerd geminux-leds; do
|
||||
for svc in geminux-hwinit geminux-ccci geminux-powerd geminux-leds bluetooth polkit; do
|
||||
if [ -e "$TARGET_ROOTFS/etc/init.d/$svc" ]; then
|
||||
mkdir -p "$TARGET_ROOTFS/etc/runlevels/default"
|
||||
ln -sf "/etc/init.d/$svc" "$TARGET_ROOTFS/etc/runlevels/default/$svc"
|
||||
fi
|
||||
done
|
||||
rm -f "$TARGET_ROOTFS/etc/runlevels/default/bluetooth"
|
||||
|
||||
if [ -x "$BASE_DIR/scripts/version.sh" ]; then
|
||||
"$BASE_DIR/scripts/version.sh" "$TARGET_ROOTFS"
|
||||
fi
|
||||
"$BASE_DIR/scripts/set-geminux-hostname.sh" "$TARGET_ROOTFS" "$DEVICE"
|
||||
|
||||
if [ -x "$TARGET_ROOTFS/bin/bash" ] && [ ! -e "$TARGET_ROOTFS/usr/bin/bash" ]; then
|
||||
ln -sf /bin/bash "$TARGET_ROOTFS/usr/bin/bash"
|
||||
fi
|
||||
|
||||
if [ -f "$TARGET_ROOTFS/etc/passwd" ]; then
|
||||
sed -i -E \
|
||||
-e 's#^(root:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*):.*#\1:/bin/bash#' \
|
||||
-e 's#^(user:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*):.*#\1:/bin/bash#' \
|
||||
"$TARGET_ROOTFS/etc/passwd"
|
||||
fi
|
||||
|
||||
mkdir -p "$TARGET_ROOTFS/root"
|
||||
for f in .bashrc .profile .bash_profile; do
|
||||
if [ -f "$TARGET_ROOTFS/etc/skel/$f" ]; then
|
||||
cp -f "$TARGET_ROOTFS/etc/skel/$f" "$TARGET_ROOTFS/root/$f"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[4/4] Populating /home/user skel and setting permissions..."
|
||||
mkdir -p "$TARGET_ROOTFS/home/user/.config" "$TARGET_ROOTFS/home/user/.local/share/geminux" \
|
||||
"$TARGET_ROOTFS/home/user/Pictures" "$TARGET_ROOTFS/home/user/Videos" \
|
||||
|
||||
@@ -93,12 +93,17 @@ system_users = [
|
||||
"dnsmasq:x:103:104:dnsmasq:/dev/null:/sbin/nologin",
|
||||
"polkitd:x:105:110:polkitd:/var/empty:/sbin/nologin",
|
||||
"greetd:x:107:112:greetd:/var/lib/greetd:/sbin/nologin",
|
||||
"user:x:10000:10000::/home/user:/bin/ash",
|
||||
"user:x:10000:10000::/home/user:/bin/bash",
|
||||
]
|
||||
for entry in system_users:
|
||||
name = entry.split(":")[0]
|
||||
if not any(row.startswith(name + ":") for row in passwd):
|
||||
passwd.append(entry)
|
||||
for idx, row in enumerate(passwd):
|
||||
fields = row.split(":")
|
||||
if len(fields) >= 7 and fields[0] in ("root", "user"):
|
||||
fields[6] = "/bin/bash"
|
||||
passwd[idx] = ":".join(fields)
|
||||
|
||||
system_groups = [
|
||||
"klogd:x:101:klogd",
|
||||
@@ -119,7 +124,7 @@ for entry in system_groups:
|
||||
|
||||
member_groups = (
|
||||
"wheel", "audio", "input", "netdev", "plugdev", "video", "seat",
|
||||
"dialout", "tty", "pipewire",
|
||||
"dialout", "tty", "pipewire", "lp",
|
||||
)
|
||||
for index, row in enumerate(group):
|
||||
fields = row.split(":")
|
||||
@@ -200,8 +205,8 @@ done
|
||||
for svc in bootmisc hostname loopback modules sysctl tmpfs zram-init; do
|
||||
enable_service boot "$svc"
|
||||
done
|
||||
for svc in cgroups chronyd dbus elogind local modemmanager networkmanager \
|
||||
sshd tinydm udev-postmount wpa_supplicant; do
|
||||
for svc in bluetooth cgroups chronyd dbus elogind local modemmanager networkmanager \
|
||||
polkit sshd tinydm udev-postmount; do
|
||||
enable_service default "$svc"
|
||||
done
|
||||
for svc in killprocs mount-ro savecache; do
|
||||
|
||||
@@ -188,9 +188,10 @@ EOF
|
||||
(cd "$stage_dir" && find . -print0 | cpio --null -ov --format=newc --quiet | gzip -9 > "$out_gz")
|
||||
}
|
||||
|
||||
# Also add e2fsprogs (e2fsck, resize2fs) + shared libs for initramfs filesystem safety
|
||||
# Also add e2fsprogs (e2fsck, resize2fs) + shared libs for initramfs filesystem safety,
|
||||
# and wireless-regdb so built-in cfg80211 loads regulatory.db at early boot.
|
||||
apk --root "$SYSROOT_INIT" --arch aarch64 add --no-scripts \
|
||||
musl e2fsprogs e2fsprogs-extra util-linux-misc >/dev/null
|
||||
musl e2fsprogs e2fsprogs-extra util-linux-misc wireless-regdb >/dev/null
|
||||
|
||||
build_cpio_with_fs() {
|
||||
mode="$1"
|
||||
@@ -201,6 +202,10 @@ EOF
|
||||
cp -a "$SYSROOT_INIT/lib/"ld-musl-*.so* "$stage_dir/lib/" 2>/dev/null || true
|
||||
cp -a "$SYSROOT_INIT/lib/lib"* "$stage_dir/lib/" 2>/dev/null || true
|
||||
cp -a "$SYSROOT_INIT/usr/lib/lib"* "$stage_dir/usr/lib/" 2>/dev/null || true
|
||||
if [ -f "$SYSROOT_INIT/lib/firmware/regulatory.db" ]; then
|
||||
mkdir -p "$stage_dir/lib/firmware"
|
||||
cp -a "$SYSROOT_INIT/lib/firmware/regulatory.db"* "$stage_dir/lib/firmware/"
|
||||
fi
|
||||
for tool in e2fsck fsck.ext4 resize2fs blkid; do
|
||||
if [ -e "$SYSROOT_INIT/sbin/$tool" ]; then
|
||||
cp -a "$SYSROOT_INIT/sbin/$tool" "$stage_dir/sbin/"
|
||||
|
||||
@@ -46,6 +46,8 @@ EOF
|
||||
musl-dev \
|
||||
libx11-dev \
|
||||
libxft-dev \
|
||||
libxfixes-dev \
|
||||
libxi-dev \
|
||||
libxinerama-dev \
|
||||
libxrender-dev \
|
||||
fontconfig-dev \
|
||||
|
||||
@@ -23,13 +23,12 @@ if grep -qi 'postmarketos' "$ROOTFS_DIR/etc/apk/repositories"; then
|
||||
fi
|
||||
echo "OK"
|
||||
|
||||
echo "[2/8] Checking excluded Wayland/Rust/compiler/upstream packages..."
|
||||
echo "[2/8] Checking excluded Wayland/Rust/upstream packages..."
|
||||
for bad_pkg in sway wayfire weston phosh cage xwayland grim slurp wofi \
|
||||
sudo-rs postmarketos-base-sudo-rs rust cargo librsvg libglycin rav1e \
|
||||
rav1e-libs libdovi mesa-rusticl gdk-pixbuf adwaita-icon-theme imv-x11 \
|
||||
gst-libav gst-plugins-bad gst-plugins-good libnotify \
|
||||
linux-edge linux-lts xorg-server xf86-input-libinput xf86-video-fbdev \
|
||||
gcc g++ musl-dev make; do
|
||||
linux-edge linux-lts xorg-server xf86-input-libinput xf86-video-fbdev; do
|
||||
if grep -Fxq "P:$bad_pkg" "$ROOTFS_DIR/lib/apk/db/installed"; then
|
||||
echo "FAIL: forbidden package '$bad_pkg' is installed in rootfs" >&2
|
||||
exit 1
|
||||
@@ -195,11 +194,15 @@ if "CONFIG_REGULATOR_FIXED_VOLTAGE=y" not in kcfg.splitlines():
|
||||
rootfs = sys.argv[4]
|
||||
for req_rel in ("etc/pam.d/autologin", "etc/init.d/geminux-hwinit",
|
||||
"usr/lib/dri/simpledrm_dri.so", "etc/runlevels/boot/geminux-usb-gadget",
|
||||
"usr/share/X11/xkb/types/custom", "usr/sbin/dnsmasq"):
|
||||
"usr/share/X11/xkb/types/custom", "usr/sbin/dnsmasq",
|
||||
"etc/NetworkManager/conf.d/20-geminux-wifi.conf", "etc/shells",
|
||||
"usr/sbin/geminux-wifi-nvram", "etc/polkit-1/rules.d/10-geminux.rules"):
|
||||
if not os.path.lexists(os.path.join(rootfs, req_rel)):
|
||||
raise SystemExit(f"FAIL: missing required path {os.path.join(rootfs, req_rel)}")
|
||||
if os.path.lexists(os.path.join(rootfs, "etc/runlevels/sysinit/hwdrivers")):
|
||||
raise SystemExit("FAIL: hwdrivers must not be enabled in sysinit")
|
||||
if os.path.lexists(os.path.join(rootfs, "etc/runlevels/default/wpa_supplicant")):
|
||||
raise SystemExit("FAIL: wpa_supplicant must not be enabled in default runlevel")
|
||||
with open(os.path.join(rootfs, "etc/inittab"), "r", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if line.startswith("tty1::respawn:"):
|
||||
@@ -210,6 +213,9 @@ for rel, needle in (
|
||||
("etc/X11/xorg.conf.d/30-geminux-keyboard.conf", "custom:types"),
|
||||
("etc/X11/xorg.conf.d/20-geminux-touch.conf", "0 -1 1 1 0 0 0 0 1"),
|
||||
("etc/conf.d/geminux-hwinit", 'GEMINUX_ENABLE_MEDIATEK_DRM="yes"'),
|
||||
("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi.scan-rand-mac-address = no"),
|
||||
("etc/NetworkManager/conf.d/20-geminux-wifi.conf", "wifi-sec.pmf = 1"),
|
||||
("etc/shells", "/bin/bash"),
|
||||
):
|
||||
p = os.path.join(rootfs, rel)
|
||||
with open(p, "r", encoding="utf-8") as f:
|
||||
@@ -253,6 +259,21 @@ docker run --rm -i -v "$IMAGES_DIR:/images:ro" -v "$BASE_DIR/prebuilt/kernel/boo
|
||||
debugfs -R "stat /usr/bin/doas" /images/geminux-rootfs.img | grep -qE "Mode:[[:space:]]*04755\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /usr/bin/doas is not mode 04755" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /usr/libexec/dbus-daemon-launch-helper" /images/geminux-rootfs.img | grep -qE "Mode:[[:space:]]*04750\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /usr/libexec/dbus-daemon-launch-helper is not mode 04750" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /usr/libexec/dbus-daemon-launch-helper" /images/geminux-rootfs.img | grep -qE "User:[[:space:]]*0\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /usr/libexec/dbus-daemon-launch-helper is not UID 0" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /usr/libexec/dbus-daemon-launch-helper" /images/geminux-rootfs.img | grep -qE "Group:[[:space:]]*103\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /usr/libexec/dbus-daemon-launch-helper is not GID 103" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /etc/polkit-1/rules.d" /images/geminux-rootfs.img | grep -qE "Mode:[[:space:]]*0?4?0750\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /etc/polkit-1/rules.d is not mode 0750" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /etc/polkit-1/rules.d" /images/geminux-rootfs.img | grep -qE "Group:[[:space:]]*110\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /etc/polkit-1/rules.d is not GID 110" >&2; exit 1;
|
||||
}
|
||||
debugfs -R "stat /home/user" /images/geminux-rootfs.img | grep -qE "User:[[:space:]]*10000\b" || {
|
||||
echo "FAIL: geminux-rootfs.img /home/user is not UID 10000" >&2; exit 1;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ ustage = os.path.join(work_dir, "geminux-ui")
|
||||
copy_tree_dedup("/geminux/prebuilt/geminux", ustage)
|
||||
make_pkg(
|
||||
"geminux-ui", pkg_ver,
|
||||
"Geminux libgemui.so toolkit, 9 landscape HiDPI apps, and 7 zero-poll C11 daemons",
|
||||
"Geminux libgemui.so toolkit, 10 landscape HiDPI apps, and 7 zero-poll C11 daemons",
|
||||
ustage,
|
||||
provides=["so:libgemui.so=0", f"cmd:geminux-power-ctl={pkg_ver}"],
|
||||
depends=collect_needed_so(ustage),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Geminux aarch64 rootfs package set.
|
||||
# Single source of truth for scripts/bootstrap-rootfs.sh and rebuild-image.sh.
|
||||
# Pure X11 (XLibre + Panfrost), zero Wayland components, zero Rust, zero on-device compiler.
|
||||
# Pure X11 (XLibre + Panfrost), zero Wayland components, zero Rust.
|
||||
alpine-base
|
||||
alsa-ucm-conf
|
||||
alsa-utils
|
||||
@@ -10,12 +10,14 @@ bluez
|
||||
bluez-btmgmt
|
||||
bluez-openrc
|
||||
brightnessctl
|
||||
build-base
|
||||
cairo
|
||||
ca-certificates
|
||||
chrony
|
||||
chrony-openrc
|
||||
coreutils
|
||||
curl
|
||||
curl-dev
|
||||
dbus
|
||||
dbus-libs
|
||||
dbus-openrc
|
||||
@@ -24,11 +26,13 @@ doas
|
||||
dosfstools
|
||||
e2fsprogs
|
||||
e2fsprogs-extra
|
||||
ed
|
||||
elogind
|
||||
eudev
|
||||
eudev-openrc
|
||||
evtest
|
||||
exfatprogs
|
||||
fdk-aac
|
||||
font-dejavu
|
||||
font-dejavu-sans-mono-nerd
|
||||
font-fira-code
|
||||
@@ -48,14 +52,21 @@ ip6tables
|
||||
iproute2
|
||||
iptables
|
||||
iw
|
||||
janet
|
||||
janet-dev
|
||||
jpm
|
||||
jq
|
||||
kmod
|
||||
lang
|
||||
less
|
||||
libcurl
|
||||
libdrm
|
||||
libepoxy
|
||||
libfreeaptx
|
||||
libinput
|
||||
libjpeg-turbo
|
||||
liblc3
|
||||
libldac
|
||||
libpng
|
||||
libva
|
||||
libva-utils
|
||||
@@ -67,6 +78,7 @@ libxrandr
|
||||
libxscrnsaver
|
||||
libxtst
|
||||
mandoc
|
||||
mc
|
||||
mesa-dri-gallium
|
||||
mesa-egl
|
||||
mesa-gbm
|
||||
@@ -79,23 +91,36 @@ modemmanager-openrc
|
||||
mtdev
|
||||
musl-locales
|
||||
nano
|
||||
nawk
|
||||
networkmanager
|
||||
networkmanager-cli
|
||||
networkmanager-openrc
|
||||
networkmanager-tui
|
||||
networkmanager-wifi
|
||||
nsxiv
|
||||
openrc
|
||||
openssh
|
||||
openssh-server-pam
|
||||
pango
|
||||
perl
|
||||
perl-io-socket-ssl
|
||||
perl-libwww
|
||||
perl-lwp-protocol-https
|
||||
perl-mozilla-ca
|
||||
perl-net-ssleay
|
||||
pipewire
|
||||
pipewire-alsa
|
||||
pipewire-pulse
|
||||
pipewire-spa-bluez
|
||||
pipewire-tools
|
||||
pixman
|
||||
polkit
|
||||
pulseaudio-utils
|
||||
rlwrap
|
||||
sbc
|
||||
scrot
|
||||
setxkbmap
|
||||
spandsp3
|
||||
sqlite-libs
|
||||
sudo
|
||||
tinydm
|
||||
@@ -106,9 +131,9 @@ usbutils
|
||||
util-linux
|
||||
util-linux-misc
|
||||
v4l-utils
|
||||
wireless-regdb
|
||||
wireplumber
|
||||
wpa_supplicant
|
||||
wpa_supplicant-openrc
|
||||
xauth
|
||||
xclip
|
||||
xdotool
|
||||
@@ -120,5 +145,6 @@ xrandr
|
||||
xrdb
|
||||
xset
|
||||
xsetroot
|
||||
yabasic
|
||||
zram-init
|
||||
zram-init-openrc
|
||||
@@ -1,4 +1,4 @@
|
||||
# Packages excluded from the final Geminux aarch64 image (Wayland, Rust, upstream overrides, compilers).
|
||||
# Packages excluded from the final Geminux aarch64 image (Wayland, Rust, upstream overrides).
|
||||
grim
|
||||
imv-wayland
|
||||
libdecor
|
||||
@@ -36,10 +36,7 @@ xorg-server
|
||||
xorg-server-common
|
||||
xf86-input-libinput
|
||||
xf86-video-fbdev
|
||||
gcc
|
||||
g++
|
||||
musl-dev
|
||||
make
|
||||
wpa_supplicant-openrc
|
||||
!imv-wayland
|
||||
!grim
|
||||
!slurp
|
||||
@@ -77,7 +74,8 @@ make
|
||||
!xorg-server-common
|
||||
!xf86-input-libinput
|
||||
!xf86-video-fbdev
|
||||
!gcc
|
||||
!g++
|
||||
!musl-dev
|
||||
!make
|
||||
!wpa_supplicant-openrc
|
||||
@!gcc
|
||||
@!g++
|
||||
@!musl-dev
|
||||
@!make
|
||||
@@ -10,8 +10,10 @@ import tempfile
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
DAEMON_DIR = os.path.join(BASE_DIR, "src", "geminux-daemons")
|
||||
APPS_DIR = os.path.join(BASE_DIR, "src", "geminux-apps")
|
||||
POLICY_C = os.path.join(DAEMON_DIR, "geminux-power-policy.c")
|
||||
GESTURE_C = os.path.join(DAEMON_DIR, "geminux-touch-gesture.c")
|
||||
WIFI_NVRAM_C = os.path.join(DAEMON_DIR, "geminux-wifi-nvram-core.c")
|
||||
|
||||
DAEMON_FILES = {
|
||||
"geminux-powerd.c": "epoll_wait",
|
||||
@@ -28,6 +30,10 @@ C_TEST = r"""
|
||||
#include <string.h>
|
||||
#include "geminux-power-policy.h"
|
||||
#include "geminux-touch-gesture.h"
|
||||
#include "geminux-wifi-nvram-core.h"
|
||||
#include "geminux-wifi-list.h"
|
||||
#include "geminux-bt-list.h"
|
||||
#include "geminux-audio-parse.h"
|
||||
|
||||
static int count_decision(const geminux_gesture_action_t *a, int mode) {
|
||||
int c = 0;
|
||||
@@ -165,6 +171,123 @@ int main(void) {
|
||||
assert(perf.suspend_timeout_s == 0);
|
||||
|
||||
test_touch_gestures();
|
||||
|
||||
/* Wi-Fi NVRAM record validation, scan, and deterministic MAC fallback */
|
||||
static unsigned char blob[1024];
|
||||
unsigned char rec[GEMINUX_WIFI_STORAGE_BYTES];
|
||||
unsigned char out_rec[GEMINUX_WIFI_STORAGE_BYTES];
|
||||
bool have_mac = false;
|
||||
|
||||
memset(blob, 0xff, sizeof(blob));
|
||||
memset(rec, 0, sizeof(rec));
|
||||
rec[0] = 0x06;
|
||||
rec[1] = 0x01;
|
||||
rec[197] = 1;
|
||||
rec[262] = 1;
|
||||
rec[512] = 0xaa;
|
||||
rec[513] = geminux_wifi_nvram_checksum(rec);
|
||||
assert(geminux_wifi_nvram_valid_record(rec, sizeof(rec), false));
|
||||
assert(!geminux_wifi_nvram_valid_record(rec, sizeof(rec), true));
|
||||
|
||||
memcpy(blob + 128, rec, sizeof(rec));
|
||||
assert(geminux_wifi_nvram_scan_blob(blob, sizeof(blob), out_rec, &have_mac));
|
||||
assert(!have_mac);
|
||||
|
||||
geminux_wifi_nvram_apply_fallback_mac(out_rec, "test-unit-seed");
|
||||
assert(geminux_wifi_nvram_valid_record(out_rec, sizeof(out_rec), true));
|
||||
assert((out_rec[4] & 0x03) == 0x02);
|
||||
memcpy(blob + 256, out_rec, sizeof(out_rec));
|
||||
assert(geminux_wifi_nvram_scan_blob(blob, sizeof(blob), out_rec, &have_mac));
|
||||
assert(have_mac);
|
||||
|
||||
/* Wi-Fi mesh grouping, DFS avoidance, 5GHz tie-break, and escaped colons */
|
||||
const char *scan =
|
||||
" :11\\:22\\:33\\:44\\:55\\:01::6:100:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:02:My\\:Mesh\\\\Home:52:95:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:03:My\\:Mesh\\\\Home:2:80:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:04:My\\:Mesh\\\\Home:44:80:WPA2 WPA3\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:05:My\\:Mesh\\\\Home:11:65:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:06:My\\:Mesh\\\\Home:9:50:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:07:My\\:Mesh\\\\Home:157:40:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:08:My\\:Mesh\\\\Home:1:30:WPA2\n"
|
||||
" :11\\:22\\:33\\:44\\:55\\:09:My\\:Mesh\\\\Home:161:20:WPA2\n"
|
||||
" :aa\\:bb\\:cc\\:dd\\:ee\\:01:CafeOpen:6:90:--\n"
|
||||
"*:aa\\:bb\\:cc\\:dd\\:ee\\:02:CurrentNet:36:55:WPA2\n"
|
||||
" :aa\\:bb\\:cc\\:dd\\:ee\\:03:StrongOther:1:92:\n";
|
||||
geminux_wifi_group_t groups[GEMINUX_MAX_WIFI_GROUPS];
|
||||
int ng = geminux_parse_wifi_scan(scan, groups, GEMINUX_MAX_WIFI_GROUPS);
|
||||
assert(ng == 4);
|
||||
assert(strcmp(groups[0].ssid, "CurrentNet") == 0);
|
||||
assert(groups[0].in_use);
|
||||
assert(strcmp(groups[1].ssid, "StrongOther") == 0);
|
||||
assert(strcmp(groups[1].security, "Open") == 0);
|
||||
assert(strcmp(groups[2].ssid, "CafeOpen") == 0);
|
||||
assert(strcmp(groups[2].security, "Open") == 0);
|
||||
assert(strcmp(groups[3].ssid, "My:Mesh\\Home") == 0);
|
||||
assert(groups[3].ap_count == 8);
|
||||
assert(groups[3].best_chan == 44);
|
||||
assert(groups[3].best_signal == 80);
|
||||
assert(groups[3].best_joinable);
|
||||
assert(strcmp(groups[3].best_bssid, "11:22:33:44:55:04") == 0);
|
||||
|
||||
/* Bluetooth device list parsing & priority sort */
|
||||
const char *bt_all =
|
||||
"Waiting to connect to bluetoothd...\n"
|
||||
"\x1b[0;93mDevice aa:bb:cc:dd:ee:03 Keychron K3\x1b[0m\n"
|
||||
"Device aa:bb:cc:dd:ee:01 Sony WH-1000XM5\n"
|
||||
"Device aa:bb:cc:dd:ee:02 Logitech MX Anywhere 3\n";
|
||||
const char *bt_pair = "Device AA:BB:CC:DD:EE:02 Logitech MX Anywhere 3\n"
|
||||
"Device AA:BB:CC:DD:EE:03 Keychron K3\n";
|
||||
const char *bt_conn = "Device AA:BB:CC:DD:EE:03 Keychron K3\n";
|
||||
geminux_bt_dev_t bt_devs[GEMINUX_MAX_BT_DEVS];
|
||||
int nbt = geminux_parse_bt_devices(bt_all, bt_pair, bt_conn, bt_devs, GEMINUX_MAX_BT_DEVS);
|
||||
assert(nbt == 3);
|
||||
assert(bt_devs[0].connected && strcmp(bt_devs[0].name, "Keychron K3") == 0);
|
||||
assert(bt_devs[1].paired && !bt_devs[1].connected && strcmp(bt_devs[1].mac, "AA:BB:CC:DD:EE:02") == 0);
|
||||
assert(!bt_devs[2].paired && strcmp(bt_devs[2].name, "Sony WH-1000XM5") == 0);
|
||||
|
||||
/* PipeWire wpctl / pactl parsing */
|
||||
int vpct = 0;
|
||||
bool vmuted = false;
|
||||
assert(geminux_parse_wpctl_volume("Volume: 0.65 [MUTED]\n", &vpct, &vmuted));
|
||||
assert(vpct == 65 && vmuted);
|
||||
|
||||
char def_sink[128], def_src[128];
|
||||
geminux_parse_pactl_defaults("Server Name: PulseAudio (on PipeWire 1.6.11)\n"
|
||||
"Default Sink: alsa_output.platform-sound.stereo-fallback\n"
|
||||
"Default Source: alsa_input.platform-sound.stereo-fallback\n",
|
||||
def_sink, sizeof(def_sink), def_src, sizeof(def_src));
|
||||
assert(strcmp(def_sink, "alsa_output.platform-sound.stereo-fallback") == 0);
|
||||
assert(strcmp(def_src, "alsa_input.platform-sound.stereo-fallback") == 0);
|
||||
|
||||
const char *sinks_txt =
|
||||
"Sink #50\n"
|
||||
"\tState: SUSPENDED\n"
|
||||
"\tName: alsa_output.platform-sound.stereo-fallback\n"
|
||||
"\tDescription: Built-in Audio Stereo\n"
|
||||
"\tMute: no\n"
|
||||
"\tVolume: front-left: 26214 / 40% / -23.87 dB, front-right: 26214 / 40% / -23.87 dB\n"
|
||||
"\tBase Volume: 65536 / 100% / 0.00 dB\n";
|
||||
geminux_audio_node_t nodes[GEMINUX_MAX_AUDIO_NODES];
|
||||
int ns = geminux_parse_pactl_nodes(sinks_txt, "Sink #", def_sink, false, nodes, GEMINUX_MAX_AUDIO_NODES);
|
||||
assert(ns == 1 && nodes[0].index == 50 && nodes[0].is_default && nodes[0].vol_pct == 40 && !nodes[0].muted);
|
||||
|
||||
const char *cards_txt =
|
||||
"Card #44\n"
|
||||
"\tName: bluez_card.11_22_33_44_55_66\n"
|
||||
"\tProperties:\n"
|
||||
"\t\tdevice.description = \"WH-1000XM5\"\n"
|
||||
"\tProfiles:\n"
|
||||
"\t\toff: Off (sinks: 0, sources: 0, priority: 0, available: yes)\n"
|
||||
"\t\ta2dp-sink-sbc: High Fidelity Playback (A2DP Sink, codec SBC-XQ) (sinks: 1, sources: 0, priority: 32, available: yes)\n"
|
||||
"\t\theadset-head-unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 1, available: yes)\n"
|
||||
"\tActive Profile: a2dp-sink-sbc\n";
|
||||
geminux_audio_profile_t profs[GEMINUX_MAX_AUDIO_PROFILES];
|
||||
int np = geminux_parse_pactl_cards(cards_txt, profs, GEMINUX_MAX_AUDIO_PROFILES);
|
||||
assert(np == 3);
|
||||
assert(strcmp(profs[1].card_label, "WH-1000XM5") == 0);
|
||||
assert(profs[1].active && profs[1].available);
|
||||
assert(!profs[2].active && strcmp(profs[2].profile_name, "headset-head-unit") == 0);
|
||||
return 0;
|
||||
}
|
||||
"""
|
||||
@@ -191,7 +314,7 @@ def main():
|
||||
if gcc:
|
||||
subprocess.run(
|
||||
[gcc, "-std=c11", "-Wall", "-Wextra", "-Werror",
|
||||
"-I", DAEMON_DIR, src, POLICY_C, GESTURE_C, "-lm", "-o", bin_path],
|
||||
"-I", DAEMON_DIR, "-I", APPS_DIR, src, POLICY_C, GESTURE_C, WIFI_NVRAM_C, "-lm", "-o", bin_path],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run([bin_path], check=True)
|
||||
@@ -200,9 +323,10 @@ def main():
|
||||
["docker", "run", "--rm", "-v", f"{BASE_DIR}:/geminux:ro",
|
||||
"-v", f"{tmp}:/work", "alpine:3.24", "sh", "-eu", "-c",
|
||||
"apk add --no-cache build-base >/dev/null && "
|
||||
"gcc -std=c11 -Wall -Wextra -Werror -I/geminux/src/geminux-daemons "
|
||||
"gcc -std=c11 -Wall -Wextra -Werror -I/geminux/src/geminux-daemons -I/geminux/src/geminux-apps "
|
||||
"/work/test_power.c /geminux/src/geminux-daemons/geminux-power-policy.c "
|
||||
"/geminux/src/geminux-daemons/geminux-touch-gesture.c -lm "
|
||||
"/geminux/src/geminux-daemons/geminux-touch-gesture.c "
|
||||
"/geminux/src/geminux-daemons/geminux-wifi-nvram-core.c -lm "
|
||||
"-o /work/test_power && /work/test_power"],
|
||||
check=True,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user