feat(uConsole): add disko, backlight fix, GPIO 23, mt7921u

- Add disko flake input + partition config (/boot/firmware, /, /home)
- Add cm5-backlight-fix service as display fallback
- Add enable-gpio23-usb-hub service for internal USB hub
- Add mt7921u kernel module for MediaTek AC1200 WiFi
- Add gpiod package for GPIO userspace control
This commit is contained in:
2026-06-06 16:38:41 -04:00
parent 34cc0a161a
commit 486758e51a
4 changed files with 120 additions and 6 deletions

View File

@@ -1,5 +1,19 @@
{ config, lib, pkgs, paths, self, keys, ... }:
let
# Backlight fallback for CM5 display quirk
# The kernel driver usually handles this, but some boots need a kick
backlightFixScript = pkgs.writeShellScript "backlight-fix" ''
# Try sysfs backlight control
for bl in /sys/class/backlight/*/brightness; do
if [ -f "$bl" ]; then
max=$(cat "$(dirname "$bl")/max_brightness" 2>/dev/null || echo 100)
echo "$max" > "$bl" 2>/dev/null || true
fi
done
'';
in
{
# Basic Host Info
networking.hostName = "uConsole";
@@ -56,6 +70,7 @@
htop
tmux
neovim
gpiod # GPIO control (for internal USB hub, AIO modules)
# ===== HAM Radio =====
js8call
@@ -139,9 +154,10 @@
};
# ============================================================
# Kernel modules for SDR and radio
# Kernel modules for SDR, radio, and WiFi
# ============================================================
boot.kernelModules = [
"mt7921u" # MediaTek MT7921 USB WiFi (uConsole AC1200)
"88x2bu" # Realtek 8812/8821BU USB WiFi (common adapter)
"rtl8xxxu" # RTL8188/8192/8723 USB WiFi
"rtl2832_sdr" # RTL-SDR kernel module
@@ -168,4 +184,37 @@
# Reticulum uses its own encryption and doesn't need open ports
# for basic mesh operations (peer-to-peer discovery).
# For TCP interfaces, open additional ports as needed.
# ============================================================
# CM5 Display Backlight Fix
# The kernel driver initializes backlight, but some boots fail.
# This service kicks it after boot as a reliable fallback.
# ============================================================
systemd.services.cm5-backlight-fix = {
description = "CM5 Display Backlight Fix";
after = [ "multi-user.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${backlightFixScript}";
};
};
# ============================================================
# Internal USB Hub Enable (GPIO 23)
# The Hacker Gadgets AIO V2 board has an internal USB hub for
# the AC1200 WiFi, SDR, and other peripherals. GPIO 23 must be
# HIGH to power the hub. CM5 defaults GPIO 23 to LOW.
# ============================================================
systemd.services.enable-gpio23-usb-hub = {
description = "Enable Internal USB Hub (GPIO 23)";
before = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.gpiod}/bin/gpioset 0 23=1";
ExecStop = "${pkgs.gpiod}/bin/gpioset 0 23=0";
};
};
}