Evdevkeyboard does not detect my keyboards



  • Systems is as follows: Embedded linux device, no actual keyboard, but touch screen device on event0. Two other embedded devices providing keyboard input functionality on event 1 and event2. In my Qt application, I am not picking up the events from the two keyboard devices.

    QT 5.6.0
    Linux 3.18

    Here is a cat /proc/bus/input/devices. The event0 is the touchscreen and the others are for the two devices creating keypress events.
    I: Bus=0019 Vendor=0000 Product=0000 Version=0000
    N: Name="at91_adc"
    P: Phys=
    S: Sysfs=/devices/ahb/ahb:apb/f8018000.adc/input/input0
    U: Uniq=
    H: Handlers=event0
    B: PROP=0
    B: EV=b
    B: KEY=400 0 0 0 0 0 0 0 0 0 0
    B: ABS=1000003

    I: Bus=0019 Vendor=0001 Product=0010 Version=0001
    N: Name="a3906"
    P: Phys=a3906-keys/input0
    S: Sysfs=/devices/platform/a3906/input/input1
    U: Uniq=
    H: Handlers=kbd event1
    B: PROP=0
    B: EV=3
    B: KEY=42000 0 0

    I: Bus=0019 Vendor=0001 Product=0010 Version=0001
    N: Name="at91_fdrift"
    P: Phys=at91-fdrift/input0
    S: Sysfs=/devices/platform/at91_fdrift/input/input2
    U: Uniq=
    H: Handlers=kbd event2
    B: PROP=0
    B: EV=3
    B: KEY=42000 0 0

    When running evtest, I can select one of the keypress devices and it will generate the event as required.

    I have tried to start the qt app with below command without any luck.
    ./ee -plugin evdevkeyboard:/dev/input/event1;grab=1-plugin evdevkeyboard:/dev/input/event2;grab=1

    I enabled the QT_LOGGING_RULES=qt.qpa.input=true to get more info as given below:
    ./ee -plugin evdevkeyboard:/dev/input/event1;grab=1-plugin evdevkeyboard:/dev/
    input/event2;grab=1
    qt.qpa.input: evdevkeyboard: Using device discovery
    qt.qpa.input: static device discovery for type QFlags(0x8)
    qt.qpa.input: Found matching devices ()
    qt.qpa.input: evdevmouse: Using device discovery
    qt.qpa.input: static device discovery for type QFlags(0x1|0x2)
    qt.qpa.input: Found matching devices ()
    qt.qpa.input: evdevtouch: Using device discovery
    qt.qpa.input: static device discovery for type QFlags(0x2|0x4)
    qt.qpa.input: Found touchscreen at "/dev/input/event0"
    qt.qpa.input: Found matching devices ("/dev/input/event0")
    qt.qpa.input: evdevtouch: Adding device at "/dev/input/event0"
    qt.qpa.input: evdevtouch: Using device /dev/input/event0
    qt.qpa.input: evdevtouch: /dev/input/event0: Protocol type A (single)
    qt.qpa.input: evdevtouch: /dev/input/event0: min X: 0 max X: 4095
    qt.qpa.input: evdevtouch: /dev/input/event0: min Y: 0 max Y: 4095
    qt.qpa.input: evdevtouch: /dev/input/event0: min pressure: 0 max pressure: 16777215
    qt.qpa.input: evdevtouch: /dev/input/event0: device name: at91_adc
    qt.qpa.input: evdevtouch: Updating QInputDeviceManager device count: 1 touch devices, 0 pending handler(s)

    The event filter in qt where i try to catch the keypresses looks like this:

    bool MainWindow::eventFilter(QObject *obj, QEvent *event)
    {
        if (event->type() == QEvent::KeyPress)
        {
            QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
    
            if ((keyEvent->key() == Qt::Key_A) && bCanAcceptNewMeasurement)
            {
                emit sigUpdateBar(0,0,itest++,itest++);
                bCanAcceptNewMeasurement = false;
            }
    
            if (keyEvent->key() == Qt::Key_R)
            {
                emit sigRotDone();
                bCanAcceptNewMeasurement = true; //Can now accept new measurements again
            }
    
            if (keyEvent->key() == Qt::Key_0)
            {
                emit sigMoveDone();
            }
        }
    }
    

    Environment looks like this:
    printenv
    USER=root
    SHLVL=1
    OLDPWD=/
    HOME=/root
    PAGER=/bin/more
    TSLIB_FBDEVICE=/dev/fb0
    PS1=#
    TSLIB_TSDEVIC=E/dev/input/event0
    TSLIB_CONSOLEDEVICE=none
    LOGNAME=root
    TERM=vt100
    QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=rotate=180
    QT_DEBUG_PLUGINS=0
    PATH=/bin:/sbin:/usr/bin:/usr/sbin
    SHELL=/bin/sh
    QT_LOGGING_RULES=qt.qpa.input=true
    PWD=/var
    EDITOR=/bin/vi

    What am i missing here?
    Can Qt/Linux take inputs from all input devices (event0 to 2) and channel it to an event filter?

    Please help me.



  • I'm not sure if your difficulty is the Qt event or getting Qt to recognise any event.

    If it's the latter, maybe the following will help.
    My Touchscreen uses event1 so I use
    -plugin evdevtouch:/dev/input/event1
    in the Run Arguments for the kit.



  • Hi, in general, QT detects my touch event no problem. They are on event0. I cannot get QT to detect the events on the event1 and event2 devices at the same time.

    So the general question is whether evdevkeyboard can detect events from more than one device defined as keyboard.

    If that is the case ( as i suspect), then why does Qt not detect my devices as keyboards?



  • @Mikkie

    Is the community stumped? Or is the question of such a stupid level that it does not warrant an answer?


  • Lifetime Qt Champion

    Hi,

    Neither, more likely nobody had the same setup as you.

    Did you check @Mikkie suggestions ?



  • @SGaist
    I thought my question was generic enough to hit some similar setups.

    i .e.
    Can Qt/Linux take inputs from all input devices (event0 to 2) and channel it to an event filter?

    So anybody with a setup where there might be two keyboards, or keyboard and some other hard-buttons that also generate keyboard events should qualify as a similar setup.

    typing this makes me think it MUST be possible.... two keyboards are not that far-fetched.


  • Lifetime Qt Champion

    Are you looking for something like the /dev/mice device ?

    If not, I'm not aware of any multiple input device support out of the box when not using Xorg.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.