SQUASHME: Fix udev script header

This commit is contained in:
Rodrigo Arias 2025-09-04 13:24:20 +02:00
parent 556f6fbebb
commit de006f5cf0

View File

@ -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}"
'';
};
}