当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Touchscreen input buffer overflow with Qt application

问题描述:

I'm using Qt 4.8 on an ARM-based linux embedded platform with a touchscreen, using TSLIB between linux and Qt.

The data chain looks like that:

Touchscreen driver (kernel) -> Linux input event driver (kernel) -> buffer (/dev/input/touchscreen) -> TSLIB (Userspace) -> QWS (Userspace) -> UI (Userspace)

The TSLIB is called by the QWS server, and that's the same thread as the UI.

I've got some problems because when the UI thread does a long operation, the linux input driver keeps filling the buffer, and nobody reads it, so I've got some overflows.

When an overflow occurs, the linux driver flush the whole buffer and I loose every events in the buffer.

It's a real problem when I loose a release event, because the button can stay "pressed" even when the user is not pressing it anymore.

I have already reduced the event rate in the touchscreen driver initialization and increased the size of the buffer, but as the UI can freeze for several seconds, there can be a lot of events waiting in the buffer.

So the question is, is it possible to run the QWS server in a different thread than the UI ? That way, it could read the touchscreen events even if the UI is busy.

I know that UI thread should not be doing long operations, I'm trying to avoid it the best I can, but for example, if I open a folder with 1000 files with a QFileSystemModel and a QTreeView, the UI thread is frozen for ~7s...

Anyway, if you've got some better idea than a ridiculously big buffer in the input event driver, let me know ! Thanks !

分享给朋友:
您可能感兴趣的文章:
随机阅读: