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 08-17-2011, 12:17 AM   #1
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Rep: Reputation: Disabled
Thumbs up identity Device Driver USB With Eclipse


hi all .
i want write a program with eclips in linux .
please guide me for start this program .
how do identity a usb when it connected or removed ?

thanks
 
Old 08-17-2011, 12:30 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello donya, welcome to LQ,

could you please provide more information about what you want to do?

What has the USB-device to do with your program? if you want to find out more about the USB-devices on your system you may use the commands "dmesg", "lsusb" or read about udev, the manpages are available with the commands
Code:
man dmesg
and
Code:
man lsusb
and
Code:
man udev
Markus
 
1 members found this post helpful.
Old 08-17-2011, 12:43 AM   #3
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hello Markush
Thank you for replay my question .

I want to write a program with eclips Software .
This program should be identity usb flash that coneccted to PC, then
write or read files in/from it .

thanks
 
Old 08-17-2011, 12:44 AM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Well, normally the USB-device is mounted automatically, you'll only have to parse the output of
Code:
df
to find out where the device is mounted.

Markus
 
Old 08-17-2011, 12:48 AM   #5
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
how to do use "Code : df " ?
 
Old 08-17-2011, 12:57 AM   #6
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
I'll give you an example with Perl:
Code:
#!/usr/bin/perl

use strict;
use warnings;

my $line;
foreach $line (`df`) {
    if ($line =~ m/(\/media\/.+)/) {
        my $path = $1;
        print $path, "\n";
    }
}
provided that all USB-devices are automatically mounted anywhere in /media this program will show you the full path of any device which on your system is mounted in /media.

Hope that helps

Markus
 
Old 08-17-2011, 01:04 AM   #7
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
I Try Use This Code , And then Talk with you .

thank you .
 
Old 08-17-2011, 01:05 AM   #8
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
And I should be Work with C on Eclips
 
Old 08-17-2011, 01:23 AM   #9
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
Markus can you please give me a sample with C ?
 
Old 08-17-2011, 03:24 AM   #10
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
No, I'm not a programmer and my knowledge of C is not sufficient for this.

I'd recommend that you use the "Report" Button at one of your posts and ask a Moderator to move this thread to "Programming" http://www.linuxquestions.org/questions/programming-9/

Markus
 
Old 08-17-2011, 03:36 AM   #11
donya
LQ Newbie
 
Registered: Aug 2011
Posts: 10

Original Poster
Rep: Reputation: Disabled
thank Markus.
 
Old 08-17-2011, 02:11 PM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-19-2011, 01:17 AM   #13
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Do you just want to copy files to the device after it has been mounted? If so, why are you using C instead of a shell script, for example?
 
Old 09-21-2011, 06:31 AM   #14
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Is this the Eclipse that you are talking about? Or is it one of the other ones found here? Since you did not supply a link or give other identifying info., we need clarification.

Is this homework or some other kind of project where using Eclipse is one of the conditions? Please say so, otherwise we will waste time suggesting simpler ways to do the job.
 
  


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 device driver using usb-skeleton.c mermaid2008 Linux - Newbie 5 05-22-2016 03:15 AM
[SOLVED] USB device is not claimed by any active driver for every device in Linux 2.4 jacquesdirac Linux - Hardware 3 11-12-2010 08:35 AM
Question about usb storage device and device driver balteo Linux - Hardware 2 11-21-2009 09:37 AM
Device driver for USB storage device linuxdeveloper29 Linux - Hardware 1 10-24-2008 08:30 AM

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

All times are GMT -5. The time now is 06:55 PM.

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