Я нашел, что сценарий повернул мой экран и сенсорную панель налево и назад к нормальному:
#!/bin/sh
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
# Using current screen orientation proceed to rotate screen and input tools.
case "$rotation" in
normal)
# -rotate to the left
xrandr -o left
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axes Swap" 1
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axis Inversion" 1 0
xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 1 0
;;
left)
# -rotate to normal
xrandr -o normal
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axes Swap" 0
xinput set-prop --type=int --format=8 "ELAN Touchscreen" "Evdev Axis Inversion" 0 0
xinput set-prop --type=int --format=8 4 "Evdev Axis Inversion" 0 0
;;
esac
Хорошо работает. Но то, что не работает, является стилусом, если экран повернут. Я нашел потенциальное решение изменением Координатной Матрицей преобразования для пера с:
xinput set-prop 'ELAN Touchscreen Pen Pen (0)' "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
Это хорошо работает, средства, если экран ориентирован нормальный и я выполняю эту команду
xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"
приводит к
Coordinate Transformation Matrix (144): 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 1.000000
Но это - reseted каждый раз, когда я использую его в сценарии или если я выполняю его, если экран ориентирован в режиме портрета, средства, если я работаю
xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"
после того, как я запущу скрипт, или в "левой" ориентации я добираюсь
Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
и стилус не работает корректный с этой ориентацией изменения (оставлен и т.д.),
Кажется, что во время поворота экрана происходит «сброс» матрицы преобразования координат для ручки, которая перезаписывает команду. Поэтому я добавил время ожидания между выполнением этих команд, и теперь оно работает нормально. 2 секунды не влияют, так как это время необходимо, пока экран не будет окончательно повернут
Новый скрипт:
#!/bin/sh
# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.
rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"
# Using current screen orientation proceed to rotate screen and input tools.
case "$rotation" in
normal)
# -rotate to the left
xrandr -o left
xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
sleep 2
xinput set-prop "ELAN Touchscreen Pen Pen (0)" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
;;
left)
# -rotate to normal
xrandr -o normal
xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
sleep 2
xinput set-prop "ELAN Touchscreen Pen Pen (0)" --type=float "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
;;
esac