final fix for fingerprint sensor. UDEV creates a symlink nto /dev/fingerprint_sensor whenever it's attached now.

This commit is contained in:
Joseph Hanson 2024-09-10 14:33:20 -05:00
parent 6c8f89cd50
commit 6c07f5ad50
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o

View file

@ -14,7 +14,6 @@
# Use `findfp.sh` to find the correct USB device. # Use `findfp.sh` to find the correct USB device.
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
usbdevice = "1-4.1";
cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid; cfg = config.mySystem.system.fingerprint-reader-on-laptop-lid;
laptop-lid = pkgs.writeShellScript "laptop-lid" '' laptop-lid = pkgs.writeShellScript "laptop-lid" ''
lock=/var/lock/fingerprint-reader-disabled lock=/var/lock/fingerprint-reader-disabled
@ -25,10 +24,10 @@ let
grep -Fxq connected /sys/class/drm/card*-HDMI-*/status) grep -Fxq connected /sys/class/drm/card*-HDMI-*/status)
then then
touch "$lock" touch "$lock"
echo 0 > /sys/bus/usb/devices/${usbdevice}/authorized echo 0 > /dev/fingerprint_sensor/authorized
elif [ -f "$lock" ] elif [ -f "$lock" ]
then then
echo 1 > /sys/bus/usb/devices/${usbdevice}/authorized echo 1 > /dev/fingerprint_sensor/authorized
rm "$lock" rm "$lock"
fi fi
''; '';
@ -39,10 +38,20 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.acpid = { services = {
acpid = {
enable = true; enable = true;
lidEventCommands = "${laptop-lid}"; lidEventCommands = "${laptop-lid}";
}; };
# Add udev rule to create symlink for fingerprint sensor
# when usb device 27c6:609c is connected or disconnected.
# Reason: hubs like caldigit re-orient the device number on each boot.
# May requires a reboot to take effect.
# or sudo udevadm control --reload-rules && sudo udevadm trigger
udev.extraRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="27c6", ATTRS{idProduct}=="609c", RUN+="/bin/sh -c 'ln -sf /sys$devpath /dev/fingerprint_sensor'"
'';
};
# Disable fingerprint reader at login since you can't put in a password when fprintd is running. # Disable fingerprint reader at login since you can't put in a password when fprintd is running.
security.pam.services.login.fprintAuth = false; security.pam.services.login.fprintAuth = false;