Don’t forget that drivers related to power management can generate events within the kernel even if not exposed to a device special file…this may be what the primary display is detecting through Xorg or the driver. Simply mirroring events as a human interface device to a device special file which listens to those same kernel events would allow that code to remain unchanged while offering end users the ability to customize without special efforts. The power button would be usable after that as a common keyboard or mouse button.
I don’t know how the primary display actually uses power events for waking, but one mechanism which might be related to this is D-Bus. This is the sort of thing D-Bus was designed for, and either directly or indirectly, I suspect at least part of waking up or sleeping gets sent this way. See:
[url]https://en.wikipedia.org/wiki/D-Bus[/url]
There are tools to monitor D-Bus traffic. I haven’t checked on Ubuntu, but Fedora (and probably Ubuntu) has “dbus-monitor”. It might be a place to start.
Hello, Alex:
You are right.
I test your case in my platform with exactly R24.2 SDK and it works well. But you have different platform. So most jobs may be on your own.