Project

General

Profile

MityDSP-L138F - Qt application not seeing USB keyboard

Added by Mathew Jones over 4 years ago

Hi
I'm having trouble with Qt getting input from a USB keyboard. USB mouse input is fine.
I have a MityDSP-L138 running on the IndustrialIO dev board, connected to a monitor via DVI.

The USB keyboard happily works with the console on the DVI monitor and I also have control via ttyS1 on a PC where I run the CriticalLink Virtual Machine for my development environment.
I have a very basic Qt app with a few edit boxes and a quit button.

The USB mouse and keyboard enumerations at startup are:

hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
usb 1-1.3: new low-speed USB device number 3 using ohci
input: Dell Dell USB Keyboard as /devices/platform/ohci.0/usb1/1-1/1-1.3/1-1.3:1.0/input/input0
generic-usb 0003:413C:2003.0001: input: USB HID v1.10 Keyboard [Dell Dell USB Keyboard] on usb-ohci.0-1.3/input0
usb 1-1.4: new low-speed USB device number 4 using ohci
input: Dell Dell USB Mouse as /devices/platform/ohci.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input1
generic-usb 0003:413C:3200.0002: input: USB HID v1.10 Mouse [Dell Dell USB Mouse] on usb-ohci.0-1.4/input0

I have run the app on the MityDSP with the kernel & file system from: MDK_2014-01-13 (with Qt 4.8.0) and MDK_2012-03-12 (with Qt 4.7.4).
From other web searches, I have tried setting the qt environment variable to one of the following values before running the app:

# export QWS_KEYBOARD="USB:/dev/input/event0" 
# export QWS_KEYBOARD="USB:/sys/devices/platform/ohci.0/usb1/1-1/1-1.3/1-1.3:1.0/input/input0" 
# export QWS_KEYBOARD="LinuxInput:/dev/input/event0" 
# export QWS_KEYBOARD="LinuxInput:/sys/devices/platform/ohci.0/usb1/1-1/1-1.3/1-1.3:1.0/input/input0" 

With QWS_KEYBOARD set to any of the above values there is never any keyboard input to the Qt app but when I quit the app and return to the console then all the characters I typed into the Qt app are seen on the command line.

With QWS_KEYBOARD not set I notice that I the Qt app accepts occasional key presses from certain keys and when I quit the app and return to the console then there is a lot of garbage characters on the command line.

Have the MDK distributions had Qt built for USB keyboard support (I believe the kernels have)?
Or is there something I need in my Qt project to accept input from a USB keyboard?

Regards
Mat


Replies (8)

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Tim Iskander over 4 years ago

Mat,
Its been a while since I have worked in this area, so I'm a bit rusty... Are you launching your app with the -qws flag? This tells the Qt framework to start up the input server and might explain things...
cheers
/Tim

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Mathew Jones over 4 years ago

Hi Tim
I am currently launching my application with the -qws flag, e.g.

export QWS_KEYBOARD="usb:/dev/tty1"; ./QtBasicApp -qws&
export QWS_KEYBOARD="LinuxInput:/dev/tty1"; ./QtBasicApp -qws&
export QWS_KEYBOARD="usb:/dev/input/event0"; ./QtBasicApp -qws&

but I have also tried with the following line of code for MityDSP ARM target:
QApplication a(argc, argv, QApplication::GuiServer);

Some additional info:
(1) When both mouse and keyboard are plugged in (via a 4-port USB port) it does seem to map the USB keyboard to /dev/input/event0:
# ls -la /dev/input/by-id/
drwxr-xr-x    2 root     root           100 Jan  8 10:43 .
drwxr-xr-x    4 root     root           160 Jan  8 10:43 ..
lrwxrwxrwx    1 root     root             9 Jan  8 10:43 usb-Dell_Dell_USB_Keyboard-event-kbd -> ../event0
lrwxrwxrwx    1 root     root             9 Jan  1  2000 usb-Dell_Dell_USB_Mouse-event-mouse -> ../event1
lrwxrwxrwx    1 root     root             9 Jan  1  2000 usb-Dell_Dell_USB_Mouse-mouse -> ../mouse0

