2017-05-15 154 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