hps360pen is a sample tool to map HP Spectre x360 ap00xxxx stock pen buttons.
For now, only the pen's bottom button is supported and is mapped to emulate the right mouse button.
Install hps360pen using pip
pip install hps360pen
At the console, start hps360pen
hps360pen
By default, hps360pen try to use the ELAN PEN event device. If it fails, you can try to list available evdev and choose the right device.
hps360pen --list