devices.one: enable fprint

This commit is contained in:
2025-08-26 15:27:53 +08:00
parent 313b12364f
commit 1fef287642
6 changed files with 91 additions and 2 deletions

View File

@@ -31,5 +31,14 @@ inputs:
bugs = [ "xmunet" ];
};
specialisation.niri.configuration.nixos.system.gui.implementation = "niri";
services.fprintd =
{
enable = true;
package =
let pkgs = inputs.pkgs.pkgs-2411;
in pkgs.fprintd.override { libfprint = pkgs.libfprint-focaltech-2808-a658; };
};
boot.extraModulePackages =
[(inputs.config.boot.kernelPackages.callPackage inputs.pkgs.localPackages.focal-spi {})];
};
}

21
flake.lock generated
View File

@@ -377,6 +377,22 @@
"type": "github"
}
},
"focal-spi": {
"flake": false,
"locked": {
"lastModified": 1739436917,
"narHash": "sha256-lIQJgjjJFTlLBMAKiwV2n9TjGG2Eolb3100oy/6Vf1Y=",
"owner": "ftfpteams",
"repo": "ubuntu_spi",
"rev": "d534b7a3759a1e338f8d1b866db222d0e1674025",
"type": "github"
},
"original": {
"owner": "ftfpteams",
"repo": "ubuntu_spi",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@@ -861,11 +877,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1754960695,
"lastModified": 1756199587,
"narHash": "sha256-cv73dyWKY6SBW1ECp0E4v3c51qyYmV+N7NwE0skh/cQ=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "cc56ae5eb2e7c66d90332ddaa2c50196a66ec02b",
"rev": "c5c2206c035758db9a99c6f9adf694203778a3a1",
"type": "github"
},
"original": {
@@ -1139,6 +1155,7 @@
"cppcoro": "cppcoro",
"date": "date",
"fancy-motd": "fancy-motd",
"focal-spi": "focal-spi",
"hextra": "hextra",
"home-manager": "home-manager",
"impermanence": "impermanence",

View File

@@ -59,6 +59,7 @@
phono3py = { url = "github:phonopy/phono3py"; flake = false; };
sticker = { url = "git+https://git.chn.moe/chn/sticker.git?lfs=1"; flake = false; };
speedtest = { url = "github:librespeed/speedtest"; flake = false; };
focal-spi = { url = "github:ftfpteams/ubuntu_spi"; flake = false; };
};
outputs = inputs: let localLib = import ./flake/lib inputs.nixpkgs.lib; in

View File

@@ -145,6 +145,7 @@ inputs: rec
speedtest = inputs.pkgs.callPackage ./speedtest.nix { src = inputs.topInputs.speedtest; };
atat = inputs.pkgs.callPackage ./atat.nix { src = inputs.topInputs.self.src.atat; };
atomkit = inputs.pkgs.callPackage ./atomkit.nix { src = inputs.topInputs.self.src.atomkit; };
focal-spi = import ./focal-spi { src = inputs.topInputs.focal-spi; };
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}

View File

@@ -0,0 +1,41 @@
diff --git a/Makefile b/Makefile
index df4d97a..fea500b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1 @@
-KERNEL_VERSION := $(shell uname -r)
-KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
-CURRENT_PATH := $(shell pwd)
-OBJ_NAME := focal_spi
-
-obj-m += $(OBJ_NAME).o
-
-build: kernel_modules
-
-kernel_modules:
- $(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules
-
-install: kernel_modules
- install -p -D -m 0755 $(OBJ_NAME).ko /lib/modules/$(KERNEL_VERSION)/kernel/drivers/spi/$(OBJ_NAME).ko
- depmod
- modprobe $(OBJ_NAME)
-
-clean:
- $(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
-
-
-
+obj-m += focal_spi.o
diff --git a/focal_spi.c b/focal_spi.c
index 9974f00..e635507 100644
--- a/focal_spi.c
+++ b/focal_spi.c
@@ -490,7 +490,7 @@ static int focal_spi_probe(struct spi_device *spi)
spi->max_speed_hz=4*1000*1000;
spi->bits_per_word = 8;
/*if spi transfer err,change here spi->mode = SPI_MODE_0*/
- spi->mode = SPI_MODE_0|SPI_CS_HIGH;
+ spi->mode = SPI_MODE_0;
error = spi_setup(spi);
if (error)
return error;

View File

@@ -0,0 +1,20 @@
{ src }: { stdenv, kernel, kernelModuleMakeFlags }: stdenv.mkDerivation
{
name = "focal_spi";
inherit src;
patches = [ ./FT9369.patch ];
nativeBuildInputs = kernel.moduleBuildDependencies;
setSourceRoot =
''
export sourceRoot=$PWD/build
'';
# makeFlags = kernelModuleMakeFlags;
makeFlags = kernelModuleMakeFlags ++ [
"-C"
"${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"M=$(pwd)"
];
buildFlags = [ "modules" ];
installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
installTargets = [ "modules_install" ];
}