Problem reading input pin P8_22

Instead you have to compile poorly documented cryptic device tree overlay files that report no errors on startup. A much easier system would allow the user to write directly to hardware then exit, no problem there. Drivers can then be developed in user space. https://forum.beagleboard.org/t/am335xussetpm-user-space-device-driver