How to setup x11 touchscreen in linux desktop?

17,989

Solution 1

Quick answer:

xinput --map-to-output deviceid screenname

Also gnome and kde have GUIs for that.

I also noticed that the calibration coordinates returned from "xinput calibrator" are 0 4095 0 4095 , which are MinX,MaxX,MinY,MaxY. But my real screen resolution is 1920x1080(for each monitors).

As far as the computer is concerned a touchscreen is not one device but a screen and a separate touchpad that just happens to be located at the same physical place. Think of a wacom (pen) drawing tablet and separate large screens which might have different aspect ratio.Then you want your pen movement to correspond to an appropriate stroke on (part of) the screen.

Solution 2

You could use xinput_calibrator to calibrate the touchscreen. Main site for this daemon tool - http://fourdollars.github.io/x11-touchscreen-calibrator/.

X11 Touchscreen Calibrator runs as a daemon in the background. It will detect the touchscreen automatically and adjust the corresponding Coordinate Transformation Matrix of Touchscreen xinput when the resolution is changed. It should also support rotation, reflection and different scaling modes of display output.

Share:
17,989

Related videos on Youtube

Monku
Author by

Monku

Coder in C#/C/C++.

Updated on September 18, 2022

Comments

  • Monku
    Monku over 1 year

    I am using opensuse desktop with two screens, top and bottom. Only the bottom screen is touchscreen, which is USB touchscreen. Both monitors are used as a single screen. I tried to configure the touch screen via xorg.conf file using the following parameters for InputDevice:

    Section "InputDevice"
      Driver       "evdev"
      Identifier   "touchscreen"
      Option       "Device" "/dev/input/event3"
      Option       "Name" "Kortek touch screen"
      #Option      "GrabDevice" "true"
      Option       "InvertY" "true"
      Option       "Calibration 0 4095 0 4095"
      Option       "Emulate3Buttons" "true"
      Option       "Emulate3Timeout"     "50"
    EndSection
    

    Using this I can see the touch events as the mouse cursor moves. But the Y coordinates are not correct. x cooridates are fine. But Y coordinates pan upto the top-edge of the top screen, while I move my finder to the top-edge of bottom screen.

    Now, after reading through various articles on internet, I came across this website : https://wiki.archlinux.org/index.php/Calibrating_Touchscreen It talks about "Transformation Matrix". I tried to use it but Y coordinates are still wrong.

    I noticed that when I plug off the top screen and re-enter the x window desktop, after logging out. The touch coordinates are correct.

    So, I want to know what is wrong with my configuration.

    I also noticed that the calibration coordinates returned from "xinput calibrator" are 0 4095 0 4095 , which are MinX,MaxX,MinY,MaxY. But my real screen resolution is 1920x1080(for each monitors).

    • George Vasiliou
      George Vasiliou over 7 years
      If you remove the invertY option how it behaves? more over provide output of xinput list-props screenId
  • hellork
    hellork about 3 years
    This was handy. For others who may stumble upon this, the deviceid is reported by xinput with no arguments. And the screenname is the one reported by xrandr. Kudos.