upgrade c700 and tslib patches to qte and reenable tslib for all devices
authorMichael Lauer <mickey@vanille-media.de>
Tue, 29 Jun 2004 15:27:58 +0000 (15:27 +0000)
committerMichael Lauer <mickey@vanille-media.de>
Tue, 29 Jun 2004 15:27:58 +0000 (15:27 +0000)
BKrev: 40e18a7e_PBiubW8kMIEsfMaHd5vHQ

qte/qte-2.3.7/c700-hardware.patch
qte/qte-2.3.7/tslib.patch
qte/qte_2.3.7.oe

index 7846f62..36d649f 100644 (file)
@@ -1,6 +1,10 @@
-diff -urN qt-2.3.7-orig/src/kernel/qwindowsystem_qws.cpp qt-2.3.7/src/kernel/qwindowsystem_qws.cpp
---- qt-2.3.7-orig/src/kernel/qwindowsystem_qws.cpp     2003-07-17 02:20:26.000000000 +0100
-+++ qt-2.3.7/src/kernel/qwindowsystem_qws.cpp  2004-06-27 23:30:03.000000000 +0100
+
+#
+# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
+#
+
+--- qt-2.3.7/src/kernel/qwindowsystem_qws.cpp~c700-hardware    2003-07-17 03:20:26.000000000 +0200
++++ qt-2.3.7/src/kernel/qwindowsystem_qws.cpp  2004-06-29 15:42:57.000000000 +0200
 @@ -126,7 +126,7 @@
  static QRect maxwindow_rect;
  extern Q_EXPORT QRect qt_maxWindowRect;
@@ -19,10 +23,9 @@ diff -urN qt-2.3.7-orig/src/kernel/qwindowsystem_qws.cpp qt-2.3.7/src/kernel/qwi
      d->screensavertimer->stop();
  #else
      if ( screensaverinterval ) {
-diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse_qws.cpp
---- qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp  2003-07-17 02:20:26.000000000 +0100
-+++ qt-2.3.7/src/kernel/qwsmouse_qws.cpp       2004-06-27 23:49:33.000000000 +0100
-@@ -90,6 +90,19 @@
+--- qt-2.3.7/src/kernel/qwsmouse_qws.cpp~c700-hardware 2004-06-29 15:28:37.000000000 +0200
++++ qt-2.3.7/src/kernel/qwsmouse_qws.cpp       2004-06-29 15:44:04.000000000 +0200
+@@ -97,6 +97,19 @@
  #define QT_QWS_TP_MOVE_LIMIT 50
  #define QT_QWS_TP_JITTER_LIMIT 2
  #endif
@@ -42,7 +45,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
  #endif
  
  #ifndef QT_QWS_TP_SAMPLE_SIZE
-@@ -576,7 +589,7 @@
+@@ -583,7 +596,7 @@
        sub[nsub++] = new QAutoMouseSubHandler_intellimouse(fd);
        notify(fd);
      }
@@ -51,8 +54,8 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
      char fn[] = "/dev/ttyS?";
      for (int ch='0'; ch<='3'; ch++) {
        fn[9] = ch;
-@@ -1238,7 +1251,7 @@
-     : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0), 
+@@ -1459,7 +1472,7 @@
+     : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0),
      numSamples(0), skipCount(0)
  {
 -#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
@@ -60,7 +63,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
  #if defined(QT_QWS_IPAQ)
  # ifdef QT_QWS_IPAQ_RAW
      if ((mouseFD = open( "/dev/h3600_tsraw", O_RDONLY | O_NDELAY)) < 0) {
-@@ -1248,7 +1261,7 @@
+@@ -1469,7 +1482,7 @@
          qWarning( "Cannot open /dev/h3600_ts (%s)", strerror(errno));
        return;
      }
@@ -69,7 +72,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
  //# ifdef QT_QWS_SL5XXX_TSRAW
  # if 0
      if ((mouseFD = open( "/dev/tsraw", O_RDONLY | O_NDELAY)) < 0) {
-@@ -1274,7 +1287,7 @@
+@@ -1495,7 +1508,7 @@
  
  QTPanelHandlerPrivate::~QTPanelHandlerPrivate()
  {
@@ -78,7 +81,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
      if (mouseFD >= 0)
        close(mouseFD);
  #endif
-@@ -1282,7 +1295,7 @@
+@@ -1503,7 +1516,7 @@
  
  void QTPanelHandlerPrivate::readMouseData()
  {
@@ -87,7 +90,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
      if(!qt_screen)
        return;
  
-@@ -1301,7 +1314,7 @@
+@@ -1522,7 +1535,7 @@
        uchar *mb = mouseBuf+idx;
        data = (TS_EVENT *) mb;
        if(data->pressure >= QT_QWS_TP_PRESSURE_THRESHOLD) {
@@ -96,7 +99,7 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
            samples[currSample] = QPoint( 1000 - data->x, data->y );
  #else
            samples[currSample] = QPoint( data->x, data->y );
-@@ -1320,7 +1333,7 @@
+@@ -1541,7 +1554,7 @@
  
                mousePos = totalMousePos / (sampleCount - 1);
  
@@ -105,12 +108,12 @@ diff -urN qt-2.3.7-orig/src/kernel/qwsmouse_qws.cpp qt-2.3.7/src/kernel/qwsmouse
                mousePos = transform( mousePos );
  # endif
                if(!waspressed)
-@@ -1693,7 +1706,7 @@
-           handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
+@@ -1916,7 +1929,7 @@
+           handler = new QCustomTPanelHandlerPrivate( mouseProtocol, mouseDev );
  #elif defined(QT_QWS_YOPY)
-           handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
+           handler = new QYopyTPanelHandlerPrivate( mouseProtocol, mouseDev );
 -#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
 +#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_SLC700)
-           handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
+           handler = new QTPanelHandlerPrivate( mouseProtocol, mouseDev );
  #elif defined(QT_QWS_CASSIOPEIA)
            handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
index e69de29..27f8cb0 100644 (file)
@@ -0,0 +1,349 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- qt-2.3.7/src/kernel/qwsmouse_qws.cpp~tslib.patch
++++ qt-2.3.7/src/kernel/qwsmouse_qws.cpp
+@@ -7,6 +7,10 @@
+ **
+ ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
+ **
++** Portions Copyright (C) 2003 Texas Instruments, Inc.
++**    Rights to said portions for use under the GPL and QPL licenses
++**    are hereby granted to Trolltech AS.
++**
+ ** This file is part of the kernel module of the Qt GUI Toolkit.
+ **
+ ** This file may be distributed and/or modified under the terms of the
+@@ -59,6 +63,9 @@
+ #ifdef QT_QWS_CASSIOPEIA
+ #include <linux/tpanel.h>
+ #endif
++#if QWS_TSLIB
++#include <tslib.h>
++#endif
+ #if defined(QT_QWS_IPAQ)
+ #define QT_QWS_IPAQ_RAW
+@@ -110,7 +117,7 @@
+ #ifndef QT_QWS_TP_JITTER_LIMIT
+ #define QT_QWS_TP_JITTER_LIMIT 2
+-#endif 
++#endif
+ //#define QWS_CUSTOMTOUCHPANEL
+@@ -1093,6 +1100,220 @@
+     return sent;
+ }
++
++class QTSLibHandler : public QCalibratedMouseHandler
++{
++    Q_OBJECT
++public:
++    QTSLibHandler();
++    ~QTSLibHandler();
++
++    virtual void clearCalibration();
++    virtual void calibrate( QWSPointerCalibrationData * );
++
++    static int sortByX( const void*, const void* );
++    static int sortByY( const void*, const void* );
++private:
++    void openTs();
++    void closeTs();
++    void interpolateSample();
++
++private:
++    bool raw;
++#ifdef QWS_TSLIB
++    struct tsdev *ts;
++#endif
++    QSocketNotifier *m_notify;
++
++private slots:
++    void readMouseData();
++};
++
++QTSLibHandler::QTSLibHandler()
++    : raw(false), m_notify(0l)
++{
++    openTs();
++}
++
++QTSLibHandler::~QTSLibHandler()
++{
++    closeTs();
++}
++
++void QTSLibHandler::openTs()
++{
++#ifdef QWS_TSLIB
++    char *tsdevice;
++
++    if( ( tsdevice = getenv( "TSLIB_TSDEVICE" ) ) != NULL ) {
++      ts = ts_open( tsdevice, 1 );
++    } else {
++      ts = ts_open( "/dev/ts", 1 );
++    }
++
++    if (!ts) {
++      qWarning( "Cannot open touchscreen (%s)", strerror( errno ) );
++      return;
++    }
++
++    if (ts_config( ts )) {
++      qWarning( "Cannot configure touchscreen (%s)", strerror( errno ) );
++      return;
++    }
++
++
++    m_notify = new QSocketNotifier( ts_fd(ts), QSocketNotifier::Read, this );
++    connect( m_notify, SIGNAL( activated( int ) ), this, SLOT( readMouseData() ) );
++#endif
++}
++
++void QTSLibHandler::closeTs()
++{
++#ifdef QWS_TSLIB
++    if (ts)
++        ts_close(ts);
++
++    delete m_notify;
++    m_notify = 0; ts = 0;
++#endif
++
++}
++
++void QTSLibHandler::clearCalibration()
++{
++    raw = true;
++}
++
++
++void QTSLibHandler::calibrate( QWSPointerCalibrationData *cd )
++{
++    QPoint dev_tl = cd->devPoints[ QWSPointerCalibrationData::TopLeft ];
++    QPoint dev_br = cd->devPoints[ QWSPointerCalibrationData::BottomRight ];
++    QPoint screen_tl = cd->screenPoints[ QWSPointerCalibrationData::TopLeft ];
++    QPoint screen_br = cd->screenPoints[ QWSPointerCalibrationData::BottomRight ];
++    int a, b, c, d, e, f, s;
++
++    s = 1 << 16;
++
++    a = s * (screen_tl.x() - screen_br.x() ) / (dev_tl.x() - dev_br.x());
++    b = 0;
++    c = s * screen_tl.x() - a * dev_tl.x();
++
++    d = 0;
++    e = s * (screen_tl.y() - screen_br.y() ) / (dev_tl.y() - dev_br.y());
++    f = s * screen_tl.y() - e * dev_tl.y();
++
++    QString calFile = "/etc/pointercal";
++#ifndef QT_NO_TEXTSTREAM
++    QFile file( calFile );
++    if ( file.open( IO_WriteOnly ) ) {
++      QTextStream t( &file );
++      t << a << " " << b << " " << c << " ";
++      t << d << " " << e << " " << f << " " << s;
++       file.flush(); closeTs();
++       openTs();
++    } else
++#endif
++    {
++      qDebug( "Could not save calibration: %s", calFile.latin1() );
++    }
++    raw = false;
++}
++
++void QTSLibHandler::readMouseData()
++{
++#ifdef QWS_TSLIB
++    if(!qt_screen)
++      return;
++
++    /*
++     * After clear Calibration
++     * we're in raw mode and do some easy median
++     * search.
++     */
++    if (raw )
++        return interpolateSample();
++
++    static struct ts_sample sample;
++    static int ret;
++
++    /*
++     * Ok. We need to see if we can read more than one event
++     * We do this not to lose an update.
++     */
++    while ( true ) {
++        if ((ret = ts_read(ts, &sample, 1)) != 1 )
++            return;
++
++
++        QPoint pos( sample.x, sample.y );
++        emit mouseChanged( pos, sample.pressure != 0 ? 1 : 0 );
++    }
++#endif
++}
++
++
++/*
++ * Lets take all down events and then sort them
++ * and take the event in the middle.
++ *
++ * inspired by testutils.c
++ */
++void QTSLibHandler::interpolateSample() {
++    static struct ts_sample samples[25];
++    int index = -1;
++    int ret;
++
++    do {
++        index++;
++        /* fill only the last sample again */
++        if ( index >= 25 )
++            index = 24;
++
++        /* we're opened non-blocking */
++        if((ret= ts_read_raw(ts, &samples[index], 1 ) ) !=  1 ) {
++            /* no event yet, so try again */
++            if (ret==-1 ) {
++                index--;
++                continue;
++            }
++        }
++    }while (samples[index].pressure != 0);
++
++    /*
++     * index is maximal 25  and we at least one sample
++     */
++    int x, y;
++
++    /*
++     * now let us use the median value
++     * even index does not have an item in the middle
++     * so let us take the average of n/2 and (n/2)-1 as the middle
++     */
++    int m = index/2;
++    ::qsort(samples, index, sizeof(ts_sample), QTSLibHandler::sortByX);
++    x = (index % 2 ) ? samples[m].x :
++        ( samples[m-1].x + samples[m].x )/2;
++
++    ::qsort(samples, index, sizeof(ts_sample), QTSLibHandler::sortByY);
++    y = (index % 2 ) ? samples[m].y :
++        ( samples[m-1].y + samples[m].y )/2;
++
++    emit mouseChanged( QPoint(x, y), 1 );
++    emit mouseChanged( QPoint(0, 0), 0 );
++}
++
++int QTSLibHandler::sortByX( const void* one, const void* two) {
++    return reinterpret_cast<const struct ts_sample*>(one)->x -
++           reinterpret_cast<const struct ts_sample*>(two)->x;
++}
++
++int QTSLibHandler::sortByY( const void* one, const void* two) {
++    return reinterpret_cast<const struct ts_sample*>(one)->y -
++           reinterpret_cast<const struct ts_sample*>(two)->y;
++}
++
++
+ /*
+  * Handler for /dev/tpanel Linux kernel driver
+  */
+@@ -1235,7 +1456,7 @@
+ QTPanelHandlerPrivate::QTPanelHandlerPrivate( MouseProtocol, QString dev )
+-    : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0), 
++    : samples(QT_QWS_TP_SAMPLE_SIZE), currSample(0), lastSample(0),
+     numSamples(0), skipCount(0)
+ {
+ #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+@@ -1315,7 +1536,7 @@
+               mousePos = QPoint( 0, 0 );
+               QPoint totalMousePos = oldTotalMousePos;
+               totalMousePos += samples[currSample];
+-              if(numSamples >= samples.count()) 
++              if(numSamples >= samples.count())
+                   totalMousePos -= samples[lastSample];
+               mousePos = totalMousePos / (sampleCount - 1);
+@@ -1345,7 +1566,7 @@
+                   // save recuring information
+                   currSample++;
+-                  if (numSamples >= samples.count()) 
++                  if (numSamples >= samples.count())
+                       lastSample++;
+                   oldTotalMousePos = totalMousePos;
+               } else {
+@@ -1658,7 +1879,7 @@
+     if ( mouseProto == "USB" && mouseDev.isEmpty() )
+       mouseDev = "/dev/input/mice";
+-    
++
+     MouseProtocol mouseProtocol = Unknown;
+     int idx = 0;
+@@ -1689,12 +1910,14 @@
+           break;
+       case TPanel:
+-#if defined(QWS_CUSTOMTOUCHPANEL)
+-          handler = new QCustomTPanelHandlerPrivate(mouseProtocol,mouseDev);
++#if defined(QWS_TSLIB)
++          handler = new QTSLibHandler( );
++#elif defined(QWS_CUSTOMTOUCHPANEL)
++          handler = new QCustomTPanelHandlerPrivate( mouseProtocol, mouseDev );
+ #elif defined(QT_QWS_YOPY)
+-          handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev);
++          handler = new QYopyTPanelHandlerPrivate( mouseProtocol, mouseDev );
+ #elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
+-          handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev);
++          handler = new QTPanelHandlerPrivate( mouseProtocol, mouseDev );
+ #elif defined(QT_QWS_CASSIOPEIA)
+           handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev );
+ #endif
+--- qt-2.3.7/configure~tslib.patch
++++ qt-2.3.7/configure
+@@ -399,6 +399,9 @@
+    -kde)
+        KDE=yes
+       ;;
++   -tslib)
++       TSLIB=yes
++      ;;
+    -no-g++-exceptions)
+       GPLUSPLUS_EXCEPTIONS=no
+       ;;
+@@ -1255,6 +1258,9 @@
+                        set to point to a KDE 2 installation.
+                          See http://www.kde.org
++    -tslib ............. Use the TSLib (touchscreen access library) mouse handler
++                         by default, instead of the normal device default.
++
+     -no-g++-exceptions . Disable exceptions on platforms using the GNU C++
+                        compiler by using the -fno-exceptions flag.
+@@ -1314,6 +1320,13 @@
+ [ "x$SM" = "xno" ] && QT_CXX="${QT_CXX} -DQT_NO_SM_SUPPORT"
+ [ "x$XFT" = "xyes" ] && QT_CXX="${QT_CXX} -DQT_XFT"
+ [ "x$XFT" = "xno" ] && QT_CXX="${QT_CXX} -DQT_NO_XKB"
++
++if [ "x$TSLIB" = "xyes" ]
++then
++   QT_CXX="${QT_CXX} -DQWS_TSLIB"
++   QT_LIBS="${QT_LIBS} -lts"
++fi
++
+ if [ "x$THREAD" = "xyes" ]
+ then
+    cat >src-mt.mk <<EOF
index 10ad2db..272465d 100644 (file)
@@ -4,24 +4,22 @@ PRIORITY = "optional"
 LICENSE = "GPL/QPL"
 DEPENDS = "zlib libpng jpeg tslib uicmoc-native"
 PROVIDES = "virtual/qte virtual/libqte2"
