Is there a Qt solution for detecting USB events (insert and delete)?

As some other people have already asked here several years ago, I want to be able to detect in the Qt application when the pendrive / datatraveler is connected and when it is disconnected from my system (both on Linux Ubuntu and Embedded Linux).

I searched in SO, and I noticed that most of the answers were not only very outdated (for example, from 2010), but all solutions in some way affected "non-Qt solutions": any specific platform or the use of external libraries such like udev and DBus.

What I want to know first of all, if there is a specific Qt solution for this, that is, a way to do this without requiring the addition of external libraries or codes for a specific platform, and how I can use it. Preferably, it should already be available in Qt 4.8. If there is no Qt solution, then a Qt-based library will be acceptable.

Add: Search Results:

+8
source share
3 answers

As already stated, Qt itself does not provide such a module. However, there is a class, QDeviceWatcher user QDeviceWatcher . I have no experience with him personally, and he does not update regularly, but you can try.

You can find the forum post here and the Git repository here .

+5
source

There is no such API in Qt, but you can continue with some of the libusb software implementations, which is pretty surprising.

+3
source

One more tip:

libusbx was the libusb fork, a library that provides shared access to USB devices. As of 2014.01.26, this project is completely merged back into libusb and terminated. Since there will be no more releases of libusbx, you are strongly encouraged to switch to using libusb. ----- from http://libusbx.org/

+2
source

All Articles