Detect the angle of the hinge of Hp x360

Hp x360 Laptops have a "hinge screen". The screen can be opened and flipped till 360 degrees.

I want to do some scripting with some commands that activate when the screen is flipped beyond a certain angle. How can I detect the angle?

...I'm imagining it's a function that returns some value (within a range of values)? Does it work that way? Or maybe is's a "flag" set to true or false?

How can I check?


I checked and there are no interfaces that userspace programs can use to get this information and to my knowledge no platform driver in the kernel will provide you with this data.