qte-2.3.10: integrate tslib RMK calibration algorithm to calibrated mouse handler...
authorMichael Lauer <mickey@vanille-media.de>
Sat, 3 Sep 2005 20:25:00 +0000 (20:25 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Sat, 3 Sep 2005 20:25:00 +0000 (20:25 +0000)
packages/qte/qte-2.3.10/improve-calibration-r0.patch [new file with mode: 0644]
packages/qte/qte_2.3.10.bb

diff --git a/packages/qte/qte-2.3.10/improve-calibration-r0.patch b/packages/qte/qte-2.3.10/improve-calibration-r0.patch
new file mode 100644 (file)
index 0000000..6052510
--- /dev/null
@@ -0,0 +1,159 @@
+Index: qt-2.3.10/src/kernel/qwsmouse_qws.cpp
+===================================================================
+--- qt-2.3.10.orig/src/kernel/qwsmouse_qws.cpp 2005-08-31 13:44:12.000000000 +0000
++++ qt-2.3.10/src/kernel/qwsmouse_qws.cpp      2005-09-01 19:38:27.000000000 +0000
+@@ -14,10 +14,6 @@
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file.
+ **
+-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
+-** licenses for Qt/Embedded may use this file in accordance with the
+-** Qt Embedded Commercial License Agreement provided with the Software.
+-**
+ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ **
+@@ -30,6 +26,12 @@
+ **
+ **********************************************************************/
++/* 
++ *  The 5 point algorithim in QTSLibHandlerPrivate::calibrate() is
++ *  GPL only code and Copyright (C) 2001 Russel King.
++ *
++ *  Taken from ts_calibrate.c from tslib
++ */
+ #include "qwindowsystem_qws.h"
+ #include "qsocketnotifier.h"
+ #include "qwsevent_qws.h"
+@@ -1813,6 +1815,7 @@
+ void QTSLibHandlerPrivate::calibrate( QWSPointerCalibrationData * cd)
+ {
++#ifdef ORIG_CALIBRATE
+     QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
+     QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
+     QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
+@@ -1843,6 +1846,122 @@
+     {
+         qDebug( "Could not save calibration: %s", calFile.latin1() );
+     }
++
++#else
++    int j;
++    float n, x, y, x2, y2, xy, z, zx, zy;
++    float det, cal_a, cal_b, cal_c, cal_d, cal_e, cal_f, cal_i;
++    float scaling = 65536.0;
++    int cal_x[5], cal_xfb[5], cal_y[5], cal_yfb[5], cal_o[7];
++
++    cal_x[0]=cd->devPoints[ QWSPointerCalibrationData::TopLeft ].x();
++    cal_y[0]=cd->devPoints[ QWSPointerCalibrationData::TopLeft ].y();
++    cal_x[1]=cd->devPoints[ QWSPointerCalibrationData::TopRight ].x();
++    cal_y[1]=cd->devPoints[ QWSPointerCalibrationData::TopRight ].y();
++    cal_x[2]=cd->devPoints[ QWSPointerCalibrationData::BottomLeft ].x();
++    cal_y[2]=cd->devPoints[ QWSPointerCalibrationData::BottomLeft ].y();
++    cal_x[3]=cd->devPoints[ QWSPointerCalibrationData::BottomRight ].x();
++    cal_y[3]=cd->devPoints[ QWSPointerCalibrationData::BottomRight ].y();
++    cal_x[4]=cd->devPoints[ QWSPointerCalibrationData::Center ].x();
++    cal_y[4]=cd->devPoints[ QWSPointerCalibrationData::Center ].y();
++
++    cal_xfb[0]=cd->screenPoints[ QWSPointerCalibrationData::TopLeft ].x();
++    cal_yfb[0]=cd->screenPoints[ QWSPointerCalibrationData::TopLeft ].y();
++    cal_xfb[1]=cd->screenPoints[ QWSPointerCalibrationData::TopRight ].x();
++    cal_yfb[1]=cd->screenPoints[ QWSPointerCalibrationData::TopRight ].y();
++    cal_xfb[2]=cd->screenPoints[ QWSPointerCalibrationData::BottomLeft ].x();
++    cal_yfb[2]=cd->screenPoints[ QWSPointerCalibrationData::BottomLeft ].y();
++    cal_xfb[3]=cd->screenPoints[ QWSPointerCalibrationData::BottomRight ].x();
++    cal_yfb[3]=cd->screenPoints[ QWSPointerCalibrationData::BottomRight ].y();
++    cal_xfb[4]=cd->screenPoints[ QWSPointerCalibrationData::Center ].x();
++    cal_yfb[4]=cd->screenPoints[ QWSPointerCalibrationData::Center ].y();
++
++    //qDebug("Top left : X = %4d Y = %4d", cal_x[0], cal_y[0]);
++    //qDebug("Top right: X = %4d Y = %4d", cal_x[1], cal_y[1]);
++    //qDebug("Bot left : X = %4d Y = %4d", cal_x[2], cal_y[2]);
++    //qDebug("Bot right: X = %4d Y = %4d", cal_x[3], cal_y[3]);
++    //qDebug("Middle: X = %4d Y = %4d", cal_x[4], cal_y[4]);
++
++    // Get sums for matrix
++    n = x = y = x2 = y2 = xy = 0;
++    for(j=0;j<5;j++) {
++        n += 1.0;
++        x += (float)cal_x[j];
++        y += (float)cal_y[j];
++        x2 += (float)(cal_x[j]*cal_x[j]);
++        y2 += (float)(cal_y[j]*cal_y[j]);
++        xy += (float)(cal_x[j]*cal_y[j]);
++    }
++
++    // Get determinant of matrix -- check if determinant is too small
++    det = n*(x2*y2 - xy*xy) + x*(xy*y - x*y2) + y*(x*xy - y*x2);
++    if(det < 0.1 && det > -0.1) {
++        qDebug("determinant is too small -- %f",det);
++        return;// false;
++    }
++
++    // Get elements of inverse matrix
++    cal_a = (x2*y2 - xy*xy)/det;
++    cal_b = (xy*y - x*y2)/det;
++    cal_c = (x*xy - y*x2)/det;
++    cal_e = (n*y2 - y*y)/det;
++    cal_f = (x*y - n*xy)/det;
++    cal_i = (n*x2 - x*x)/det;
++
++    // Get sums for x calibration
++    z = zx = zy = 0;
++    for(j=0;j<5;j++) {
++        z += (float)cal_xfb[j];
++        zx += (float)(cal_xfb[j]*cal_x[j]);
++        zy += (float)(cal_xfb[j]*cal_y[j]);
++    }
++
++    // Now multiply out to get the calibration for framebuffer x coord
++    cal_o[0] = (int)((cal_a*z + cal_b*zx + cal_c*zy)*(scaling));
++    cal_o[1] = (int)((cal_b*z + cal_e*zx + cal_f*zy)*(scaling));
++    cal_o[2] = (int)((cal_c*z + cal_f*zx + cal_i*zy)*(scaling));
++
++    qDebug("%f %f %f",(cal_a*z + cal_b*zx + cal_c*zy), (cal_b*z + cal_e*zx + cal_f*zy), (cal_c*z + cal_f*zx + cal_i*zy));
++
++    // Get sums for y calibration
++    z = zx = zy = 0;
++    for (j=0;j<5;j++) {
++        z += (float)cal_yfb[j];
++        zx += (float)(cal_yfb[j]*cal_x[j]);
++        zy += (float)(cal_yfb[j]*cal_y[j]);
++    }
++
++    // Now multiply out to get the calibration for framebuffer y coord
++    cal_o[3] = (int)((cal_a*z + cal_b*zx + cal_c*zy)*(scaling));
++    cal_o[4] = (int)((cal_b*z + cal_e*zx + cal_f*zy)*(scaling));
++    cal_o[5] = (int)((cal_c*z + cal_f*zx + cal_i*zy)*(scaling));
++
++    qDebug("%f %f %f",(cal_a*z + cal_b*zx + cal_c*zy), (cal_b*z + cal_e*zx + cal_f*zy), (cal_c*z + cal_f*zx + cal_i*zy));
++
++
++    // If we got here, we're OK, so assign scaling to a[6] and return
++    cal_o[6] = (int) scaling;
++
++    qDebug("Calibration constants: %d %d %d %d %d %d %d",
++        cal_o[0], cal_o[1], cal_o[2],
++        cal_o[3], cal_o[4], cal_o[5],
++        cal_o[6]);
++
++    QString calFile = "/etc/pointercal";
++#ifndef QT_NO_TEXTSTREAM
++    QFile file( calFile );
++    if ( file.open( IO_WriteOnly ) ) {
++        QTextStream t( &file );
++        t << cal_o[1] << " " << cal_o[2] << " " << cal_o[0] << " ";
++        t << cal_o[4] << " " << cal_o[5] << " " << cal_o[3] << " " << cal_o[6];
++       file.flush(); closeTs();
++       openTs();
++    } else
++#endif
++    {
++        qDebug( "Could not save calibration: %s", calFile.latin1() );
++    }
++#endif
+ }
+ void QTSLibHandlerPrivate::readMouseData()
index fb40262..55a79cf 100644 (file)
@@ -7,7 +7,7 @@ DEPENDS = "zlib libpng jpeg tslib uicmoc-native"
 DEPENDS_mnci = "zlib libpng jpeg uicmoc-native"
 DEPENDS_append_c7x0 = " sharp-aticore-oss"
 PROVIDES = "virtual/qte virtual/libqte2"
-PR = "r25"
+PR = "r26"
 
 SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/qt-embedded-${PV}-free.tar.gz;md5=1f7ad30113afc500cab7f5b2f4dec0d7 \
           file://qpe.patch;patch=1 \
@@ -29,10 +29,11 @@ SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/qt-embedded-${PV}-free.tar.gz;m
           file://fix-linuxfb-setmode.patch;patch=1 \
           file://fix-linuxfb-offscreenoverflow.patch;patch=1 \
           file://fix-qscreen-sync.patch;patch=1 \
-          file://sharp_char.h \
+       file://improve-calibration-r0.patch;patch=1 \
           file://key.patch;patch=1 \
-          file://switches.h \
-          file://bidimetrics.patch;patch=5 "
+       file://bidimetrics.patch;patch=5 \
+          file://sharp_char.h \
+          file://switches.h"
 
 SRC_URI_append_simpad       = "file://devfs.patch;patch=1 "
 SRC_URI_append_c7x0         = "file://kernel-keymap.patch;patch=1 file://kernel-keymap-corgi.patch;patch=1 \