surface-control: Fix udev rule

This commit is contained in:
PapaTutuWawa 2021-09-04 19:26:38 +02:00
parent ff47345fa6
commit d311ebb152
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,9 @@
diff --git a/etc/udev/40-surface-control.rules b/etc/udev/40-surface-control.rules
index db90d63..f5857c8 100644
--- a/etc/udev/40-surface-control.rules
+++ b/etc/udev/40-surface-control.rules
@@ -1,2 +1,2 @@
-KERNEL=="01:03:01:00:01", SUBSYSTEM=="surface_aggregator", RUN+="/usr/bin/chmod 664 /sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
-KERNEL=="01:03:01:00:01", SUBSYSTEM=="surface_aggregator", RUN+="/usr/bin/chown root:surface-control /sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
+KERNEL=="01:03:01:00:01", SUBSYSTEM=="surface_aggregator", RUN+="@CHMODBINARY@ 664 /sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"
+KERNEL=="01:03:01:00:01", SUBSYSTEM=="surface_aggregator", RUN+="@CHMODBINARY@ root:surface-control /sys/bus/surface_aggregator/devices/01:03:01:00:01/perf_mode"

View File

@ -1,7 +1,7 @@
{
lib
, fetchFromGitHub
, rustPlatform
, rustPlatform, coreutils
, pkg-config, udev
}:
@ -16,6 +16,8 @@ rustPlatform.buildRustPackage rec {
sha256 = "0606imcz38kcfxcjs00j3va7j7i8fzr4mcspyh5d6jrwwgl1xjxb";
};
patches = [ ./0000-nixos-chmod.patch ];
cargoSha256 = "1yqwaba1rkm3kw1py87j23q4jbdhdsx6fmqidzxgqhr7awrq763y";
nativeBuildInputs = [ pkg-config ];
@ -24,6 +26,7 @@ rustPlatform.buildRustPackage rec {
postInstall = ''
mkdir -p $out/lib/udev/rules.d/
cp etc/udev/40-surface-control.rules $out/lib/udev/rules.d/40-surface-control.rules
sed -e "s|@CHMODBINARY@|${coreutils}/bin/chmod|g" --in-place $out/lib/udev/rules.d/40-surface-control.rules
'';
doCheck = false;