September 14, 2012

Qt embedded Linux usb keyboard auto detect

Qt in embedded Linux can detect the plug/unplug of an USB Mouse and enable it when USB mouse is plugged in. For USB keyboard, it does not support such capability.

To solve this problem, I have to resort to qt plugin. The following links will provide all the necessary material to write and deploy a plugin.

The plugin is a dynamic library that qt app looks for when it starts. In this case, the "customized qt keyboard driver" is located at qt-binary-directory/kbddrivers/libhotplugkbplugin.so. Before start the app, set the key board environment variable:


export QWS_KEYBOARD="HotPlugKb"

The plugin is based on the simplestyle plugin below structure-wise and based on the qt internal linuxInput driver function-wise.


http://doc.qt.nokia.com/4.7-snapshot/qkbddriverplugin.html
http://qt-project.org/doc/qt-5.0/deployment-plugins.html
http://doc.qt.nokia.com/4.7-snapshot/plugins-howto.html
http://doc.qt.nokia.com/4.7-snapshot/tools-styleplugin.html
http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html

Debugging Plugins

export QT_DEBUG_PLUGINS='2'

No comments:

Post a Comment