USB mount point information or Identification of Removable media

Asked by Gaurav Bajaj

Hi Mates,

I am a helix developer and working on a bug.
I want to identify if a perticular media is removable or not.
Which apis can i use to track down this issue...?

Please guide me on this..!
Thanks in Advance

Gaurav

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Eric Bursley (eric-bursley) said :
#1

usbcore will track and auto mount media it can find. Typically this is done using the /media mount point, but that can be changed.
USB removable devices use the SCSI subsystem.
 For more information on usbcore or other kernel models, you can install the kernel-source package, and extract it.
You can also check out this site:
http://linux-hotplug.sourceforge.net

Revision history for this message
Gaurav Bajaj (gaurav-bajaj-83) said :
#2

Thanks for such a quick reply...
I am not really a linux guy... could you pls let me know about the APIs which can help me solve this purpsose... or the SDK and lib files too

Revision history for this message
Eric Bursley (eric-bursley) said :
#3

I don't know of an API that will directly tell you this. Not that there may not be one, I just can't find any reference to this in the kernel doc or api. Given that there are ways to determine that media is removable or not. The first is to look for when a new USB device is attached. This can be tracked using the USB drivers. example documentation below.
http://www.lrr.in.tum.de/Par/arch/usb/usbdoc/node17.html

If you are checking for other removable media, such as CDROM / DVD, then you can check using the device mount point itself. i.e. CDROM / DVD drives typically have an entry in the /etc/fstab.

there is also submount, which is an ongoing project that aims to do this as well.
http://sourceforge.net/projects/submount/

If done of this helps, then perhaps someone else here with more kernel level knowledge than I could assist.

Can you help with this problem?

Provide an answer of your own, or ask Gaurav Bajaj for more information if necessary.

To post a message you must log in.