Olcay Ertaş
Olcay Ertaş

Reputation: 6228

Can linux signal my Qt program when a particular USB device is connected?

I want linux to inform my Qt program by a signal when a particular USB device is connected. Storage devices like flash disk or hard drive. How can I do this? What are your suggestions?

UPDATE:

I have found that QtDbus can provide the functionality that I need but I have not figure out how exactly. Is there anyone can give information about getting USB device notification with QtDbus?

I have been reading this tutorial:
http://dbus.freedesktop.org/doc/dbus-tutorial.html

This tutorial says:
D-Bus is designed for two specific cases:

I am planning to use this facility which I am asking for help in a non-graphical Linux system. More precisely on Beagleboard-XM with Angstrom Linux console image with QWS.

In this circumstances does QtDbus is a correct choice?

Upvotes: 1

Views: 4312

Answers (2)

Neox
Neox

Reputation: 2004

You might want to take a look with qdbusviewer from qt4-dev-tools what kind of dbus interface your system has regarding device notification (be it HAL or udev). Than it is relatively simple to generate a c++ implementation with qdbusxml2cpp. You will just have to connect to whatever dbus signal your system is suppling for device notification purposes. Here is a quick start guide for qt and dbus QtDbus Tutorual.

Upvotes: 1

Martin Beckett
Martin Beckett

Reputation: 96109

Haven't tried Qt's DBUS implementation, but the general details of how to get a USB notification are in this tutorial

The QtDBus function names probably map onto these fairly easily

Upvotes: 1

Related Questions