• 6354阅读
  • 3回复

[讨论]QT5.4 USB热插拔 [复制链接]

上一主题 下一主题
离线huanghu8023
 

只看楼主 倒序阅读 楼主  发表于: 2017-02-20


请教关于QT5.4的 USB热插拔问题:在应用启动之前插入USB鼠标,能正常使用,拔出后,再插入,不能使用,且一直打印
  “ QEvdevMouseHandler::readMouseData(201):Could not read from input device: No such device”

网上找了一个博文是5.5的,
http://blog.csdn.net/shengzhadon/article/details/51454703
按他的方法,编译QT库,有很多的问题,编译不通过。


我的QT配置文件是:

#!/bin/sh
./configure -prefix /home/hedy/work_space/Qt_lib \
-arch arm -opensource -confirm-license -make libs -device imx6 \
-device-option CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi- \
-no-pch -no-opengl -no-icu \
-no-c++11 \
-opengl es2 \
-eglfs \
-compile-examples \


平台 :
Ubuntu12.04
freescale imx6
linux3.0.35
QT5.4


离线huanghu8023

只看该作者 1楼 发表于: 2017-03-04
自己回个吧,
看了到源码这一段
void QEGLPlatformIntegration::createInputHandlers()
{
#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
    m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
    QEvdevMouseManager *mouseMgr = new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
    Q_FOREACH (QScreen *screen, QGuiApplication::screens()) {
        QEGLPlatformCursor *cursor = static_cast<QEGLPlatformCursor *>(screen->handle()->cursor());
        if (cursor)
            cursor->setMouseDeviceDiscovery(mouseMgr->deviceDiscovery());
    }
    new QEvdevTouchScreenHandlerThread(QString() /* spec */, this);
#endif
}



    new QEvdevTouchScreenHandlerThread(QString() /* spec */, this);
注示掉
就行了。因为 tslib与这个QT自带的冲突了。


然后还是按上面提到的博文5.5.1的把热插拔的文件添加上。
搞定了。
离线huanghu8023

只看该作者 2楼 发表于: 2017-03-04
为什么5.5不用注示呢?

void QEGLPlatformIntegration::createInputHandlers()
{
#if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
    m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this);
    new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this);
#ifndef QT_NO_TSLIB
    const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB");
    if (useTslib)
        new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */);
    else
#endif // QT_NO_TSLIB
        new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this);
#endif
}


且看5.5.1的源码。
离线goutaiping

只看该作者 3楼 发表于: 2018-10-31
大佬:我用的也是QT5.4, 但是我试了你的方法,还是不行!!!望指教呀
快速回复
限100 字节
 
上一个 下一个