Closed DRAgon734465502 closed 3 years ago
That is because now x server uses libinput to handle input devices instead of evdev. https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=172025&p=1123456
As to coordination transformation matrix, you have to add the following code within the section of touchscreen in 99-callibration.conf or 40-libinput.conf.
in case of inverting x,
Option "TransformationMatrix" "-1 0 1 0 1 0 0 0 1"
in case of inverting y,
Option "TransformationMatrix" "1 0 0 0 -1 1 0 0 1"
in case of swapping x and y,
Option "TransformationMatrix" "0 1 0 1 0 0 0 0 1"
, etc...
You can confirm the properties of the input device by following commands.
$ xinput list
$ xinput list-props "ADS7846 Touchscreen"
Thank for swkim01' replay
Together the 3 problems:
1 The calibration file “/etc/X11/xorg.conf.d/99-calibration.conf” is not working Now. if you change any parameters of 99-calibration.conf ,Nothing will happen
The touch parameters “xmin ymin xmax ymax” of dtoverlay=ads7846 or fbtft Device Tree can not be set and if you change the 4 parameters , they will change nothing and keep the default setting
Then the touch go to X Inverted and I change "xmin=200,xmax=3900 " to "xmin=3900,xmax=200" but nothing happened
Now the big question is how we can calibrate the touchscreen??
Becasue of the question 2, I can not get the right calibration number Becasue of the question 1 and 3 , if I can get the right calibration number , I also do know how to make them work
With reference to above link, the other solution to calibrate without changing 99-calibration.conf file is to reuse evdev simply.
$ sudo apt-get install xserver-xorg-input-evdev
@swkim01 can you tell me my question 3 The touch parameters “xmin ymin xmax ymax” of dtoverlay=ads7846 or fbtft Device Tree can not be set and if you change the 4 parameters , they will change nothing and keep the default setting
Then the touch go to X Inverted and I change "xmin=200,xmax=3900 " to "xmin=3900,xmax=200" But nothing happened
@DRAgon734465502 I don't know what exactly the parameters of the touchscreen driver mean. My guess is that they are just "ranges" of axes, not "limit values"...
@swkim01 Sorry to disturb you again, I have tried your methion
But also do not know how to calibrate
I have done what you writed 1,2,3
When run the calibration xinput APP, also get very big calibrate number "22186" "22186""48964""48827"
I write them to file 99-calibration.conf and reboot, change nothing
what do you mean “, the other solution to calibrate without changing 99-calibration.conf file is to reuse evdev simply.” ?
“ reuse evdev simply.” is meaning what?
@DRAgon734465502
That means the X11 server use the touchscreen device by evdev module, not new libinput.
You can use it on x window with old settings as it was.
Please compare two output results of the following command with and without 45-evdev.conf.
$ xinput list-props "ADS7846 Touchscreen"
I have compared two output results of the following command with and without 45-evdev.conf. $ xinput list-props "ADS7846 Touchscreen"
they are same output
under /usr/share/X11/xorg.conf.d/ ,not have 45-evdev.conf. I enter the command: $ xinput list-props "ADS7846 Touchscreen"
I make a new file 45-evdev.conf under /usr/share/X11/xorg.conf.d/ $ sudo nano /usr/share/X11/xorg.conf.d/45-evdev.conf And add the following code to it Section "InputClass" Identifier "calibration" MatchProduct "ADS7846 Touchscreen" Option "Calibration" "3932 300 294 3801" Option "SwapAxes" "0" Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1" EndSection
Then enter the the command: $ xinput list-props "ADS7846 Touchscreen"
Get same results :
I just want to be sure that Now we can not calibrate by writing the 4 numbers <Option "Calibration" "3932 300 294 3801">:
And just can calibrate by set <Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1">
To <Option "TransformationMatrix" "0 -1.10 1.06 1.12 0 -0.06 0 0 1">
???
If so, which is too hard to calibrate , I find that when I set the touch like {Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1" },which is not very Accurate
So I change to set to {Option "TransformationMatrix" "0 -1.10 1.06 1.12 0 -0.06 0 0 1"},
Then touch is very Accurate but I change the number by eye and Increase or decrease to get the best number which is so difficult
It seems that my comment was not exact. You have to get different outputs. The content of 45-evdev.conf is as follows or same as 10-evdev.conf.
# ...
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Then reboot or restart X window. Now since x window uses evdev module for input device, you have to get the result like as :
$ xinput list-props "ADS7846 Touchscreen"
Device 'ADS7846 Touchscreen':
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (235): 0
Device Accel Constant Deceleration (236): 1.000000
Device Accel Adaptive Deceleration (237): 1.000000
Device Accel Velocity Scaling (238): 10.000000
Device Product ID (239): 0, 0
Device Node (240): "/dev/input/event3"
Evdev Axis Inversion (241): 1, 0
Evdev Axis Calibration (242): <no items>
Evdev Axes Swap (243): 0
Axis Labels (244): "Abs X" (232), "Abs Y" (233), "Abs Pressure" (234)
Button Labels (245): "Button Unknown" (231), "Button Unknown" (231), "Button Unknown" (231), "Button Wheel Up" (119), "Button Wheel Down" (120)
Evdev Scrolling Distance (246): 0, 0, 0
Evdev Middle Button Emulation (247): 0
Evdev Middle Button Timeout (248): 50
Evdev Third Button Emulation (249): 0
Evdev Third Button Emulation Timeout (250): 1000
Evdev Third Button Emulation Button (251): 3
Evdev Third Button Emulation Threshold (252): 20
Evdev Wheel Emulation (253): 0
Evdev Wheel Emulation Axes (254): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (255): 10
Evdev Wheel Emulation Timeout (256): 200
Evdev Wheel Emulation Button (257): 4
Evdev Drag Lock Buttons (258): 0
Yes I get that result
@DRAgon734465502
Try to rotate your display, here you have some matrices:
Right rotate
xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
Left rotate
xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
Invert
xinput set-prop 'ADS7846 Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
i created a small visualizer for it: https://codepen.io/GottZ/full/pWpNgK/ just throw the first 6 numbers into the input field at the bottom. tell me if you really need the other three numbers. (i'd have to move away from how i'm currently doing it) it has a live preview. black is basically the display and red is the touch data.
in addition some background info about what the first 6 numbers do:
new feature using arrow keys:
@GottZ That is fantastic! Just what I needed to visualize what was happening. Thank you very much.
https://wiki.archlinux.org/index.php/Calibrating_Touchscreen There is way how to calibrate touch screen. Maybe it will be useful to make some calibration application
added some instructions etc. and made it public. well.. i guess the next step would be to implement xinput-calibrator for matrices. oh and it also has a live preview text. just throw it into your ssh shell and it will apply calibration for your screen. (well.. you might need to change it slightly but as far as i've seen this would work for most people)
Yes, it would be great to make something similar to xinput-calibrator, but for matrices. I was playing with this last night: https://github.com/KurtJacobson/xtcal
It has a very similar interface to xinput-calibrator and seems promising.
Good job guys 😎
Making the touchscreen device default to the evdev driver rather than the libinput driver is pretty simple, and solves the problem. Make sure evdev driver is installed:
$ sudo apt-get install xserver-xorg-input-evdev
Then simply add a Driver directive - my /usr/share/X11/xorg.conf.d/99-calibration.conf
looks like:
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "56 4019 3893 120"
Option "SwapAxes" "1"
Driver "evdev"
EndSection
Works well for my WaveShare 7" HDMI Touchscreen.
Note: you can tell which driver is being used by looking at /var/log/Xorg.0.log
. Before switching drivers, mine contained:
[ 9.831] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/event2)
[ 9.831] (**) ADS7846 Touchscreen: Applying InputClass "evdev touchscreen catchall"
[ 9.831] (**) ADS7846 Touchscreen: Applying InputClass "libinput touchscreen catchall"
[ 9.831] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[ 9.831] (II) LoadModule: "libinput"
[ 9.832] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[ 9.862] (II) Module libinput: vendor="X.Org Foundation"
[ 9.862] compiled for 1.18.4, module version = 0.20.0
[ 9.862] Module class: X.Org XInput Driver
[ 9.862] ABI class: X.Org XInput driver, version 22.1
[ 9.862] (II) Using input driver 'libinput' for 'ADS7846 Touchscreen'
After adding the Driver declaration:
[ 9.915] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/event2)
[ 9.915] (**) ADS7846 Touchscreen: Applying InputClass "evdev touchscreen catchall"
[ 9.915] (**) ADS7846 Touchscreen: Applying InputClass "libinput touchscreen catchall"
[ 9.915] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[ 9.915] (II) LoadModule: "evdev"
[ 9.915] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so
[ 9.928] (II) Module evdev: vendor="X.Org Foundation"
[ 9.928] compiled for 1.18.4, module version = 2.10.3
[ 9.928] Module class: X.Org XInput Driver
[ 9.928] ABI class: X.Org XInput driver, version 22.1
[ 9.928] (II) Using input driver 'evdev' for 'ADS7846 Touchscreen'
https://github.com/gamelaster/evdev-calibration I did a calibration app, it's not perfect, but it's works
Black on red best combination for color blind ppl :P
I'm going to see if I can manage to figure how to use these tools as I'm having issues with my touchscreen x axis, keeps going to far to the right into my other screen for some reason...
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
The lastest raspbian OS have updated to 2017-03-02-raspbian-jessie
But the touch can not work well ,I use waveshare 3.5inch LCD with ads7846/xpt2046
The file 99-calibration.conf can not work well, seem the file have stopped to work but it can work well at old version Raspbian
the Touch reverse, touch X axis but go to Y axis
please Who can help me , I am very urgent