(2) From the ttyS1 monitor console I can capture the characters typed into the USB keyboard with:

cat /dev/input/event0

(3) I did also wonder whether there was (or needed to be?) a USB qt keyboard driver/plugin built and deployed from the 2014 MDK, but on the target MityDSP I only found a mouse plugin: /usr/lib/qtopia/plugins/ has 7 directories. One is called mousedrivers and contains 'libqtslibmousedriver.so', but there's nothing related to keyboard.

Thanks
Mat

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Jonathan Cormier over 4 years ago

http://doc.qt.io/qt-4.8/qt-embedded-charinput.html#specifying-a-keyboard-driver

The above link lists the TTY and LinuxInput driver as what would be needed for keyboard input.

According to this link https://wiki.qt.io/Building_Qt_for_Embedded_Linux, it is possible for their support to not be built when compiling Qt.

qt-kdb-tty Enable support for the tty keyboard driver
qt-kbd-qvfb Enable keyboard support with qvfb
qt-kbd-linuxinput Enable a keyboard linux input in the QtGui library.

I haven't been able to find out if there is a way to print what arguments where used when qt was built. Its possible the tty and linuxinput drivers would get built into qt and not create plugin files.

Could you try:

export QWS_KEYBOARD="TTY:/dev/tty1"; ./QtBasicApp -qws&

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Mathew Jones over 4 years ago

Hi Jonathan, thanks, I've read something similar or the same links.
I've just tried

export QWS_KEYBOARD="TTY:/dev/tty1"; ./QtBasicApp -qws&

It's a small step closer in that very occasional keyboard presses are seen in the Qt line edit boxes. Sometimes the app starts and I can get a few characters typed (very slowly) and other times Qt does not receive any characters. It's all very sluggish and on a couple of occasions the first keypress caused the application to crash.

I guess that still doesn't prove whether Qt built for the MityDSP linux target was configured with -qt-kbd-tty -qt-kbd-qvfb -qt-kbd-linuxinput.

One other thing I've tried is to create another simple Qt GUI application that just tries to capture keyboard events and output them with qDebug to the monitor console (or Application output window when I'm debugging the MityDSP from Qt Creator in the VM - note: when I do this I setup -qws and QWS_KEYBOARD for the kit 'Run' config).
The main.cpp file is attached with the eventFilter code to capture keyboard events.
When I run it with QWS_KEYBOARD="TTY:/dev/tty1", similar to my other test app, again I get very intermittent keyboard responses and I also only get upper-case characters, even when caps lock/shift are off.

I've also gone back to clean MDK 2012 and MDK 2014 filesystems, booting the target over NFS when mounted in the VM, just in case I'd done something to the filesystem on the MityDSP flash. I'm out of ideas at the moment so any further help would be greatly appreciated.

main.cpp View (789 Bytes)

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Jonathan Cormier over 4 years ago

