3

I'm on a lenovo thinkpad x220t running a fresh installation of fedora 22. Everything works fine, except when I connect the tablet to a projector, due to change of resolution the pen is not calibrated anymore. I've tried xinput_calibrator to adjust it, but since it "auto-detect"s misclicks I can't really get it to work. I tried to turn it off using the option --misclick 0, but that also didn't work. The option --precalib doesn't get me anywhere.

I think the best way to work this out for me is to set in manually in xinput, but I can't find the options in the xinput manual. So, here is my question:

Questions: In the xinput, I want to use the option --set-int-prop device property format value. The name of the device for me is "Wacom ISDv4 E6 Pen stylus".

  1. What shall I use as property for x_min, x_max etc.?
  2. What shall be the format? I know the available formats are 8, 16, and 32, but which one shall I choose and what do they mean?
  3. Is there anywhere I can read more about these options?

--

Alternatively, is there a better way of dealing with this calibration? The xinput_calibrator manual says I probably have one of the following problems:

  1. you are bad at clicking on crosses, use a stylus or increase the --misclick threshold
  2. your device is not properly supported by the kernel, it interprets the clicks wrong
  3. your screen has a non-linear deformation, 4-point calibration can not help you

well, I'm sure 1 is not the case. It cannot be 2, because it works fine in the original resolution. And it probably isn't 3 since I can really see that it is a linear deformation as the pen gets to the edge of the monitor (not screen) the pointer is on the edge of the screen and in the center they match! I believe all I need is to tell xinput to scale everything by a constant factor, which I don't know how.

Any help would be really appreciated.


UPDATE: The instruction here exactly tells me how to "scale" and "shift" the screen, but it seems like I can't get the numbers right. Here are some of my outputs:

for xrandr I get several lines, and among them there are:

1366x768      60.02 +
...
1024x768      60.00*
...

The top one (the one with +) is the highest my monitor supports, and in that resolution I get pen to work properly. The bottom one (the one with *) is my current resolution. The numbers that the link suggest to use are:

 c0 = touch_area_width / total_width
 c2 = touch_area_height / total_height
 c1 = touch_area_x_offset / total_width
 c3 = touch_area_y_offset / total_height

c2 = 1 and c3 = 0 for me, since I don't have any problem with width. for c0 and c3 I'm using this numbers: touch_area_width = 1366 total_width = 1024 touch_area_x_offset = -171

I'm getting 171 from (1366 - 1024) / 2.

This translation "almost" works. Does anyone know which of this parameters I'm using wrong, and how do I find its exact value?

  • Now if I only get an app to tell me what are the coordinates of a point that I tap on, I can do the rest of the calculations myself to find the matrix. – Keivan Sep 15 '15 at 19:23
  • With trial and error I got this matrix to work: 1.345 0 -0.17 0 1 0 0 0 1. But I still like to know what should be the exact values. – Keivan Sep 15 '15 at 19:32
3

I found this wiki post from ArchLinux and it does exactly what I need to do, except the numbers are a little off. This thread got too messy, I'm answering it, but there's still one last but that I need to work out (see below).

To follow the discussion on this last bit see this post.

Here is what I've done:

From xrandr I get:

Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
LVDS1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 277mm x 156mm
   1366x768      60.02 +
   1280x720      60.00  
   1024x768      60.00* 
   1024x576      60.00  
   ...

The one with + is maximum resolution my monitor supports and the one with * is the current resolution. So, I conclude

total_width = 1024
touch_area_width = 1366
touch_area_x_offset = (1024 - 1366) /2 = -171

This is probably what I'm doing wrong, because at the end I don't get exactly what I need, but almost there.

Then I look at the output of xinput list

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Logitech M325                               id=9    [slave  pointer  (2)]
⎜   ↳ Wacom ISDv4 E6 Pen stylus                   id=10    [slave  pointer  (2)]
⎜   ↳ Wacom ISDv4 E6 Finger                       id=11    [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                  id=13    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                       id=14    [slave  pointer  (2)]
⎜   ↳ Wacom ISDv4 E6 Pen eraser                   id=16    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Sleep Button                                id=8    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=12    [slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                      id=15    [slave  keyboard (3)]

The lines 4,5, and 8 are the ones that I need, so the DEVICE NAMEs for me will be "Wacom ISDv4 E6 Pen stylus", "Wacom ISDv4 E6 Finger", and "Wacom ISDv4 E6 Pen eraser".

xinput list-props "device name" | grep Matrix should list the current Coordinate Transformation Matrix. The default is the identity matrix which is listed by rows:

Coordinate Transformation Matrix (138): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000

The transformation matrix is The matrix is

[ c0 0  c1 ]
[ 0  c2 c3 ]
[ 0  0  1  ]

The tutorial says to calculate the matrix as follows: (the numbers on the right are the ones that I calculated for my case)

c0 = touch_area_width / total_width = 1366/1024 = 1.333984375
c2 = touch_area_height / total_height = 768/768 = 1
c1 = touch_area_x_offset / total_width = -171/768 = -0.22265625
c3 = touch_area_y_offset / total_height = 0/768 = 0

The reason c2=1 and c3=0 for me is that in my situation the height is fine, so I only need to scale and shift the width.

All I need to do now is to represent my matrix as an array of rows, that is:

c0 0 c1 0 c2 c3 0 0 1

and that for me becomes:

1.333984375 0 -0.22265625 0 1 0 0 0 1

Then the following command should do the translation for me:

xinput set-prop "DEVICE NAME" --type=float "Coordinate Transformation Matrix" 1.333984375 0 -0.22265625 0 1 0 0 0 1

That almost gets me where I want to be except it's still a little off. So, I did a little bit of trial and error to get the following numbers 1.345 0 -0.17 0 1 0 0 0 1

So, here is my question

How to find the exact values for the transformation matrix? I need to work with different resolutions and I can't repeat the trial and error process for all of them!

1

I think your calculation of c1 is wrong. Instead of -171/768, you should have -171/1024 = -0.167, which matches what you found experimentally.

  • oh, wow, you're absolutely right. I'm not sure how could I mess this up. Thanks for pointing it out. – Keivan Jul 21 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.