Alinhe a caneta (caneta) com a tela sensível ao toque na tela girada no Acer Travelmate Spin B1

0

Encontrei um script para girar minha tela e o touchpad para a esquerda e voltar ao normal:

#!/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

Funciona bem. Mas o que não está funcionando é a caneta se a tela for girada. Eu encontrei uma solução potencial alterando a Matriz de Transformação de Coordenadas para a caneta com:

xinput set-prop 'ELAN Touchscreen Pen Pen (0)' "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1

Isso funciona bem, significa que se a tela estiver orientada como normal e eu executar este comando

xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"

leva a

Coordinate Transformation Matrix (144): 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 1.000000

Mas ele é redefinido toda vez que eu usá-lo no script ou se eu o executar se a tela estiver orientada no modo retrato, significa que se eu executar

xinput list-props 'ELAN Touchscreen Pen Pen (0)' | grep "Coordinate Transformation Matrix"

depois de executar o script ou na orientação "esquerda", obtenho

Coordinate Transformation Matrix (144): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000

e a caneta não está funcionando corretamente com essa orientação de alteração (acima é deixado, etc.)

    
por MelBourbon 08.06.2018 / 22:13

1 resposta

0

Parece que há uma "redefinição" da matriz de transformação de coordenadas para a caneta no momento em que a tela é girada, o que substitui o comando. Então eu adicionei um tempo de sono entre a realização desses comandos e agora está funcionando bem. 2 segundos não tem impacto, pois esse tempo é necessário até que a tela seja finalmente girada

Novo script:

#!/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
    
por MelBourbon 09.06.2018 / 22:33