2017-05-15 794 views
-1

Debian映像安装在HDD上。当debian映像启动并且屏幕位置水平时,触摸屏正常工作,校准正在工作。但是当屏幕旋转90度时,触摸屏校准无法正常工作。它需要校准。我试过xinput_calibrator但它没有工作。旋转的debian触摸屏上的触摸屏校准错误

如何解决触摸屏旋转时的校准问题?

回答

1

当您使用xinput_calibrator时,它会在/etc/X11/xorg.conf.d/99-calibration.conf(例如:1399 15891 421 15482)上创建一组校准值。这些值以“常规”水平方式正确显示屏幕。

当您旋转屏幕时,值和轴的交换不是自动的,因此它不能正常工作。这有点复杂,但您可以通过制作bash脚本来更正轴交换和校准值来解决此问题。

我创建了一个我们公司使用的程序 - 它可以免费使用。以下是该程序,请注意,您必须稍微玩一下,然后找到适合您的东西(您可能不需要取消注释所有行,它因屏幕而异)。在下面的情况下,我使用Fujitsu Component USB Touch Panel作为屏幕的名称,您应该使用xinput来标识您的屏幕名称并替换该名称。此外,旋转后重新启动“面板”非常重要,在我们的情况下,我们使用LXDE,因此我用lxpanelctl restart重新启动,在您的情况下可能会有所不同。

试着去理解剧本的逻辑并使其适用于您的需求:

#!/bin/bash 

# Copyright (C) 2014-2016 AdoraDeal LLC (www.adoradeal.com) 
# 
# This program is free software: you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation, either version 3 of the License, or 
# (at your option) any later version. 
# 
# This program is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
# GNU General Public License for more details. 
# 
# You should have received a copy of the GNU General Public License 
# along with this program. If not, see <http://www.gnu.org/licenses/>. 
# 
## rotatezz version 1.0.0 
## This file is part of the rotatezz program. This program will attempt 
## to rotate the screen orientation of your computer in a clockwise way. 

## Important notes: in case of a wacom being present, need to update the device name (or number, if many devices present with same name, 
## although risky because numbers can change), and comment/uncomment specific lines below, including the "xsetwacom set" line. 
## Also, when rotating, the touchscreen not always invert the touch map; in addition, the calibration (that works for normal) won't work well 
## because it will be inverted. Thus, uncomment lines below (changing the device name) to swap axis as it rotates, and also swap calibration 
##(1st value swaps with 3 value, and the second swaps with the 4th) 

varinormal="normal" 
varileft="left" 
variinvert="inverted" 
variright="right" 
rotando="$(xrandr -q --verbose 2>/dev/null | grep -si "connected" | grep -svi "disconnected" | grep -osi ') normal (\|) left (\|) inverted (\|) right (' | grep -osi 'normal\|left\|inverted\|right')" 
rotandolow="${rotando,,}" 
if [[ -z "$rotandolow" ]]; then rotandolow="nulo"; fi 
if [[ "$rotandolow" != "$varinormal" ]] && [[ "$rotandolow" != "$varileft" ]] && [[ "$rotandolow" != "$variinvert" ]] && [[ "$rotandolow" != "$variright" ]]; then 
    rotando="$(xrandr -q --verbose 2>/dev/null | grep -si ' connected ' | grep -osi 'normal\|left\|inverted\|right' | grep -si -m 1 'normal\|left\|inverted\|right')" 
    rotandolow="${rotando,,}" 
    if [[ -z "$rotandolow" ]]; then rotandolow="nulo"; fi 
fi 

#if normal, rotate to "right". 
if [[ "$rotandolow" == "$varinormal" ]]; then 
    xrandr -o right 
    #xsetwacom set "9" rotate cw 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axes Swap" 1 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Inversion" 0 1 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Calibration" 1399 15891 421 15482 
    sleep 0.3 
    lxpanelctl restart 

#if right, rotate to "inverted" 
elif [[ "$rotandolow" == "$variright" ]]; then 
    xrandr -o inverted 
    #xsetwacom set "9" rotate half 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axes Swap" 0 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Inversion" 1 1 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Calibration" 421 15482 1399 15891 
    sleep 0.3 
    lxpanelctl restart 

#if inverted, rotate to "left" 
elif [[ "$rotandolow" == "$variinvert" ]]; then 
    xrandr -o left 
    #xsetwacom set "9" rotate ccw 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axes Swap" 1 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Inversion" 1 0 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Calibration" 1399 15891 421 15482 
    sleep 0.3 
    lxpanelctl restart 

#if left, rotate to "normal" 
elif [[ "$rotandolow" == "$varileft" ]]; then 
    xrandr -o normal 
    #xsetwacom set "9" rotate none 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axes Swap" 0 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Inversion" 0 0 
    ##xinput set-prop "Fujitsu Component USB Touch Panel" "Evdev Axis Calibration" 421 15482 1399 15891 
    sleep 0.3 
    lxpanelctl restart 

#if something else, then exit 
else exit; 
fi 

exit 0 

那么这个程序是keybinded与使得屏幕旋转(每次按下旋转按钮计时按钮,这程序应该启动)。我希望这有帮助!

+0

我将xinput_calibrator中的值保存到** 99_calibration_conf **中,然后重新启动计算机。但重新启动后,旧的设置会回来。更改不是永久性的。这些变化如何变得永久? – MuminCelal

+0

'xinput'已经将(正常水平屏幕)值保存到'99_calibration_conf'。这些值是“正常”水平屏幕的正确值。当你旋转屏幕时,那些值就不再准确了,因此上面的程序会随即调整(不是永久性的)。现在,如果您希望屏幕始终设置为垂直视图,请调整程序在每次启动时自动启动,并且只包含垂直屏幕正常工作所需的值/代码。 –

+0

那么,我应该保存哪个文件,Linux在每次启动时运行哪个文件夹? – MuminCelal