18QEvdevTabletManager::QEvdevTabletManager(
const QString &key,
const QString &specification, QObject *parent)
23 if (qEnvironmentVariableIsSet(
"QT_QPA_EVDEV_DEBUG"))
24 const_cast<QLoggingCategory &>(qLcEvdevTablet()).setEnabled(QtDebugMsg,
true);
26 QString spec = qEnvironmentVariable(
"QT_QPA_EVDEV_TABLET_PARAMETERS");
31 auto parsed = QEvdevUtil::parseSpecification(spec);
32 m_spec = std::move(parsed.spec);
34 for (
const QString &device : std::as_const(parsed.devices))
38 if (parsed.devices.isEmpty()) {
39 qCDebug(qLcEvdevTablet,
"evdevtablet: Using device discovery");
40 if (
auto deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Tablet,
this)) {
41 const QStringList devices = deviceDiscovery->scanConnectedDevices();
42 for (
const QString &device : devices)
45 connect(deviceDiscovery, &QDeviceDiscovery::deviceDetected,
46 this, &QEvdevTabletManager::addDevice);
47 connect(deviceDiscovery, &QDeviceDiscovery::deviceRemoved,
48 this, &QEvdevTabletManager::removeDevice);
59 qCDebug(qLcEvdevTablet,
"Adding device at %ls", qUtf16Printable(deviceNode));
60 auto handler = std::make_unique<QEvdevTabletHandlerThread>(deviceNode, m_spec);
62 m_activeDevices.add(deviceNode, std::move(handler));
65 qWarning(
"evdevtablet: Failed to open tablet device %ls", qUtf16Printable(deviceNode));