Hdapsd: automatically enable the hdapsd kernel module


#1

Without adding this module, the service is not directly usable.

---
 nixos/modules/services/monitoring/hdaps.nix | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nixos/modules/services/monitoring/hdaps.nix b/nixos/modules/services/monitoring/hdaps.nix
index be26c44e78d..2cad3b84d84 100644
--- a/nixos/modules/services/monitoring/hdaps.nix
+++ b/nixos/modules/services/monitoring/hdaps.nix
@@ -16,6 +16,7 @@ in
   };
 
   config = mkIf cfg.enable {
+    boot.kernelModules = [ "hdapsd" ];
     services.udev.packages = hdapsd;
     systemd.packages = hdapsd;
   };

#2

@hpoussin It looks like there is no kernel module called “hdapsd”. Did you mean “hdaps”?


#3

No, I really mean “hdapsd”.

hdapsd (pkgs/os-specific/linux/hdapsd/default.nix) package source code is at https://github.com/evgeni/hdapsd/releases/download/20141203/hdapsd-20141203.tar.gz .

Without the patch (or with “hdaps” as you suggest), I get
dmesg | grep -i hdaps
[ 15.086633] hdaps: supported laptop not found!
[ 15.086635] hdaps: driver init failed (ret=-19)!
[ 24.204814] audit: type=1130 audit(1551030602.203:74): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=hdapsd@sda comm=“systemd” exe="/nix/store/kinpd6wss80pf2d04jnvvmw25lzkrlbq-systemd-239/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’

With this patch, I get:
dmesg | grep -i hdaps
[ 16.093667] hdaps: LENOVO ThinkPad X220 detected, setting orientation 4
[ 16.093764] hdaps: initial mode latch is 0x05
[ 16.093907] hdaps: setting ec_rate=250, filter_order=2
[ 16.094130] hdaps: device successfully initialized.
[ 16.094192] input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input6
[ 16.094220] input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input7
[ 16.094221] hdaps: driver successfully loaded.
[ 24.919059] audit: type=1130 audit(1551029327.917:73): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=hdapsd@sda comm=“systemd” exe="/nix/store/kinpd6wss80pf2d04jnvvmw25lzkrlbq-systemd-239/lib/systemd/systemd" hostname=? addr=? terminal=? res=success’

Joystick and accelerometers are available, and hard disk protection is enabled.


#4

Thanks for the clarification. I’ve converted your patch into a GitHub PR, which I’ll merge later today to get it in before the feature freeze.