Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. QGamepad and missing name.
Forum Updated to NodeBB v4.3 + New Features

QGamepad and missing name.

Scheduled Pinned Locked Moved Solved Game Development
9 Posts 4 Posters 2.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Audetto
    wrote on last edited by
    #1

    Hi

    I am using QGamepad 5.7 in Fedora 26.
    And the name of the gamepad is always an empty string.

    I tried to read the code in https://github.com/qt/qtgamepad/blob/5.9/src/gamepad/qgamepad.cpp

    and I do not see any possible way for the name to be set, other than myself assigning to it.

    evdev provides libevdev_get_name().

    This piece of code

    const QList<int> gamepads = QGamepadManager::instance()->connectedGamepads();
    for (int id : gamepads)
    {
    QGamepad * gp = new QGamepad(id, this);
    QString name = gp->name(); // << ALWAYS empty
    }

    Is there any chance for the name to be set?

    A 1 Reply Last reply
    0
    • A Audetto

      Hi

      I am using QGamepad 5.7 in Fedora 26.
      And the name of the gamepad is always an empty string.

      I tried to read the code in https://github.com/qt/qtgamepad/blob/5.9/src/gamepad/qgamepad.cpp

      and I do not see any possible way for the name to be set, other than myself assigning to it.

      evdev provides libevdev_get_name().

      This piece of code

      const QList<int> gamepads = QGamepadManager::instance()->connectedGamepads();
      for (int id : gamepads)
      {
      QGamepad * gp = new QGamepad(id, this);
      QString name = gp->name(); // << ALWAYS empty
      }

      Is there any chance for the name to be set?

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @Audetto QGamepad only sets a name if one is available. It sounds like in linux evdev is not giving it a name. Or maybe there is a bug in Qt that isn't picking it up. Qt's hardware support is usually pretty bad in my experience. The rest of Qt is awesome but hardware is nasty.

      What does libevdev_get_name() return for that device id?

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Audetto
        wrote on last edited by
        #3

        The problem is that there is no support whatsoever to extract and forecast the name from the backend to the qgamepad via the manager. (regardless of which backend is actually used)

        I would like to propose a patch.
        I wonder if this is the right place?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          No it's not, but there's a Wiki page to get you started :)

          Happy hacking !

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • A Offline
            A Offline
            Audetto
            wrote on last edited by
            #5

            Ok I will try there.
            I have a patch for 5.7 which is used in Fedora 26, but I cant compile 5.10 without the full Qt 5.10 sources...

            Maybe I can wait for Fedora 27 and 5.9 which might make it easier...

            aha_1980A 1 Reply Last reply
            0
            • A Audetto

              Ok I will try there.
              I have a patch for 5.7 which is used in Fedora 26, but I cant compile 5.10 without the full Qt 5.10 sources...

              Maybe I can wait for Fedora 27 and 5.9 which might make it easier...

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Audetto said in QGamepad and missing name.:

              Ok I will try there.
              I have a patch for 5.7 which is used in Fedora 26, but I cant compile 5.10 without the full Qt 5.10 sources...

              You will need to compile Qt from Git to send patches to Gerrit. Please see https://wiki.qt.io/Building_Qt_5_from_Git It looks scaring at the first time, but trust me, under Linux the process is straightforward (I have done it 100 times). Compiling Qt under Windows is an adventure ;)

              Qt has to stay free or it will die.

              1 Reply Last reply
              1
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                To add to @aha_1980, you don't need to build the whole of Qt, qtbase + the module(s) you want to hack on is enough.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Audetto
                  wrote on last edited by
                  #8

                  I managed to do it in the end.
                  I guess I will try to follow your advice and build the minimum.

                  Here is the result

                  https://codereview.qt-project.org/207514

                  1 Reply Last reply
                  2
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Congratulation and thank you !

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved