Nominate our 2022 Qt Champions!

Is it possible to reconnect to input devices (/dev/input/eventX) without restarting the application?

  • Hi all,

    I have a qml application running on a RaspberryPi 3.
    At application startup the application "connects" to the different input devices (/dev/inpu/eventX) like touchscreen and barcode reader.
    Sometimes I get the following error message:

    evdevkeyboard: Could not read from input device (No such device)

    Then it could be that the barcode reader is not longer available for the application. Maybe the barcode reader reconnects for some reasons.

    Now my question: Is it possible to "connect" to input devices again, without resarting the application?

    Kind regards,

  • Lifetime Qt Champion


    How are you "connecting" to that device in your application ?

  • Hi,

    that is the strange thing.
    I am not actively connecting to input devices.
    I think the application handels this on it's own by evdev. If I use QT_LOGGING_RULES, I can see that the application is searching for input devices and connecting to them at start up. But after that, if the input device is turned off or disconnected I get the above mentioned error message. Unfortunately after reconnecting the input device the application does not connect to it again.

    How can I handle this situation?

  • Lifetime Qt Champion

    The thing is, since the device is technically still opened, when you reconnect it, it likely has been given another id.

    Can you verify that ?

  • @SGaist : I can see the system that the device is getting the same id after it "reconnects" to the system.

  • Lifetime Qt Champion

    Then you will have to modify the evdev plugin to see if you can reconnect.

Log in to reply