Using 4.18 stock linux.
Happy to write programs in C or Python.
How can I tell if the button has been pressed, held in and released?
I'd prefer to use gpiolib rather than /sys for this.
Can anyone point me in the right direction?
With 5.1 the kernel has mainline support for this. You'll have to enable CONFIG_PCENGINES_APU2.
The button will appear as a new input device.
In case you wanna configure udev to assign a fixed device node, the kernel's device name is "front-button".
I'm the official maintainer of this driver.