Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Could not read from input device: No such device
Forum Update on Monday, May 27th 2025

Could not read from input device: No such device

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
qt5qt quick
7 Posts 2 Posters 6.4k Views
  • 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.
  • chaithubkC Offline
    chaithubkC Offline
    chaithubk
    wrote on last edited by
    #1

    I have a Qt application that's been built to run on Embedded Linux platform (i.Mx.6). My application should support both touch screen as primary input device and an optional USB keyboard if connected. So for now, I have configured to be launched as mentioned below:

    my-qt-app -plugin tslib:/dev/input/event0 -plugin evdevkeyboard:/dev/input/event1 
    

    My application is able to detect the touchscreen and keyboard properly, BUT, I am noticing a problem if I unplug the keyboard while my application is still running, I see the below error on the console:

     Could not read from input device: No such device
    

    And my Qt application is lagging and is very slow in responding to the touch screen. Looking at the above error message it seems my application is still expecting some sort of data from the keyboard ?

    Can somebody help me to recover from this error please, also if there is a way that I can detect the keyboard presence runtime so that I no need to pass -plugin evdevkeyboard as command line argument to my GUI application.

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

      Hi and welcome to devnet,

      One thing that might be happening: when you plug your device back it doesn't get the same device id assigned.

      That's one thing you should check.

      You can try to add a rule to udev that will always give the same name to your keyboard device or make a symbolic link to it.

      One last thing that could be interesting is to check whether there's a module providing a device like mousedev but for keyboard (see here

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

        Hi SGaist,

        Thank you for the reply. After spending some time to learn about this issue, I found there are two problems that I need to resolve: The first one is as you pointed out:

        1. I need to fix the mapping of devices so that the are not being assigned eventx locations dynamically and that I need to set same name for keyboard and mouse and find a way to pass this to my startup script so that my-qt-app detects the right device.
        2. The deletion/reinsertion of the usb keyboard after boot – that trigger the never ending stream of error message " Could not read from input device: No such device" that looks like a Qt issue as the keyboard is not being remapped to a different eventx

        Am still trying to fix the point (1), because am pretty new to Linux, and my target uses mdev. And my target board has only one USB port and am using an USB hub to which I am connecting USB Keyboard and USB Mouse - it is just working fine If I connect the devices to the same port and if devices are present on bootup.

        1 Reply Last reply
        0
        • chaithubkC Offline
          chaithubkC Offline
          chaithubk
          wrote on last edited by
          #4

          Currently if I have all input devices (Keyboard, mouse and touchscreen) connected/configured on bootup to my target. And then launch my qt application with command line parameters passing the plugin information as below:

          my-qt-app -plugin tslib:/dev/input/event2 -plugin evdevmouse:/dev/input/event1 -plugin evdevkeyboard:/dev/input/event0 &
          
          

          My application works fine. There are two important things I need to get it done first:

          1. I need same name for each input device all the time irrespective of whether the devices are plugged on bootup or after bootup. That way my Qt application is aware that touchscreen is always /dev/input/event2 (for example).
          2. And if the input device is removed/unplugged my Qt application should stop expecting some information from the device and should not produce the error message am observing. And that, if the device is connected back it should detect and work normally.

          Please advise, thanks in advance.

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

            The probably most useful option would be to implement hot plug handling,

            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
            • chaithubkC Offline
              chaithubkC Offline
              chaithubk
              wrote on last edited by
              #6

              My Qt application used a QML item

              TextField {
              }
              

              using which am my application would receive the data from USB keyboard. I have built this simple Qt application to run on Android smart phone and on iMx6 based device running Embedded Linux on it.

              My Qt Application on android smart phone was able to get the inputs from USB Keyboard the moment I connect the keyboard to the smart phone. But, If I do the same on the iMx6 based target I have to pass -plugin evdevkeyboar:/dev/input/eventx , maybe because our Kernel doesn't support detecting hot pluggable devices and pass it on to the Qt application like Android does.

              I am pretty new to Linux world, so am still trying to figure out what I need do so that my Qt application on iMx6 based target would work same as how it was working on Android smart phone.

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

                AFAIK, if you have udev, you should get device detection for your application.

                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