diff --git a/m/module/amd-uprof.nix b/m/module/amd-uprof.nix index 299627f7..f405e1e0 100644 --- a/m/module/amd-uprof.nix +++ b/m/module/amd-uprof.nix @@ -27,14 +27,18 @@ services.udev.extraRules = let # To create the device node we need to read the device number from the # /proc directory, so the module must have been loaded first. - addDevice = pkgs.writeScript "add-amd-uprof-dev.sh" - "mknod /dev/AMDPowerProfiler -m 666 c $(< /proc/AMDPowerProfiler/device) 0"; - removeDevice = pkgs.writeScript "remove-amd-uprof-dev.sh" - "rm /dev/AMDPowerProfiler"; + addDevice = pkgs.writeShellScript "add-amd-uprof-dev.sh" '' + set -x + echo date > /tmp/uprof.log + mknod /dev/AMDPowerProfiler -m 666 c $(< /proc/AMDPowerProfiler/device) 0 + ''; + removeDevice = pkgs.writeShellScript "remove-amd-uprof-dev.sh" '' + rm /dev/AMDPowerProfiler + ''; in '' - SUBSYSTEM=="module", DEVPATH=="/module/AMDPowerProfiler", ACTION=="add", RUN+="${addDevice}" - SUBSYSTEM=="module", DEVPATH=="/module/AMDPowerProfiler", ACTION=="remove", RUN+="${removeDevice}" + KERNEL=="AMDPowerProfiler", SUBSYSTEM=="module", ACTION=="add", RUN+="${addDevice}" + KERNEL=="AMDPowerProfiler", SUBSYSTEM=="module", ACTION=="remove", RUN+="${removeDevice}" ''; }; }