The build logs for the 4.7.4 qt show the following configure. According to this neither qt-kbd-linuxinput nor qt-kbd-linuxinput were built but qt-kbd-linuxinput was.

    (echo o; echo yes) | ./configure -v \
            -prefix /usr/ \
            -bindir /usr/bin \
            -libdir /usr/lib \
            -datadir /usr/share/qtopia \
            -sysconfdir /etc/qtopia \
            -docdir /usr/share/doc/qtopia \
            -headerdir /usr/include/qtopia \
            -plugindir /usr/lib/qtopia/plugins \
            -importdir /usr/lib/qtopia/imports \
            -translationdir /usr/share/qtopia/translations \
            -examplesdir /usr/bin/qtopia/examples \
            -demosdir /usr/bin/qtopia/demos \
            -platform linux-gnueabi-oe-g++ \
            -xplatform linux-gnueabi-oe-g++ \
            -little-endian \
            -crossarch arm \
                  -embedded arm     -qtlibinfix E     -plugin-gfx-transformed - plugin-gfx-qvfb -plugin-gfx-vnc -plugin-gfx-directfb     -plugin-mouse-tslib -  qt-mouse-pc -qt-mouse-qvfb -qt-mouse-linuxinput     -qt-kbd-tty     -           DQT_KEYPAD_NAVIGATION      -release -no-cups -reduce-                           relocations                     -shared -no-nas-sound -no-                      nis                     -system-libjpeg -system-libpng -system-libtiff -system- zlib                     -no-pch -qdbus -stl -glib -phonon -                    webkit                     -xmlpatterns -no-rpath -qt3support -                 silent                     --enable-pulseaudio                     -no-sql-     ibase -plugin-sql-mysql -no-sql-odbc -plugin-sql-psql -plugin-sql-sqlite2 -     plugin-sql-sqlite                     -no-accessibility -no-                    sm                        -exceptions  -I/export/space/oe/setup-scripts/build/  tmp-angstrom_v2012_05-eglibc/sysroots/mityomapl138/usr/include/                 mysql                     -I/export/space/oe/setup-scripts/build/tmp-           angstrom_v2012_05-eglibc/sysroots/mityomapl138/usr/include/postgresql -no-fast \
            -L/export/space/oe/setup-scripts/build/tmp-angstrom_v2012_05-eglibc/sysroots/mityomapl138/usr/lib -I/export/space/oe/setup-scripts/build/tmp-       angstrom_v2012_05-eglibc/sysroots/mityomapl138/usr/include \
            -I/export/space/oe/setup-scripts/build/tmp-angstrom_v2012_05-eglibc/sysroots/mityomapl138/usr/include/freetype2

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Mathew Jones over 4 years ago

That's interesting, so it does look like the 12/03/2012 MDK (with Qt 4.7.4) was built with -qt-kbd-tty but not with: qt-kbd-qvfb and qt-kbd-linuxinput.
I noticed that it does have the mouse support (-plugin-mouse-tslib -qt-mouse-pc -qt-mouse-qvfb -qt-mouse-linuxinput). This would explain why I can use the mouse but not the keyboard with a Qt GUI app.

I assume this was the same for the 13/01/2014 MDK (with Qt 4.8.0).

Do you guys at Critical Link have another MDK with Qt built with all the mouse and keyboard settings?

Thanks
Mat

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Bob Duke over 4 years ago

Mat,

You could try testing the Alpha MDK release we uploaded under the Files tab (2016.01). This is a Yocto-based MDK. It looks like Qt was built with keyboard support as part of this MDK.

RE: MityDSP-L138F - Qt application not seeing USB keyboard - Added by Mathew Jones over 4 years ago

Hi
Thanks, I did very quickly look at the 2015 Alpha release but didn't see the Qt libraries.
At the same time I was investigating the Qt 'configure' parameters posted above and what is suggested by https://wiki.qt.io/Building_Qt_for_Embedded_Linux

Success! I managed to rebuild and install Qt 4.8.0 with USB keyboard support that works (with a few minor items I can live with for now: keymap for UK keyboard, no Capslock).

The configure settings I used were:

./configure -v -xplatform qws/linux-gnueabi-oe-g++ -embedded arm -little-endian -host-little-endian \
-prefix /usr \
-nomake demos -nomake examples \
-qt-kbd-linuxinput -qt-kbd-tty \
-qt-mouse-linuxinput -qt-mouse-pc \
-qt-gfx-linuxfb -qt-gfx-vnc \
-no-largefile -exceptions -no-accessibility -no-qt3support -no-sse2 -qt-zlib -no-gif -no-libtiff \
-qt-libpng -no-libmng -qt-libjpeg -no-nis -no-cups -depths 16 \
-qtlibinfix E -plugin-gfx-transformed \
-DQT_KEYPAD_NAVIGATION -release -no-pch \
-no-nas-sound -no-nis -webkit -xmlpatterns -no-rpath \
-no-fast \
-confirm-license

I then built and installed the libraries to a NFS mounted root filesystem I'd previously set-up from MDK2014 and to the development PC (VM) for cross-compilation:

make
sudo make install INSTALL_ROOT=~/NFS_rootfs
sudo make install INSTALL_ROOT=/usr/local/oecore-i686/sysroots/armv5te-angstrom-linux-gnueabi

    (1-8/8)
    Add picture from clipboard (Maximum size: 500 MB)