nixos/powertop: add hooks to fix incorrect configurations #368163
Merged
+34
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
powertop
will set USB auto suspend for all connected devices toauto
. This can be checked withhead /sys/bus/usb/devices/*/power/control
.However, the reason this is not
auto
by default is because some devices does not support this properly. I'm getting the same issue as described here on my Logitech mouse, and I have confirmed that the workaround there works.As such, let's expose
postStart
to allow arbitrary fixup script, since there might be other types of buggy hardware. I included anudev
based example, since this is more declarative (locate device by VID and PID) than some custom bash scripts to iterate all/sys/bus/usb/devices
nodes.While we are on it, let's also expose
preStart
. Though I can't think of any obvious usage right now. Maybermmod
some drivers so they won't be affected by power setting changes, and re-enable them inpostStart
? It is more about the completeness at this point.As usual, I'm dogfooding this PR.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.