LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-08-2005, 12:01 AM   #1
kr123
LQ Newbie
 
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
How To detect USB drive device file


Hello,
How can I detect a device file for a USB Mass storage (i.e /dev/sda1 or dev/sdb2) etc?
I want get this info (i.e /dev/sd[a-z]*) using a C program. I have to use it in GUI to mount/unmount. I will be using multiple USB devices......so i need to map the correct device file to particular USB drive.

Though the following commands give the info i required, how can I get this info programtically?

$"dmesg" will give the info
>> it will consist the info like
sda:sda1

and also
$"fdisk -l "
will give the info of all device pulgged in.


Please help in this regard.

Thanks in Advance
KR
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB drive not working properly, read only device? (USB key storage device) Arodef Linux - Hardware 14 01-01-2010 07:32 AM
How to detect USB Flash drive in C program? kr123 Programming 1 12-06-2005 02:56 PM
Assign one USB-storage device to one device file Misel Linux - Hardware 1 08-28-2004 03:52 AM
Linux does not detect usb device. josedsilva Linux - Hardware 3 07-21-2004 08:29 PM
How to auto-detect USB drive in RedHat 9? pelakh Red Hat 1 05-06-2004 01:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration