Linux FB rotation is expressed in terms of 90° clockwise turns. So +1 or -1 from Portrait is always going to be Landscape.
Don't trust the actual absolute values, as eInk panels are only extremely rarely mounted Upright/Portrait, and some of them respond in weird ways to rotation events (see mirroring, which may not apply to every rotation state).
fbdepth -o returns the current rotation (as would reading /sys/class/graphics/fb0/rotate), and the actual range of valid constants is 0 to 3, so the & 3 gets us a wraparound at 3 (as would % 4, if you're more comfortable with divisions).
Last edited by NiLuJe; 06-09-2020 at 07:02 PM.
|