Permalink
Browse files

Fix evdev calibration when invertX/Y is set

From evdev 2.3.2 onwards, it does something crazy when the
invertX/Y option is manually set
This has to be undone in the calibrator before doing the calib
calculation.

I say 'manually set' above because invertX/Y is a useless option:
xf86ScaleAxis can deal with axis inversion automatically,
hence, nobody should ever ever set invertX/Y ever.
Just let the calibrator calculate the calibration for you!
  • Loading branch information...
tias committed Jun 26, 2012
1 parent 555bdf1 commit 840bb215e0af9f2f97a3334e4be81771e5a7d02f
Showing with 22 additions and 0 deletions.
  1. +22 −0 src/calibrator/Evdev.cpp
View
@@ -195,6 +195,28 @@ bool CalibratorEvdev::finish(int width, int height)
float y_min = (clicked.y[UL] + clicked.y[UR])/2.0;
float y_max = (clicked.y[LL] + clicked.y[LR])/2.0;
// When evdev detects an invert_X/Y option,
// it performs the following *crazy* code just before returning
// val = (pEvdev->absinfo[i].maximum - val + pEvdev->absinfo[i].minimum);
// undo this crazy step before doing the regular calibration routine
if (old_axys.x.invert) {
x_min = width - x_min;
x_max = width - x_max;
// avoid invert_x property from here on,
// the calibration code can handle this dynamically!
new_axis.x.invert = false;
}
if (old_axys.y.invert) {
y_min = height - y_min;
y_max = height - y_max;
// avoid invert_y property from here on,
// the calibration code can handle this dynamically!
new_axis.y.invert = false;
}
// end of evdev inversion crazyness
// Should x and y be swapped?
if (abs(clicked.x[UL] - clicked.x[UR]) < abs(clicked.y[UL] - clicked.y[UR])) {
new_axis.swap_xy = !new_axis.swap_xy;

0 comments on commit 840bb21

Please sign in to comment.