Checking input mask before scanning evdev devices

Adding device mask verification for static device discovery.
DRM devices are no longer scanned if mask is set to input devices only

Change-Id: Ibd2e77280c2d93c707ba7bdb84c4ae3cb0932178
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Cedric Chedaleux 2014-02-03 11:33:55 +01:00 committed by The Qt Project
parent 2d67bf07fe
commit c6d3fe8873

View File

@ -102,24 +102,28 @@ QDeviceDiscovery::~QDeviceDiscovery()
QStringList QDeviceDiscovery::scanConnectedDevices()
{
QStringList devices;
// check for input devices
QDir dir(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
QDir dir;
dir.setFilter(QDir::System);
// check for input devices
if (m_types & Device_InputMask) {
dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
foreach (const QString &deviceFile, dir.entryList()) {
QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
}
// check for drm devices
if (m_types & Device_VideoMask) {
dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
foreach (const QString &deviceFile, dir.entryList()) {
QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
}
#ifdef QT_QPA_DEVICE_DISCOVERY_DEBUG
qWarning() << "DeviceDiscovery found matching devices" << devices;