QGamepad from sources

  • Hi,

    First I have a problem reported 6 months ago with QGamepad:
    On Ubuntu it use the EVDEV backend and it never take the gamepad connection state:

    • With QGamepad: if i remove the gamepad, "m_gamepad->isConnected()" still have the "true" value
    • With QGamepad: The event connectedChanged is never trigered when i disconnect the gamepad
    • With QGamepadManager: The event QGamepadManager::connectedGamepadsChanged is never trigered when i connect/disconnect a gamepad
    • With QGamepadManager: The event QGamepadManager::gamepadConnected is never trigered when i connect/disconnect a gamepad
    • With QGamepadManager: The event QGamepadManager::gamepadDisconnected is never trigered when i connect/disconnect a gamepad
    • With QGamepad or QGamepadManager: When my gamepad is disconnected I see this message in the console "Gamepad: Could not read from input device (Aucun périphérique de ce type)",

    For my application it is really critical to have this working. I use the gamepad for control a big robot. I need to stop the motors if we are unable to communicate with the gamepad

    So, I want to check what is wrong and by able to repair it.

    1/ I have downloaded the sources (and everything for Qt5.5) using this tool:


    2/ I have build the sources:

    cd /home/caipiblack/Qt/5.8/Src
    sudo make install

    3/ QGamepad was correctly generated:

    cd /home/caipiblack/Qt/5.8/Src/qtgamepad/lib
    cmake  libQt5Gamepad.la  libQt5Gamepad.prl  libQt5Gamepad.so  libQt5Gamepad.so.5  libQt5Gamepad.so.5.8  libQt5Gamepad.so.5.8.0  pkgconfig

    4/ But QGamepad is not in /usr/local/Qt-5.8.0/lib I'm not sure if it's a bug or not.
    So I copied everything from /home/caipiblack/Qt/5.8/Src/qtgamepad/lib
    to /usr/local/Qt-5.8.0/lib

    cd /home/caipiblack/Qt/5.8/Src/qtgamepad/lib
    cp * /usr/local/Qt-5.8.0/lib -r

    5/ When I run the example called "Simple" for QtGamepad, I get these error:

    11:56:10: Exécution des étapes pour le projet simple...
    11:56:10: Débute : "/home/caipiblack/Qt/5.8/Src/qtbase/bin/qmake" /home/caipiblack/Bureau/gamepad_test/simple.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
    Project ERROR: Unknown module(s) in QT: gamepad
    11:56:10: Le processus "/home/caipiblack/Qt/5.8/Src/qtbase/bin/qmake" s'est terminé avec le code 3.
    Erreur lors de la compilation/déploiement du projet simple (kit : Qt 5.8.0 (Src))
    The kit Qt 5.8.0 (Src) has configuration issues which might be the root cause for this problem.
    When executing step "qmake"
    11:56:10: Temps écoulé : 00:00.

    Note: For fast build it is possible to build QGamepad separately:

    cd /home/caipiblack/Qt/5.8/Src/qtgamepad
    sudo make install

    So my problem is how to use the QtModule build by myself ? What is wrong ?

    Another question: Is it the proper way for debug a Qt module ?


  • Lifetime Qt Champion


    If you want the latest and greatest, building from git would be more indicated.

    Otherwise, you can build the qtgamepad module standalone with your already installed Qt and call make install from the build folder.

    One thing, you should rather do out of source build, that way if you have a doubt you can simply nuke the build folder and start anew.

  • Hi,

    Did you have any ideas why Qt creator tell me "Project ERROR: Unknown module(s) in QT: gamepad" after the module QGamepad be make and install ?

    Where did Qt looks for "know modules" ? Did it check a specific file ?


  • Lifetime Qt Champion

    Did you re-run qmake after installing the module ?

    You can take a look in the mkspecs of your installation under modules.

  • Hi,

    Did I have to re-run qmake after the module installation ?

    cd /home/caipiblack/Qt/5.8/Src/qtgamepad/mkspecs/modules
    qt_lib_gamepad.pri  qt_plugin_evdevgamepad.pri  qt_plugin_sdl2gamepad.pri
    cd /home/caipiblack/Qt/5.8/Src/qtgamepad/mkspecs/modules-inst
    qt_lib_gamepad.pri  qt_lib_gamepad_private.pri  qt_plugin_evdevgamepad.pri  qt_plugin_sdl2gamepad.pri

    Why Qt doesn't see the qgamepad module as "Known module" if it is build and installed ?

    Thanks for your help

  • Lifetime Qt Champion

    No you shouldn't, what I meant and that wasn't clear was whether you ran a different qmake than the one you used to build the module since you seem to have called make install several times.

  • This post is deleted!

Log in to reply

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