diff options
author | Rolf Eike Beer <eb@emlix.com> | 2019-03-25 12:47:21 +0100 |
---|---|---|
committer | Rolf Eike Beer <eb@emlix.com> | 2019-04-15 15:14:21 +0000 |
commit | 093a1a6232083e5b9c18a9e85e5759ba3ce280fb (patch) | |
tree | 314933dd6cd289fb2c63998655a9aa0cff0479d3 /src/platformsupport/input/tslib | |
parent | cab6587e5e798d902d6656e2fdb431b476dc0a17 (diff) |
tslib: use ts_setup() to find the device
This automatically searches for some default devices. This not only
reduces the amount of code, it also makes sure that Qt will by default
find the same input devices that tslib (e.g. ts_calibrate) will find.
Fixes: QTBUG-74680
Change-Id: Ied3fff7e8ed9d6637d2b8cf32119660133d251a3
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/platformsupport/input/tslib')
-rw-r--r-- | src/platformsupport/input/tslib/qtslib.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/platformsupport/input/tslib/qtslib.cpp b/src/platformsupport/input/tslib/qtslib.cpp index f8fdc151ec..c4caea5c80 100644 --- a/src/platformsupport/input/tslib/qtslib.cpp +++ b/src/platformsupport/input/tslib/qtslib.cpp @@ -62,31 +62,15 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key, qCDebug(qLcTsLib) << "Initializing tslib plugin" << key << specification; setObjectName(QLatin1String("TSLib Mouse Handler")); - QByteArray device = qgetenv("TSLIB_TSDEVICE"); - - if (specification.startsWith(QLatin1String("/dev/"))) - device = specification.toLocal8Bit(); - - if (device.isEmpty()) - device = QByteArrayLiteral("/dev/input/event1"); - - m_dev = ts_open(device.constData(), 1); + m_dev = ts_setup(nullptr, 1); if (!m_dev) { - qErrnoWarning(errno, "ts_open() failed"); + qErrnoWarning(errno, "ts_setup() failed"); return; } - if (ts_config(m_dev)) - qErrnoWarning(errno, "ts_config() failed"); - - int fd = ts_fd(m_dev); - if (fd >= 0) { - qCDebug(qLcTsLib) << "tslib device is" << device; - m_notify = new QSocketNotifier(fd, QSocketNotifier::Read, this); - connect(m_notify, &QSocketNotifier::activated, this, &QTsLibMouseHandler::readMouseData); - } else { - qErrnoWarning(errno, "tslib: Cannot open input device %s", device.constData()); - } + qCDebug(qLcTsLib) << "tslib device is" << ts_get_eventpath(m_dev); + m_notify = new QSocketNotifier(ts_fd(m_dev), QSocketNotifier::Read, this); + connect(m_notify, &QSocketNotifier::activated, this, &QTsLibMouseHandler::readMouseData); } QTsLibMouseHandler::~QTsLibMouseHandler() |