/usr/bin/olpc-rotate is in olpc-kbdshim-common 12-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/bin/sh
# Rotates the XO screen 90 degrees on every invocation
# fifo where commands to rotate the touchpad may be written
CMD_FIFO=/var/run/olpc-kbdshim_command
# handle ebook/normal inversion
case $1 in
-e) echo Z >$CMD_FIFO; exit 0;;
-n) echo z >$CMD_FIFO; exit 0;;
-*) echo "usage: $0 [-e|-n]" >&2 ; exit 1;;
esac
get_x_credentials()
{
# fetch the local X server's XAUTHORITY variable
eval "$( xargs -n 1 -0 < /proc/$(pidof X)/environ | grep '^XAUTHORITY=')"
export XAUTHORITY
export DISPLAY=:0
}
test "$XAUTHORITY" || get_x_credentials
# get current screen orientation
if ! xrandrout=$(xrandr -q)
then
echo xrandr query failed >&2
exit 1
fi
now=$(echo $xrandrout | sed -n 's/.*[0-9] \([a-z]*\) *(.*/\1/p')
# note: on F9-based OLPC releases, the xorg-x11-drv-geode library
# rotated the screen the wrong way (version 2.10 and earlier).
# for those systems, the following case should read:
# case $now in
# left) new=normal;;
# inverted) new=left;;
# right) new=inverted;;
# ""|normal) new=right;;
# *) new=normal;;
# esac
case $now in
left) new=inverted;;
inverted) new=right;;
right) new=normal;;
""|normal) new=left;;
*) new=normal;;
esac
xrandr -o $new && test -e $CMD_FIFO && echo $new >$CMD_FIFO
|