c++qtembedded-linuxudevhotplugging

Detecting USB mouse. Qt on Embedded Linux


I need to hide the cursor when USB mouse is disconnected from the system, and show it when the mouse is connected. Any ideas how it can be done?


Solution

  • Qt itself does not provide such a module. There is a user-made class called QDeviceWatcher, you could give it a try.

    If you are using QtEmbedded Linux, you have a folder with all USB devices info (vendor id, etc), probably in /proc/scsi/usb-storage file. So you probably could use QFileSystemWatcher to handle modification in this folder.

    See: Qt Centre Post for more detail.