LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2011, 02:07 AM   #1
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Rep: Reputation: Disabled
Thumbs up how to eject a removable device in a software way, but not by "eject"command


hi...good afternoon ,friends :

i'm doing a software project about a embed device which i called "A" device "A" whose OS is linux...( for simplicity ,we can seem the device "A" as a normal computer and its OS is linux)
,i was told that device "A" doesn't have "eject" command , and the more unlucky things is that i have to eject the device "B" which is plug in the device "A" in a software way....how can i realize it !...


any help will be appreciated!

Viktor
2011.10.14

Last edited by viktor2000; 10-14-2011 at 02:23 AM. Reason: details
 
Old 10-14-2011, 02:14 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The best way is to read the documentation for device "A", and code to the specification. No documentation, no code.
 
Old 10-14-2011, 02:22 AM   #3
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by macemoneta View Post
The best way is to read the documentation for device "A", and code to the specification. No documentation, no code.
device "A" is a kind of embeded device whose OS is linux... for simplicity ,we can seem the device "A" as a normal computer and its OS is linux,
 
Old 10-14-2011, 02:33 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
If the device doesn't respond to standard commands, it's not "normal". However it is uniquely defined, its control must be coded to specifically for the device. We don't know what that specification is, and we can't read minds. If you have been contracted to create the code, you have access, possibly under an NDA, to the specification. You have to code to that specification.
 
Old 10-14-2011, 02:52 AM   #5
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Cool

Quote:
Originally Posted by macemoneta View Post
If the device doesn't respond to standard commands, it's not "normal". However it is uniquely defined, its control must be coded to specifically for the device. We don't know what that specification is, and we can't read minds. If you have been contracted to create the code, you have access, possibly under an NDA, to the specification. You have to code to that specification.
i'm sorry that i didn't explain it clearly.... actually , "A" is support the standard linux commands , the key is that it doesn't have all the commands of linux for it is an embeded device and its resource is very limited !
thank you for your concentration to my post!
 
Old 10-14-2011, 02:58 AM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Then just port the eject command. You will have to re-implement it anyway to perform the function. If you don't have the resource for 20k of code, you won't have the resource to do it any other way either.
 
Old 10-14-2011, 03:08 AM   #7
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by macemoneta View Post
Then just port the eject command. You will have to re-implement it anyway to perform the function. If you don't have the resource for 20k of code, you won't have the resource to do it any other way either.
Thanks . .. is there a solution that just operating the linux kernel ?
 
Old 10-14-2011, 03:10 AM   #8
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
And how would you make use of that? Perhaps by writing some code?
 
Old 10-14-2011, 03:25 AM   #9
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by macemoneta View Post
And how would you make use of that? Perhaps by writing some code?
... i'm not sure if linux has this kind method that operating kernel to solve my problem, but my experience tell me that linux always has couple of method to realize a function.....so i guess ..haha
 
Old 10-14-2011, 03:29 AM   #10
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
It's not a method, it's device control. The device specifies that, not the kernel. The kernel allows you to communicate with the device, but you have to write the code. The eject command (or the eject function in busybox, whatever userspace you're using) perform the necessary I/O. If you think you can code it better, pull the source for eject or busybox, and code away.
 
Old 10-14-2011, 03:38 AM   #11
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Talking

Quote:
Originally Posted by macemoneta View Post
It's not a method, it's device control. The device specifies that, not the kernel. The kernel allows you to communicate with the device, but you have to write the code. The eject command (or the eject function in busybox, whatever userspace you're using) perform the necessary I/O. If you think you can code it better, pull the source for eject or busybox, and code away.
thank you, you are really kind ! haha , i will tell the manufacturer of "A"device tomorrow that: add the "eject " command ,otherwise i quit!
 
Old 10-14-2011, 04:13 AM   #12
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Lightbulb

Quote:
Originally Posted by macemoneta View Post
It's not a method, it's device control. The device specifies that, not the kernel. The kernel allows you to communicate with the device, but you have to write the code. The eject command (or the eject function in busybox, whatever userspace you're using) perform the necessary I/O. If you think you can code it better, pull the source for eject or busybox, and code away.
http://www.novell.com/communities/no...tipath-systems the info on this website seeme to be a solution
 
Old 10-14-2011, 04:17 AM   #13
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Removing a disk does not eject media, it simply makes it so the kernel will no longer communicate with it.
 
Old 10-14-2011, 04:40 AM   #14
viktor2000
LQ Newbie
 
Registered: Sep 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
Talking

Quote:
Originally Posted by macemoneta View Post
Removing a disk does not eject media, it simply makes it so the kernel will no longer communicate with it.
you are right , but those info gave me a sort of clue.... there may be a important discovery which hide in /sys
 
  


Reply

Tags
cdrom, device, eject, linux, usb



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
[SOLVED] thunar Failed to execute child process "eject" kaz2100 Debian 0 06-23-2011 06:14 AM
"unable to eject" error when trying to safely remove ipod shuffle in slack 12 mattydee Slackware 10 07-06-2007 05:03 PM
Toggling "eject" and "eject -t" daihard Linux - Software 3 12-27-2004 03:01 AM
CD Won't Eject With "eject" Command Dr. Ephemeron Slackware 13 11-13-2003 12:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:02 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