-PR = "r5"
+PR = "r7"
 
 SRC_URI = "ftp://ftp.trolltech.com/pub/qt/source/qt-embedded-${PV}.tar.gz \
           file://qpe.patch;patch=1 \
           file://vt-switch.patch;patch=1 \
           file://no-moc.patch;patch=1 \
           file://gcc3_4.patch;patch=1 \
+          file://tslib.patch;patch=1 \
+          file://c700-hardware.patch;patch=1 \
           file://update-qtfontdir \
           file://sharp_char.h \
           file://switches.h "
 
 SRC_URI_append_simpad   = "file://simpad.patch;patch=1 file://devfs.patch;patch=1 "
-SRC_URI_append_corgi    = "file://c700-hardware.patch;patch=1 file://tslib.patch;patch=1 "
-SRC_URI_append_shepherd = "file://c700-hardware.patch;patch=1 file://tslib.patch;patch=1 " 
-SRC_URI_append_husky    = "file://c700-hardware.patch;patch=1 file://tslib.patch;patch=1 " 
-SRC_URI_append_boxer    = "file://c700-hardware.patch;patch=1 file://tslib.patch;patch=1 " 
-SRC_URI_append_h3600    = "file://tslib.patch;patch=1 file://devfs.patch;patch=1 "
-SRC_URI_append_h3900    = "file://tslib.patch;patch=1 file://devfs.patch;patch=1 "
+SRC_URI_append_h3600    = "file://devfs.patch;patch=1 "
+SRC_URI_append_h3900    = "file://devfs.patch;patch=1 "
 
 S = "${WORKDIR}/qt-${PV}"
 
@@ -49,10 +47,10 @@ EXTRA_OEMAKE = "-e"
 # FIXME: Add more here
 #
 EXTRA_DEFINES          = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DWARNING_UNKNOWN_DEVICE"
-EXTRA_DEFINES_collie   = "            -DQT_QWS_CUSTOM -DQT_QWS_SL5XXX"
+EXTRA_DEFINES_collie   = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_SL5XXX"
 EXTRA_DEFINES_h3600     = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ                 -DQT_QWS_DEVFS" 
 EXTRA_DEFINES_h3900    = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ                 -DQT_QWS_DEVFS"
-EXTRA_DEFINES_simpad   = "            -DQT_QWS_CUSTOM -DQT_QWS_IPAQ -DQT_QWS_SIMPAD -DQT_QWS_DEVFS"
+EXTRA_DEFINES_simpad   = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_IPAQ -DQT_QWS_SIMPAD -DQT_QWS_DEVFS"
 EXTRA_DEFINES_shepherd  = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_SLC700"
 EXTRA_DEFINES_husky    = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_SLC700"
 EXTRA_DEFINES_boxer     = "-DQWS_TSLIB -DQT_QWS_CUSTOM -DQT_QWS_SLC700"