QStringList QDeviceDiscoveryStatic::scanConnectedDevices() { QStringList devices; QDir dir; dir.setFilter(QDir::System); // check for input devices if (m_types & Device_InputMask) { dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH)); const auto deviceFiles = dir.entryList(); for (const QString &deviceFile : deviceFiles) { QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile; if (checkDeviceType(absoluteFilePath)) devices << absoluteFilePath; } } // check for drm devices if (m_types & Device_VideoMask) { dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH)); const auto deviceFiles = dir.entryList(); for (const QString &deviceFile : deviceFiles) { QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile; if (checkDeviceType(absoluteFilePath)) devices << absoluteFilePath; } } qCDebug(lcDD) << "Found matching devices" << devices; return devices; }
void QDeviceDiscovery::handleUDevNotification() { if (!m_udevMonitor) return; struct udev_device *dev; QString devNode; dev = udev_monitor_receive_device(m_udevMonitor); if (!dev) goto cleanup; const char *action; action = udev_device_get_action(dev); if (!action) goto cleanup; const char *str; str = udev_device_get_devnode(dev); if (!str) goto cleanup; const char *subsystem; devNode = QString::fromUtf8(str); if (devNode.startsWith(QLatin1String(QT_EVDEV_DEVICE))) subsystem = "input"; else if (devNode.startsWith(QLatin1String(QT_DRM_DEVICE))) subsystem = "drm"; else goto cleanup; // if we cannot determine a type, walk up the device tree if (!checkDeviceType(dev)) { // does not increase the refcount dev = udev_device_get_parent_with_subsystem_devtype(dev, subsystem, 0); if (!dev) goto cleanup; if (!checkDeviceType(dev)) goto cleanup; } if (qstrcmp(action, "add") == 0) emit deviceDetected(devNode); if (qstrcmp(action, "remove") == 0) emit deviceRemoved(devNode); cleanup: udev_device_unref(dev); }
/** * Initializes the fbapp_ native resources. */ void fbapp_init() { isFullScreen = 0; reverse_orientation = 0; linuxFbDeviceType = LINUX_FB_VERSATILE_INTEGRATOR; checkDeviceType(); initScreenBuffer( fbapp_get_screen_width(0), fbapp_get_screen_height(0)); connectFrameBuffer(); }
QStringList QDeviceDiscovery::scanConnectedDevices() { QStringList devices; 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; } }
QStringList QDeviceDiscoveryStatic::old_ScanConnectedDevices() { QStringList devices; QDir dir; dir.setFilter(QDir::System); if (m_types & Device_InputMask) { dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH)); foreach (const QString &deviceFile, dir.entryList()) { if (-1 == deviceFile.indexOf(QString::fromLatin1(QT_EVDEV_DEVICE_PREFIX))) { continue; } QString absoluteFilePath = dir.absolutePath() + QString::fromLatin1("/") + deviceFile; if (checkDeviceType(absoluteFilePath)) devices << absoluteFilePath; } }