diff --git a/docs/Hardware.md b/docs/Hardware.md index 322b255a..85441c71 100644 --- a/docs/Hardware.md +++ b/docs/Hardware.md @@ -57,39 +57,44 @@ restart KlipperScreen #### Touchscreen touch rotation If your touchscreen isn't registering touches properly after the screen has been rotated, you will need to apply a -transformation matrix. You can have the matrix be one of the following: +transformation matrix. + +First you will need your device name. + +Run: `DISPLAY=:0 xinput` + +Output +``` +⎡ Virtual core pointer id=2 [master pointer (3)] +⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] +⎜ ↳ ADS7846 Touchscreen id=6 [slave pointer (2)] +⎣ Virtual core keyboard id=3 [master keyboard (2)] + ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] +``` +In this case the device is the ADS7846 Touchscreen, yours may be different + +You can test a change by running: + +`DISPLAY=:0 xinput set-prop "" 'Coordinate Transformation Matrix' ` + +Where the matrix can be one of the following options: * 0°: `1 0 0 0 1 0 0 0 1` * 90° Clockwise: `0 -1 1 1 0 0 0 0 1` * 90° Counter-Clockwise: `0 1 0 -1 0 1 0 0 1` -* 180°: `-1 0 1 0 -1 1 0 0 1` +* 180° (Inverts X and Y): `-1 0 1 0 -1 1 0 0 1` +* invert Y: `-1 0 1 1 1 0 0 0 1` +* invert X: `-1 0 1 0 1 0 0 0 1` -To check the current matrix, you will need your `` -(which can be found via the last section, ex: "wch.cn USB2IIC_CTP_CONTROL"). -Run the following command: `xinput list-props "wch.cn USB2IIC_CTP_CONTROL"` - -It will output something such as: -``` -Device '': - Device Enabled (115): 1 - Coordinate Transformation Matrix (116): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000 - libinput Calibration Matrix (247): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000 - libinput Calibration Matrix Default (248): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000 - libinput Send Events Modes Available (249): 1, 0 - libinput Send Events Mode Enabled (250): 0, 0 - libinput Send Events Mode Enabled Default (251): 0, 0 - Device Node (252): "/dev/input/event0" - Device Product ID (253): 6790, 58083 -``` - -You can verify by checking that the 'Coordinate Transformation Matrix' or 'libinput Calibration Matrix'. - -You can test a change by running: `xinput set-prop "" 'Coordinate Transformation Matrix' ` - -Replace matrix with one of the options above, such as: `1 0 0 0 1 0 0 0 1` +For example: +`DISPLAY=:0 xinput set-prop "ADS7846 Touchscreen" 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1` To make this permanent, modify the file `/etc/udev/rules.d/51-touchscreen.rules` and add following line: ``` -ACTION=="add", ATTRS{name}=="", ENV{LIBINPUT_CALIBRATION_MATRIX}="" +ACTION=="add", ATTRS{name}=="", ENV{LIBINPUT_CALIBRATION_MATRIX}="" ``` +More info about input transformation can be found in: + +[Ubuntu wiki InputCoordinateTransformation]("https://wiki.ubuntu.com/X/InputCoordinateTransformation") +[Libinput docs]("https://wayland.freedesktop.org/libinput/doc/1.9.0/absolute_axes.html")