mtdev: Change to use configure detection instead of requiring source hacking.

This coincidentally fixes a case of accidental BIC in qevdevtouch_p.h, where not
all users would necessarily define USE_MTDEV: having it centralized inside Qt
makes this now, blessedly, impossible.

Change-Id: I196a8f21742830705759aa917a823afdc94ba2b5
Done-with: Michael Brasser <michael.brasser@jollamobile.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
bb10
Robin Burchell 2013-12-20 15:14:42 +00:00 committed by The Qt Project
parent e8d31d1b31
commit 5923196bc3
4 changed files with 15 additions and 12 deletions

View File

@ -8,6 +8,8 @@ contains(QT_CONFIG, libudev) {
LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV
}
# DEFINES += USE_MTDEV
contains(CONFIG, mtdev) {
CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += mtdev
}
contains(DEFINES, USE_MTDEV): LIBS_PRIVATE += -lmtdev

View File

@ -49,7 +49,7 @@
#include <QtPlatformSupport/private/qdevicediscovery_p.h>
#include <linux/input.h>
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
extern "C" {
#include <mtdev.h>
}
@ -164,7 +164,7 @@ static inline bool testBit(long bit, const long *array)
QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QObject *parent)
: QObject(parent), m_notify(0), m_fd(-1), d(0)
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
, m_mtdev(0)
#endif
{
@ -233,7 +233,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
return;
}
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev)));
int mtdeverr = mtdev_open(m_mtdev, m_fd);
if (mtdeverr) {
@ -245,7 +245,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
d = new QEvdevTouchScreenData(this, args);
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
const char *mtdevStr = "(mtdev)";
d->m_typeB = true;
#else
@ -329,7 +329,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification,
QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
{
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
if (m_mtdev) {
mtdev_close(m_mtdev);
free(m_mtdev);
@ -347,7 +347,7 @@ void QEvdevTouchScreenHandler::readData()
::input_event buffer[32];
int n = 0;
for (; ;) {
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
int result = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event));
if (result > 0)
result *= sizeof(::input_event);

View File

@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
class QSocketNotifier;
class QEvdevTouchScreenData;
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
struct mtdev;
#endif
@ -71,7 +71,7 @@ private:
QSocketNotifier *m_notify;
int m_fd;
QEvdevTouchScreenData *d;
#ifdef USE_MTDEV
#if !defined(QT_NO_MTDEV)
mtdev *m_mtdev;
#endif
};

View File

@ -5,8 +5,9 @@ Single-touch devices reporting ABS_X and Y only are not supported
by this plugin. Use tslib or evdevmouse instead.
The protocol type will be detected automatically.
To enable libmtdev support uncomment the USE_MTDEV define in
src/platformsupport/input/evdevtouch/evdevtouch.pri.
libmtdev is automatically detected based on library availability. To disable it,
pass -no-mtdev to configure.
Tested with the following kernel drivers:
bcm5974 (type A)