This file is indexed.

/usr/bin/xrotate is in xdiagnose 3.8.4.

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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash

# Script originated from https://bbs.archlinux.org/viewtopic.php?id=107167 comment #4
# Hacked on for Nexus 7 ~ Bryce Harrington

rotate_display() {
    output=$1
    rotation=$2

    #xrandr --output ${output} --rotate right
    xrandr -o $(( rotation * 3 ))
    if [ $? -ne 0 ]; then
	echo "xrandr fail" >> /tmp/xrotate.log
        return 1
    fi

    return 0
}

matrix_rotate() {
    device=$1
    rotation=$2

    case ${rotation} in
	0) MATRIX="0 -1 1  1 0 0   0 0 1"   ;;  # 90 deg to right
	1) MATRIX="1 0 0   0 1 0   0 0 1"   ;;  # normal
	2) MATRIX="0 1 0   1 0 -1  0 0 1"   ;;  # 90 deg to left
    esac

    xinput set-prop $device "Coordinate Transformation Matrix" $MATRIX
    if [ $? -ne 0 ]; then
	echo "xinput matrix transformation fail" >> /tmp/xrotate.log
        return 1
    fi

    return 0
}

rotate_device() {
    device=$1
    rotation=$2

    xinput set-prop $device "Evdev Axes Swap" $rotation
    if [ $? -ne 0 ]; then
	echo "xinput axis swap fail" >> /tmp/xrotate.log
        return 1
    fi

    xinput set-prop $device "Evdev Axis Inversion" $rotation, $rotation
    if [ $? -ne 0 ]; then
	echo "xinput axis inversion fail" >> /tmp/xrotate.log
        return 1
    fi

    return 0
}

calibrate_device() {
    device=$1
    rotation=$2

    rangex=( 0 9640 )
    rangey=( 0 7220 )

    case ${rotation} in
	0) cal=( ${rangey[@]} ${rangex[@]} ) ;;
	1) cal=( ${rangex[@]} ${rangey[@]} ) ;;
    esac

    xinput set-prop $device "Evdev Axis Calibration" ${cal[@]}
    if [ $? -ne 0 ]; then
	echo "xinput calibration fail" >> /tmp/xrotate.log
        return 1
    fi

    return 0
}

rotate() {
    rotation=$1

    devices=( "elan-touchscreen" )

    rotate_display "LVDS-1" ${rotation}
    for device in ${devices[@]}; do
	#rotate_device ${device} ${rotation} \
	#    || return 1
	matrix_rotate ${device} ${rotation} \
	     || return 1
        #calibrate_device ${device} ${rotation}
    done
    return 0
}

# If no args given, default to 'auto'
CMD=${1:-auto}

case "${CMD}" in
    dump)
        echo
        echo "### xinput list ###"
        xinput list
        echo
        echo "### Xorg.0.log ###"
        cat /var/log/Xorg.0.log
        echo
        echo "### dmesg ###"
        dmesg | egrep -i "(tegra|elan|usb|input)"
        echo
        echo "### props ###"
        xinput list-props "elan-touchscreen"
	;;

    portrait | normal)	rotate 0 || exit 1   ;;

    landscape | right)  rotate 1 || exit 1   ;;

    auto)
        # Auto-detect rotation to use
        xrandrout="$(xrandr)"
        case $xrandrout in
            *connected\ 1280x800* ) rotation=0 ;;
            *connected\ 800x1280* ) rotation=1 ;;
        esac

        rotate ${rotation} || exit 1
	;;

    *)
        echo "Usage:  xrotate [portrait|landscape|auto|dump]"
	;;
esac

exit 0