diff --git a/devices/one/default.nix b/devices/one/default.nix index 30b73450..a51fce95 100644 --- a/devices/one/default.nix +++ b/devices/one/default.nix @@ -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 {})]; }; } diff --git a/flake.lock b/flake.lock index 98fe233d..0e7739f9 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/flake.nix b/flake.nix index dea16508..9968ffc0 100644 --- a/flake.nix +++ b/flake.nix @@ -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 diff --git a/packages/default.nix b/packages/default.nix index e347d646..9a22e40e 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -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" {} diff --git a/packages/focal-spi/FT9369.patch b/packages/focal-spi/FT9369.patch new file mode 100644 index 00000000..40fc5d35 --- /dev/null +++ b/packages/focal-spi/FT9369.patch @@ -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; diff --git a/packages/focal-spi/default.nix b/packages/focal-spi/default.nix new file mode 100644 index 00000000..477efe7d --- /dev/null +++ b/packages/focal-spi/default.nix @@ -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" ]; +}