Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/hdaps: automatically enable the hdapsd kernel module #56309

Merged
merged 1 commit into from Mar 8, 2019

Conversation

ryantm
Copy link
Member

@ryantm ryantm commented Feb 24, 2019

patch by hpoussin via
https://discourse.nixos.org/t/hdapsd-automatically-enable-the-hdapsd-kernel-module/2183

Motivation for this change

Motivation provided by hpoussin:

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.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/hdapsd-automatically-enable-the-hdapsd-kernel-module/2183/4

@symphorien
Copy link
Member

I think the right solution is to rename the module from hdapsd to hdaps.
This is the expected name by hdapsd:
https://github.com/evgeni/hdapsd/blob/3ca4b1a9150514f8e92190d3b43da5aab1244ef9/src/hdapsd.c#L662
The renaming is purely artificial:

install -v -D -m 644 hdaps.ko "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/firmware/hdapsd.ko"

installs hdaps.ko as hdapsd.ko.
It could even be a typo.

@ryantm
Copy link
Member Author

ryantm commented Feb 24, 2019

Thanks for pointing out those details @symphorien. It looks like the module renaming was done by @woffs in #28962 to avoid naming collisions.

@symphorien
Copy link
Member

It looks like the collision is intended:
https://github.com/evgeni/tp_smapi/blob/master/README#L38
mentions that this module is a patched version of the upstream one with improved functionality which is
meant to replace the upstream one.

@ryantm
Copy link
Member Author

ryantm commented Feb 24, 2019

@symphorien Okay, are you okay with opening a follow-up issue where we address the naming collision issue?

@nixos-discourse
Copy link

This pull request has been mentioned on Nix community. There might be relevant details there:

https://discourse.nixos.org/t/nixos-19-03-feature-freeze/1950/44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants