LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to eject a removable device in a software way, but not by "eject"command (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-eject-a-removable-device-in-a-software-way-but-not-by-eject-command-908109/)

viktor2000 10-14-2011 02:07 AM

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

macemoneta 10-14-2011 02:14 AM

The best way is to read the documentation for device "A", and code to the specification. No documentation, no code.

viktor2000 10-14-2011 02:22 AM

Quote:

Originally Posted by macemoneta (Post 4498162)
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,

macemoneta 10-14-2011 02:33 AM

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.

viktor2000 10-14-2011 02:52 AM

Quote:

Originally Posted by macemoneta (Post 4498176)
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!

macemoneta 10-14-2011 02:58 AM

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.

viktor2000 10-14-2011 03:08 AM

Quote:

Originally Posted by macemoneta (Post 4498192)
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 ?

macemoneta 10-14-2011 03:10 AM

And how would you make use of that? Perhaps by writing some code?

viktor2000 10-14-2011 03:25 AM

Quote:

Originally Posted by macemoneta (Post 4498200)
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

macemoneta 10-14-2011 03:29 AM

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.

viktor2000 10-14-2011 03:38 AM

Quote:

Originally Posted by macemoneta (Post 4498212)
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!:D

viktor2000 10-14-2011 04:13 AM

Quote:

Originally Posted by macemoneta (Post 4498212)
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

macemoneta 10-14-2011 04:17 AM

Removing a disk does not eject media, it simply makes it so the kernel will no longer communicate with it.

viktor2000 10-14-2011 04:40 AM

Quote:

Originally Posted by macemoneta (Post 4498231)
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


All times are GMT -5. The time now is 07:03 AM.