Context
I need to disable Serial Console as wakeup source so that while connected over serial keypress on PC will not wake up a device from standby/hibernate. I found that /sys/module/printk/parameters/console_suspend attribute file's value can be set to 'N' to achieve that. I have an API function which sets this value but this function is called by a user that is not root. Problem here is that /sys/module/printk/parameters/console_suspend is owned by root so permission denied error is thrown when calling APIs function. I found that udev rule can be set to change group of file so that non-root user can modify attribute files.
What I tried
I tried to add following rule in /etc/udev/rules.d/extra.rules
SUBSYSTEM=="module", DEVPATH=="/module/printk", PROGRAM="/bin/sh -c 'chown root:groupA /sys/module/printk/parameters/console_suspend'"
followed by command to reload rules
udevadm control --reload-rules
But during system startup or when trying
udevadm trigger
this rules is not applied. It is however applied when running test
udevadm test /sys/module/printk
Tried to debug udevadm trigger call with
udevadm monitor
but nothing is output related to /sys/module/printk
Questions
1. Is it even possible to change ownership of this file with udev?
2. Any other option to change ownership besides udev?
3. Any other option to disable Serial console as wakeup source (ex. some /sys/.../wakeup file)?