From b0da186ed38bd7cc8766ae7d0bf083e08bf71840 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Tue, 20 Oct 2026 16:28:45 -0400 Subject: [PATCH] trying to fix reauth on fprint --- hosts/fwbook/default.nix | 1 + modules/nixos/desktop/fixes/ABOUTME.md | 14 ++++++- .../nixos/desktop/fixes/airpod-bluetooth.nix | 36 +++++++++++++++++ modules/nixos/desktop/fixes/default.nix | 39 +++---------------- .../desktop/fixes/fingerprint-autosuspend.nix | 21 ++++++++++ 5 files changed, 76 insertions(+), 35 deletions(-) create mode 100644 modules/nixos/desktop/fixes/airpod-bluetooth.nix create mode 100644 modules/nixos/desktop/fixes/fingerprint-autosuspend.nix diff --git a/hosts/fwbook/default.nix b/hosts/fwbook/default.nix index 0e71369..02d81d2 100644 --- a/hosts/fwbook/default.nix +++ b/hosts/fwbook/default.nix @@ -28,6 +28,7 @@ printers.enable = true; fixes = { airpod-bluetooth.enabled = true; + fingerprint-autosuspend.enabled = true; }; tiler = { enable = true; diff --git a/modules/nixos/desktop/fixes/ABOUTME.md b/modules/nixos/desktop/fixes/ABOUTME.md index 872c187..a3d98a9 100644 --- a/modules/nixos/desktop/fixes/ABOUTME.md +++ b/modules/nixos/desktop/fixes/ABOUTME.md @@ -6,7 +6,9 @@ Various workarounds and fixes for desktop/workstation issues. ``` fixes/ -└── default.nix # skyg.nixos.desktop.fixes.airpod-bluetooth.enabled — AirPods HFP mic +├── default.nix # skyg.nixos.desktop.fixes.airpod-bluetooth.enabled — AirPods HFP mic +└── fingerprint-autosuspend.nix + # skyg.nixos.desktop.fixes.fingerprint-autosuspend.enabled — keep fingerprint reader awake ``` ## Behaviour @@ -18,3 +20,13 @@ When `skyg.nixos.desktop.fixes.airpod-bluetooth.enabled` is set to `true`: - WirePlumber auto-switches AirPods from A2DP to HFP when an app opens a mic. - Enables native HFP plus mSBC so the AirPods mic shows as an input. - Call audio is headset quality (mSBC if the buds support it), not A2DP. + +### Fingerprint Reader Autosuspend Fix + +When `skyg.nixos.desktop.fixes.fingerprint-autosuspend.enabled` is set to `true`: + +- Adds a udev rule keeping the Goodix MOC fingerprint reader (`27c6:609c`) + out of USB autosuspend (`power/control=on`, `autosuspend_delay_ms=-1`). +- Prevents the recurring `usb 1-4: reset full-speed USB device` resets and the + intermittent fprintd failure `Device reported an error during identify: + Cannot run while suspended` caused by probing the reader while it is asleep. diff --git a/modules/nixos/desktop/fixes/airpod-bluetooth.nix b/modules/nixos/desktop/fixes/airpod-bluetooth.nix new file mode 100644 index 0000000..ef01bfd --- /dev/null +++ b/modules/nixos/desktop/fixes/airpod-bluetooth.nix @@ -0,0 +1,36 @@ +{ config, lib, ... }: +let + cfg = config.skyg.nixos.desktop.fixes.airpod-bluetooth; +in +{ + options = { + skyg.nixos.desktop.fixes.airpod-bluetooth = { + enabled = lib.mkEnableOption "AirPods Bluetooth mic via HFP (lower call quality)"; + }; + }; + + config = lib.mkIf (cfg.enabled && config.skyg.nixos.desktop.enable) { + # Switch AirPods to HFP when a mic is needed so the AirPods mic + # shows as an input. Call audio is HFP (mSBC if supported), not A2DP. + services.pipewire.wireplumber.extraConfig = { + "51-airpods-bluetooth" = { + "monitor.bluez.properties" = { + "bluez5.enable-msbc" = true; + "bluez5.msbc-support" = true; + "bluez5.hfphsp-backend" = "native"; + "bluez5.roles" = [ + "a2dp_sink" + "a2dp_source" + "hsp_hs" + "hsp_ag" + "hfp_hf" + "hfp_ag" + ]; + }; + "wireplumber.settings" = { + "bluetooth.autoswitch-to-headset-profile" = true; + }; + }; + }; + }; +} diff --git a/modules/nixos/desktop/fixes/default.nix b/modules/nixos/desktop/fixes/default.nix index 40ab379..ed0688f 100644 --- a/modules/nixos/desktop/fixes/default.nix +++ b/modules/nixos/desktop/fixes/default.nix @@ -1,36 +1,7 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.skyg.nixos.desktop.fixes.airpod-bluetooth; -in +{ ... }: { - options = { - skyg.nixos.desktop.fixes.airpod-bluetooth = { - enabled = lib.mkEnableOption "AirPods Bluetooth mic via HFP (lower call quality)"; - }; - }; - - config = lib.mkIf (cfg.enabled && config.skyg.nixos.desktop.enable) { - # Switch AirPods to HFP when a mic is needed so the AirPods mic - # shows as an input. Call audio is HFP (mSBC if supported), not A2DP. - services.pipewire.wireplumber.extraConfig = { - "51-airpods-bluetooth" = { - "monitor.bluez.properties" = { - "bluez5.enable-msbc" = true; - "bluez5.msbc-support" = true; - "bluez5.hfphsp-backend" = "native"; - "bluez5.roles" = [ - "a2dp_sink" - "a2dp_source" - "hsp_hs" - "hsp_ag" - "hfp_hf" - "hfp_ag" - ]; - }; - "wireplumber.settings" = { - "bluetooth.autoswitch-to-headset-profile" = true; - }; - }; - }; - }; + imports = [ + ./airpod-bluetooth.nix + ./fingerprint-autosuspend.nix + ]; } diff --git a/modules/nixos/desktop/fixes/fingerprint-autosuspend.nix b/modules/nixos/desktop/fixes/fingerprint-autosuspend.nix new file mode 100644 index 0000000..e3d8199 --- /dev/null +++ b/modules/nixos/desktop/fixes/fingerprint-autosuspend.nix @@ -0,0 +1,21 @@ +{ config, lib, ... }: +let + cfg = config.skyg.nixos.desktop.fixes.fingerprint-autosuspend; +in +{ + options = { + skyg.nixos.desktop.fixes.fingerprint-autosuspend = { + enabled = lib.mkEnableOption "Keep the Goodix MOC fingerprint reader out of USB autosuspend"; + }; + }; + + config = lib.mkIf (cfg.enabled && config.skyg.nixos.desktop.enable) { + # Framework Goodix MOC fingerprint reader (27c6:609c) resets whenever it is + # probed while in USB autosuspend ("usb 1-4: reset full-speed USB device"), + # and fprintd intermittently fails with "Cannot run while suspended". + # Keep it powered so it responds reliably and stops the reset churn. + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="27c6", ATTRS{idProduct}=="609c", ATTR{power/control}="on", ATTR{power/autosuspend_delay_ms}="-1" + ''; + }; +}