Калибровка touch screen linux

How do I calibrate a touchscreen on a dual monitor system?

I have a dual monitor setup of two different sizes. My primary monitor is a 23 in widescreen Acer T230H touchscreen, and the second is a regular 20 in. When I go to use the touchscreen, the cursor shows up on the secondary display depending on where I touch the display. How do I calibrate it to only control my primary monitor?

Anyone? It has been three months. Anyone that can help me calibrate my touchscreen would be of great help.

6 Answers 6

As Beni Cherniavsky-Paskin suggested in a comment, I used the following command to map an input device to an output screen:

To figure out which is which, I first ran xinput to list the input devices. From that listing, I observed that my touchscreen was «QUANTA Optical Touch Screen» and listed as device id 12. I then ran xrandr to determine the touchscreen, which in my case was VGA1.

Simply entering the following command then did the trick:

xinput map-to-output 12 VGA1 

xinput ( at least as of version 1.6.2 allows you to use the device name instead of the ID ( which can change) . so the above xinput command becomes:

and you can use that command to make it persistent. For KDE you can use the Autostart program and enter that command with its options in «Add Program», or put it in a file, make it executable and select it from Autostart. For others try searching for: xinput startup and one of gnome, LWM or cinnimon etc.

Hey JJones, you should add the name version of that command to an actual answer rather than in the comments, it was really helpful! 🙂

As Beni Cherniavsky-Paskin and Paul Lammertsma suggested in above comments xinput map-to-output did the trick for me!

you first need to run xinput to get the id of inupt device,

the above command return something like this for me.

user@user-hpEnvy:~$ xinput ⎡ Virtual core pointer [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer [slave pointer (2)] ⎜ ↳ Logitech Unifying Device. Wireless PID:401b [slave pointer (2)] ⎜ ↳ Logitech Unifying Device. Wireless PID:4016 [slave pointer (2)] ⎜ ↳ ELAN20E7:00 04F3:20E7 [slave pointer (2)] ⎜ ↳ SynPS/2 Synaptics TouchPad [slave pointer (2)] ⎣ Virtual core keyboard [master keyboard (2)] ↳ Virtual core XTEST keyboard [slave keyboard (3)] ↳ Power Button [slave keyboard (3)] ↳ Video Bus [slave keyboard (3)] ↳ Video Bus [slave keyboard (3)] ↳ Power Button [slave keyboard (3)] ↳ HP Truevision HD [slave keyboard (3)] ↳ AT Translated Set 2 keyboard [slave keyboard (3)] ↳ HP Wireless hotkeys [slave keyboard (3)] ↳ HP WMI hotkeys 

Next I ran xrandr to get the list of screens and the output of the command is like this

user@user-hpEnvy:~$ xrandr Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767 eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm 1920x1080 60.0*+ 59.9 40.0 1680x1050 60.0 59.9 1600x1024 60.2 1400x1050 60.0 1280x1024 60.0 1440x900 59.9 1280x960 60.0 1360x768 59.8 60.0 1152x864 60.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 HDMI1 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 600mm x 340mm 1920x1080 60.0*+ 50.0 59.9 1680x1050 59.9 1600x900 60.0 1280x1024 60.0 1440x900 59.9 1280x720 60.0 50.0 59.9 1024x768 60.0 800x600 60.3 720x576 50.0 720x480 60.0 59.9 640x480 60.0 59.9 720x400 70.1 VIRTUAL1 disconnected (normal left inverted right x axis y axis) 

In my case the touch device is ELAN20E7:00 04F3:20E7 > and touch enabled screen is eDP1 to fix the issue i need to map the device the that monitor only for that i ran this command xinput map-to-output 13 eDP1

Читайте также:  Php extension dir linux

Problem solved and its working fine again 🙂

I am using elementary OS freya, so it should work for all distros based on Ubuntu 14.04 LTS

This worked perfectly on my Dell Inspiron 5547. Interestingly I used id=13 which corresponds to my ELAN Touchscreen , even though SynPS/2 Synaptics TouchPad is what xinput-calibrator was using by default.

Worked for me also on a Lenovo Thinkpad T460 with external monitors. The device to be used is Melfas LGD AIT Touch Controller . This is also a good resource on the topic: wiki.archlinux.org/index.php/Touchscreen

I saw that the elantech device gets different id: each boot, so I’ve ended up with a little helper script: gist.github.com/erm3nda/3eda9fbcb7a1c18dc91990f1d306c512.

Very hard to find solution but actually pretty straight forward, just follow the answer from ‘phnomic’ here: Touchscreen and additional external monitor. Works flawless with my Fujitsu T730 with all kinds of external monitors!

This uses xsetwacom, which I presume only works for Wacom devices? However there is a generic xinput map-to-output which is similar in spirit.

@m3nda you’re replying to a comment made over 7 years ago, when there was only the 2011 answer and this one. I’ll delete the comment I made back then to avoid further confusion, I imagine many better solutions exist nowadays.

xinput-calibrator did not help me. It spanned across the entire display space, which is not all accessible on my setup. I tried manually setting calibration values to the size and position of the touchscreen but it had no effect. The answers using xinput map-to-output were easier and more helpful.

At least for Wacom touchscreens, there is the additional issue that they stop working after a suspend-and-resume cycle. So they first have to be attached again and then calibrate for dual monitor usage. Here is a solution that does both:

  1. Create (and then test) a custom systemd service to re-attach your touchscreen when the system comes back from suspend, using my other answer here.
  2. Create a script /usr/local/bin/local-touchscreen-tweaks with the following content:
#!/usr/bin/env bash # We need to sleep about 2 seconds after the start of the wacom-inputattach # service, or the touchscreen device will not yet be there to work with. sleep 2 # xsetwacom needs to connect to an X server. export XAUTHORITY=/home/matthias/.Xauthority export DISPLAY=:0 # Tell the touch devices to interpret input relative to the physical # touchscreen display only, here LVDS-1. Needed in multi-monitor setups. # Use device names as seen in `xinput --list`. xsetwacom set "Wacom Serial Penabled 2FG Touchscreen Pen stylus" MapToOutput LVDS-1 xsetwacom set "Wacom Serial Penabled 2FG Touchscreen Pen eraser" MapToOutput LVDS-1 xsetwacom set "Wacom Serial Penabled 2FG Touchscreen Finger touch" MapToOutput LVDS-1 
[Unit] Description=calibrate the touchscreen for dual-monitor usage After=restart-wacom-inputattach.service [Service] User=root Type=oneshot ExecStart=/usr/local/bin/local-touchscreen-tweaks TimeoutSec=0 StandardOutput=syslog [Install] WantedBy=suspend.target 
sudo systemctl enable /etc/systemd/system/local-touchscreen-tweaks.service 

I ran into a similar issue. I switch between using 2 and 4 touch screen monitors, all of which show the exact same name and changing device ID’s, making all of the solutions I found pretty much useless. So, I wrote my own script. It captures the the ID’s using xinput and the xrandr to capture the available displays. If you don’t have Yad installed, it will attempt to install it.

It then uses Yad to popup a confirmation box in the corners of your monitors. Click ok, if the click does not hit the ‘OK’, it assumes your display and touch inputs are mismatched and attempts to match to the next until you actually hit ‘OK’. Then it moves on to the next monitor.

This has to be ran everytime I log in, whether it’s a reboot or my system was locked, but I set mine to run when I hit win+f (F for fix my crap), so it’s pretty quick and painless to reset everything. I’ve yet to find a way to make it persistent. I also keep the code on git-hub. Any updates I make, I will post there (https://github.com/pvtcompyle/set-touch). If anyone can think of a way to make this kind of setup persistent, I would love to hear about it!

#!/bin/bash # This script requires yad to be installed. If it is not installed, run: # sudo apt install yad # check for yad installation monkg -l "yad" if [ $? = '1' ] then printf "Yad is not installed" sudo apt install yad fi # run xinput and find the search text for your touch screens, then set it below screenSearch="Touch" # run xrandr and find the search text for your monitors, then set it below monintorSearch="DisplayPort-" # dump xinput id's xrandr monitor searches into arrays idArr=($(xinput | grep $screenSearch | awk '')) monArr=($(xrandr | grep -E "$monintorSearch9 connected" | awk -F '[-" "]' '')) cdate=($(date -I'seconds')) # these are x and y coordinates to place pop-up alerts. # adjust for your preference, screen resolution, and number of monitors. # if fewer monitors are detected than are defined here, it's ok. # to find your coordinates run the following from a terminal: # yad --posx= --posy= monx=(1620 2120 1620 2120) mony=(880 880 1180 1180) # loop through monitors. for mon in "$" do index=0 declare -i mon # loop through touch screen id's for id in "$" do declare -i id xinput map-to-output $id $monintorSearch$mon # pop up box at monx and mony coordinates. Tap OK, if it's registered on the wrong screen, it will prompt again. yad --posx=$ --posy=$ --close-on-unfocus --title="stuff" --text="Matching input: $id to Monitor: $mon." result=$? case $result in 0) idArr=($) break ;; 252) ((index=index+=1)) ;; *) echo 'Unknown input' $result ;; esac done done 

Источник

Калибровка тачскрина

Тачскрин работает, но неправильно, нужно откалибровать. Установил и запустил xinput_calibrator , ткнул 4 точки. Ничего не изменилось (хотя на этом этапе уже должно правильно работать!) Попробовал по указанию программы сохранить настройки в файлик /usr/share/X11/xorg.conf.d/99-calibration.conf :

Section "InputClass" Identifier "calibration" MatchProduct "Silead GSLx680 Touchscreen" Option "MinX" "67097" Option "MaxX" "401" Option "MinY" "-8966" Option "MaxY" "62759" Option "SwapXY" "0" # unless it was already set to 1 Option "InvertX" "0" # unless it was already set Option "InvertY" "0" # unless it was already set EndSection 

В этой директории и другие похожие файлы есть, вроде 70-wacom.conf и пр. После ребута так же ничего не изменилось. Попробовал и в /etc/X11/xorg.conf.d/ закинуть (директорию пришлось создать) – так же ничего не поменялось.

Вот еще информация, которая может помочь: xinput -list

⎡ Virtual core pointer [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer [slave pointer (2)] ⎜ ↳ SteelSeries Rival Gaming Mouse [slave pointer (2)] ⎜ ↳ SteelSeries Rival Gaming Mouse [slave pointer (2)] ⎜ ↳ Silead GSLx680 Touchscreen [slave pointer (2)] ⎜ ↳ ImPS/2 Logitech Wheel Mouse [slave pointer (2)] ⎣ Virtual core keyboard [master keyboard (2)] ↳ Virtual core XTEST keyboard [slave keyboard (3)] ↳ Power Button [slave keyboard (3)] ↳ Video Bus [slave keyboard (3)] ↳ Power Button [slave keyboard (3)] ↳ SteelSeries Rival Gaming Mouse [slave keyboard (3)] ↳ PC Cam [slave keyboard (3)] ↳ AT Translated Set 2 keyboard [slave keyboard (3)] ↳ SteelSeries Rival Gaming Mouse [slave keyboard (3)] 

(Мой девайс под номером 13)

Device 'Silead GSLx680 Touchscreen': Device Enabled (155): 1 Coordinate Transformation Matrix (157): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Calibration Matrix (314): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Calibration Matrix Default (315): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Send Events Modes Available (279): 1, 0 libinput Send Events Mode Enabled (280): 0, 0 libinput Send Events Mode Enabled Default (281): 0, 0 Device Node (282): "/dev/input/event9" Device Product ID (283): 0, 0 

Попробовал поиграться с set-prop – тоже безрезультатно. Свойство вроде применяется (?), но эффекта нет. xinput set-prop 13 —type=atom —format=32 InvertX 1 , xinput list-props 13 :

Device 'Silead GSLx680 Touchscreen': Device Enabled (155): 1 Coordinate Transformation Matrix (157): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Calibration Matrix (314): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Calibration Matrix Default (315): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 libinput Send Events Modes Available (279): 1, 0 libinput Send Events Mode Enabled (280): 0, 0 libinput Send Events Mode Enabled Default (281): 0, 0 Device Node (282): "/dev/input/event9" Device Product ID (283): 0, 0 InvertX (578): "PRIMARY" (1) 

Этот тред я читал, но не понял, как тамошний гуру всё разрулил, да и у того человека калибровка уже работала, а у меня ничего.

Источник

Оцените статью
Adblock
detector