取消
显示结果 
搜索替代 
您的意思是: 

eject USB device programatically

I have an application which runs modal and hides the OS, this application requires the user to insert and remove usb flash drives.  Is there any api call to remove a USB drive?  I am able to find the drives with a search of D-Z:\ but I need to be able to eject the drive with a button on the Front panel.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 项奖励
1 条消息(共 12 条)
7,447 次查看

Try this article:

Community Admin Note:  The article link has been removed due to invalid information.

 
0 项奖励
2 条消息(共 12 条)
7,435 次查看
Thanks I will give it a try.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 项奖励
3 条消息(共 12 条)
7,410 次查看

I know this is an old post, but this is what I am looking for.

I tried this with Win7 and am not convinced it works.  The program responds that the drive was ejected, but the computer can still access the drive.  Do you know if there is an updated version for Win7?

Thanks.




metzler CLAD
0 项奖励
4 条消息(共 12 条)
6,563 次查看

@metzler wrote:

I know this is an old post, but this is what I am looking for.

I tried this with Win7 and am not convinced it works.  The program responds that the drive was ejected, but the computer can still access the drive.  Do you know if there is an updated version for Win7?

Thanks.


Plug-n-Pray. has gotten a bit better in the last 9 years.  With Win 7 and later my experience has been something like " If the Device can't be hot swapped on a USB port - Trash the obsolete device."  Not a common point of view.  Realistic though!

 

Lets look at the phy layer on a modern USB device.  Yup, "The Physical Layer"  all four connections!  Take a close look.  did you notice that two of the four conductors are just a bit shorter than the others?  Data lines are disconnected before 5V and Gnd. 5V and Gnd are connected before data lines.  Works like a charm.


"Should be" isn't "Is" -Jay
0 项奖励
5 条消息(共 12 条)
6,535 次查看

@JÞB wrote:

@metzler wrote:

I know this is an old post, but this is what I am looking for.

I tried this with Win7 and am not convinced it works.  The program responds that the drive was ejected, but the computer can still access the drive.  Do you know if there is an updated version for Win7?

Thanks.


Plug-n-Pray. has gotten a bit better in the last 9 years.  With Win 7 and later my experience has been something like " If the Device can't be hot swapped on a USB port - Trash the obsolete device."  Not a common point of view.  Realistic though!

 

Lets look at the phy layer on a modern USB device.  Yup, "The Physical Layer"  all four connections!  Take a close look.  did you notice that two of the four conductors are just a bit shorter than the others?  Data lines are disconnected before 5V and Gnd. 5V and Gnd are connected before data lines.  Works like a charm.


I think the main reason for 'safely removing hardware' is in the case of USB memory sticks where a write operation might not have completed if you just pull out the drive randomly. I think it's gotten a bit better in newer versions of windows (e.g. turning off/reducing write caching) but obviously if you were copying/writing to a file, the 'safely remove hardware' is a check to make sure any outstanding writes are complete.

 

Reference:

f78cdf98acb28496ba3a7499ecfa2ef00ef00a4003edb4d94564165e622ed518.jpg


LabVIEW Champion, CLA, CLED, CTD
(blog)
6 条消息(共 12 条)
6,499 次查看
Thanks for the information and quick response. So, as long as my LabView program writes to the USB drive and provides ample time afterwards, the computer should no longer be writing to the drive, and I can issue instructions to the user to remove the USB drive? If correct, is there a way to determine how long is ample time to write to the drive? I am worried that Windows might (quickly) write to it, then access every couple of minutes for some (stupid) reason.



metzler CLAD
0 项奖励
7 条消息(共 12 条)
6,470 次查看
8 条消息(共 12 条)
6,459 次查看

@OEM_Dev wrote:

You're probably OK by default

 

 

See

http://www.pcworld.com/article/254868/safely_remove_usb_drives_just_by_unplugging_them.html


nice link!


"Should be" isn't "Is" -Jay
9 条消息(共 12 条)
6,447 次查看
Thanks, I will assume everything is okay with removing it after writing a small file. .



metzler CLAD
0 项奖励
10 条消息(共 12 条)
6,402 次查看