Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. HID Device Detection
Qt 6.11 is out! See what's new in the release blog

HID Device Detection

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 3.6k Views 1 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.
  • S Offline
    S Offline
    stevedorries
    wrote on last edited by
    #1

    I have a need to detect if data is coming from a real keyboard or a barcode reader that reports itself as a keyboard and sends keystrokes and react differently to that input versus the real keyboard or a virtual keyboard.

    From my googling I've reached the understanding that this will have to be accomplished in a different manner on different platforms, my first concern is Linux, and I haven't been able to find anything that would point me in the right direction to accomplish my goal.

    How do I tell my application to listen to the keyboards differently?

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

      Hi,

      Since we are talking about linux and without diving too deep in Qt's internals you could create an object that reads directly from the correct input device in /dev. Your widget would have to ignore all key events and get feed from that special keyboard reader.

      Hope it helps

      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
      • S Offline
        S Offline
        stevedorries
        wrote on last edited by
        #3

        https://github.com/bimetek/QUSB

        I followed your advice to read the device directly from /dev/foo, to figure out what subdirectory I need to be reading from I found the linked wrapper for libUSB. I'm almost positive there is a way to use that wrapper to do the actual reading so I don't have to open a device file, but I'm not sure how yet. I just thought it may be of some interest to other developers using Qt that there is a prettier way than directly calling libUSB functions.

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

          You can also setup your system to give a specific name to that device so you don't have to search with special means

          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
          • S Offline
            S Offline
            stevedorries
            wrote on last edited by
            #5

            Can multiple different devices be assigned the same friendly name?

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

              If they are not connected at the same time it should be possible. It depends on what you are using on your target distribution to handle devices.

              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