PDA

View Full Version : Retrieving device information from the path



LisaDearheart
7th April 2011, 20:22
Hi,

first, I'm new in this forum, so hello to everybody and I hope this isn't the wrong board :)
Here's my problem: I'm writing a C++ application and I need to retrieve some information about an USB device (specifically the vendor, filesystem and capacity) knowing its path ("/dev/sdXX"). Is there some library I can use? I tried Solid (I can have access to the correspondent device UDI too) but the only solution seems to list all the existent devices and then compare their paths until they match with mine, but it doesn't seem an efficient solution. Maybe there's a direct approach to do this. Someone has a better idea?

Thanks in advance,
Lisa

tbscope
8th April 2011, 05:35
If you only want to target Linux systems, you can use DeviceKit:
http://hal.freedesktop.org/docs/DeviceKit/
http://hal.freedesktop.org/docs/DeviceKit-disks/

LisaDearheart
8th April 2011, 12:19
Yes, it's just for Linux.

Thanks a lot :)
Lisa