PDA

View Full Version : How to list the external devices using QT Dbus?



vjsharma_30
22nd February 2010, 18:36
I want to create a file dialog which can list the only external devices connected to the system,like USB.
I am using QDBusAbstractInterface class. I am calling the function
FindDeviceByCapability("storage"); but this function list me all the storage devices. But i am only interested in external USB devices. Is there some other parameter to pass.
Also what i am getting as output is something like

/org/freedesktop/Hal/devices/storage_serial_Kingston_DataTraveler_102_001372982 955A9C0E6C50103_0_0

But i want the path of the mounted devices,so that when it is displayed in the file dialog user can browse it.

squidge
22nd February 2010, 20:00
Have a look at fstab (http://linux.about.com/od/commands/l/blcmdl5_fstab.htm) & getmntent.htm (http://linux.about.com/library/cmd/blcmdl3_getmntent.htm)

But even with those, it's going to be difficult to detect if a device is connected via USB or not, as to an application, it's transparent.

vjsharma_30
22nd February 2010, 20:11
Can't i do it with out using the unix system commands?

squidge
22nd February 2010, 21:35
Qt has no support for what you want to do, so you need to use OS-specific commands to do it.