Добрый день!
Прошу помощи в проблеме реплага USB тачскрина нагорячую.
Есть контроллер тача Zytronic zxy100, подключенный по USB, работающий через tslib. При старте системы запускается Qt(5.15) с плагином linuxfb (иксов нет).
Проблема в том, что если вынуть и вставить обратно USB разъем контроллера тача - в Qt больше нет событий тача. Если перезапустить все приложение - все опять будет работать корректно. Схожая ситуация и с ts_test.
При работе с сенсорным экраном были моменты когда в логе dmesg самопроизвольно появлялись сообщения о USB disconnected тача. Кабель проверил, тач в наличии только один и статистики нет, не хотелось бы, чтобы во время работы из-за временно отвалившегося USB перестал работать тач в Qt.
Подскажите пожалуйста есть ли какое-либо решение для схожих ситуаций?
Детали:
# cat /proc/bus/input/devices
...
I: Bus=0003 Vendor=14c8 Product=0005 Version=0101
N: Name="Zytronic Displays Limited Zytronic Touchscreen Controller Touchscreen"
P: Phys=usb-1c1c400.usb-1/input0
S: Sysfs=/devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0001/input/input1
U: Uniq=
H: Handlers=event1
B: PROP=0
B: EV=1b
B: KEY=420 0 0 0 0 0 0 0 0 0 0
B: ABS=100 3
B: MSC=10
# cat /sys/devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0001/input/input1/event1/dev
13:65
Я создаю файл через mknod:
# mknod /dev/uinput c 13 65
и травлю на него Qt:
# cat /root/run_affine_fb.sh
export QT_DEBUG_PLUGINS=1
export QT_QPA_FONTDIR=/usr/lib/fonts
export QT_PLUGIN_PATH=/usr/lib/qt/plugins
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
export QT_QPA_FB_HIDECURSOR=0
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/uinput
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/uinput
export TSLIB_TSEVENTTYPE='INPUT'
export TSLIB_CALIBFILE='/etc/pointercal'
export TSLIB_CONFFILE='/etc/ts.conf'
export TSLIB_CONSOLEDEVICE='none'
export TSLIB_FBDEVICE='/dev/fb0'
export TSLIB_PLUGINDIR='/usr/lib/ts'
export TSLIB_TSDEVICE='/dev/uinput'
export QT_LOGGING_RULES=qt.qpa.input=true
/root/affine
выхлоп:
# ./run_affine_fb.sh
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqeglfs.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqminimal.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqminimalegl.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqminimalegl.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimalegl"
]
},
"archreq": 0,
"className": "QMinimalEglIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqoffscreen.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqoffscreen.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"offscreen"
]
},
"archreq": 0,
"className": "QOffscreenIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqvnc.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqvnc.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"vnc"
]
},
"archreq": 0,
"className": "QVncIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() checking directory path "/root/platforms" ...
loaded library "/usr/lib/qt/plugins/platforms/libqlinuxfb.so"
qt.qpa.input: evdevkeyboard: Using device discovery
qt.qpa.input: static device discovery for type QFlags<QDeviceDiscovery::QDeviceType>(Device_Keyboard)
qt.qpa.input: doing static device discovery for "/dev/input/event0"
qt.qpa.input: doing static device discovery for "/dev/input/event1"
qt.qpa.input: doing static device discovery for "/dev/input/event2"
qt.qpa.input: Found matching devices ()
qt.qpa.input: evdevmouse: Using device discovery
qt.qpa.input: static device discovery for type QFlags<QDeviceDiscovery::QDeviceType>(Device_Mouse|Device_Touchpad)
qt.qpa.input: doing static device discovery for "/dev/input/event0"
qt.qpa.input: doing static device discovery for "/dev/input/event1"
qt.qpa.input: Found touchpad at "/dev/input/event1"
qt.qpa.input: doing static device discovery for "/dev/input/event2"
qt.qpa.input: Found matching devices ("/dev/input/event1")
qt.qpa.input: Adding mouse at /dev/input/event1
qt.qpa.input: create mouse handler for "/dev/input/event1" ""
qt.qpa.input: evdevtouch: Adding device at /dev/uinput
qt.qpa.input: evdevtouch: Using device /dev/uinput
qt.qpa.input: evdevtouch: /dev/uinput: Protocol type A (single), filtered=no
qt.qpa.input: evdevtouch: /dev/uinput: min X: 0 max X: 4096
qt.qpa.input: evdevtouch: /dev/uinput: min Y: 0 max Y: 4096
qt.qpa.input: evdevtouch: /dev/uinput: min pressure: 0 max pressure: 0
qt.qpa.input: evdevtouch: /dev/uinput: device name: Zytronic Displays Limited Zytronic Touchscreen Controller Touchscreen
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/generic" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqevdevkeyboardplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqevdevkeyboardplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"EvdevKeyboard"
]
},
"archreq": 0,
"className": "QEvdevKeyboardPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("evdevkeyboard")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqevdevmouseplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqevdevmouseplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"EvdevMouse"
]
},
"archreq": 0,
"className": "QEvdevMousePlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("evdevmouse")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqevdevtabletplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqevdevtabletplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"EvdevTablet"
]
},
"archreq": 0,
"className": "QEvdevTabletPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("evdevtablet")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqevdevtouchplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqevdevtouchplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"EvdevTouch"
]
},
"archreq": 0,
"className": "QEvdevTouchScreenPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("evdevtouch")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqtslibplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqtslibplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"Tslib",
"TslibRaw"
]
},
"archreq": 0,
"className": "QTsLibPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("tslib", "tslibraw")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/generic/libqtuiotouchplugin.so"
Found metadata in lib /usr/lib/qt/plugins/generic/libqtuiotouchplugin.so, metadata=
{
"IID": "org.qt-project.Qt.QGenericPluginFactoryInterface",
"MetaData": {
"Keys": [
"TuioTouch"
]
},
"archreq": 0,
"className": "QTuioTouchPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("tuiotouch")
QFactoryLoader::QFactoryLoader() checking directory path "/root/generic" ...
loaded library "/usr/lib/qt/plugins/generic/libqtslibplugin.so"
qt.qpa.input: Initializing tslib plugin "tslib" "/dev/uinput"
qt.qpa.input: tslib device is /dev/uinput
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/styles" ...
QFactoryLoader::QFactoryLoader() checking directory path "/root/styles" ...
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/imageformats" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/imageformats/libqico.so"
Found metadata in lib /usr/lib/qt/plugins/imageformats/libqico.so, metadata=
{
"IID": "org.qt-project.Qt.QImageIOHandlerFactoryInterface",
"MetaData": {
"Keys": [
"ico",
"cur"
],
"MimeTypes": [
"image/vnd.microsoft.icon",
"image/vnd.microsoft.icon"
]
},
"archreq": 0,
"className": "QICOPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("ico", "cur")
QFactoryLoader::QFactoryLoader() checking directory path "/root/imageformats" ...
loaded library "/usr/lib/qt/plugins/imageformats/libqico.so"
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/accessiblebridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "/root/accessiblebridge" ...
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "/root/accessible" ...
qt.qpa.input: evdevtouch: Updating QInputDeviceManager device count: 1 touch devices, 0 pending handler(s)
^^^ на этом этапе все ОК - тач работает
вынимаем USB, новый выхлоп (с таймкодом строка от syslogd):
[ 944.460293] usb 5-1: USB disconnect, device number 2
evdevtouch: Could not read from input device (No such device)
evdevmouse: Could not read from input device (No such device)
вставляем обратно, появляется:
[ 995.002997] usb 5-1: new full-speed USB device number 3 using ohci-platform
[ 995.300499] input: Zytronic Displays Limited Zytronic Touchscreen Controller Touchscreen as /devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0002/input/input4
[ 995.316735] input: Zytronic Displays Limited Zytronic Touchscreen Controller Mouse as /devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0002/input/input5
[ 995.332534] hid-generic 0003:14C8:0005.0002: input: USB HID v1.01 Mouse [Zytronic Displays Limited Zytronic Touchscreen Controller] on usb-1c1c400.usb-1/input0
т.е. подсистема Qt естественно никак на это не реагирует и тач в Qt уже не работает.
Есть ли какое-либо изящное решение (через udev навесить на коннект тача переинициализацию плагина tslib в Qt не рестартуя все приложение или что-то подобное)?
Если перезапустить приложение Qt - все работает.
Тоже самое с ts_test, вынимаешь USB - перестает работать ввод до перезапуска ts_test.
В гугле схожие вопросы нашел, ответ - нет.