What i want to do is for my program to detect all USB disks inserted and return the device path (/dev/XXX) and system type.

My first tought was to fetch output from fdisk -l but thats not very fancy and i guess there is some function or such to do this for me out there?

I would be thankfull if anyone could help me in the right direction on this one.

Bare in mind that i'm a beginner :)


I would suggest using lsusb, but this will list all usb devices, so if you have a printer or mouse, or possibly an sda drive, you will have to weed them out.

Just an idea, I fell on this page. I think it should be possible to access the usb devices through HAL (sorry, I don't have enough time to investigate the idea now).


I think i will solve it with lsusb.
I check lsusb when USB disk is detach and then check differences of output when usb is inserted.