PINE64
Phone Attitude(Device orientation) - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone Pro (https://forum.pine64.org/forumdisplay.php?fid=177)
+--- Forum: PinePhone Pro Software (https://forum.pine64.org/forumdisplay.php?fid=179)
+--- Thread: Phone Attitude(Device orientation) (/showthread.php?tid=18396)



Phone Attitude(Device orientation) - lurkadillian - 06-20-2023

I am having trouble finding any sources online about how to obtain the device orientation. If anybody has any knowledge about any libraries or maybe some global value that tracks this.

I am trying to modify this compass app https://gitlab.com/lgtrombetta/compass/ to allow compass to function when in any orientation(not just with your phone flat).


RE: Phone Attitude(Device orientation) - Kevin Kofler - 06-21-2023

The accelerometer readings are underĀ /sys/bus/iio/devices/iio:device*/ where * stands for an integer depending on the kernel being used. The correct device is the one having an in_accel_x_raw file (and several other similar files, all giving you accelerometer readings if you cat them).


RE: Phone Attitude(Device orientation) - lurkadillian - 06-22-2023

I was hoping there might be some kind of global value that has been through a filter combining the gyro and accelerometer. Maybe the one the OS uses for screen rotation?