首页| 论坛| 消息

标题:QT5.4 USB热插拔
作者:huanghu8023
日期:2017-02-20 16:42
内容:

请教关于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


#1 [huanghu8023 03-04 10:53]
自己回个吧,
看了到源码这一段
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(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的把热插拔的文件添加上。
搞定了。
#2 [huanghu8023 03-04 10:57]
为什么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的源码。
#3 [goutaiping 10-31 10:43]
大佬:我用的也是QT5.4, 但是我试了你的方法,还是不行!!!望指教呀

回复 发表
主题 版块