From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Eject USB Flash drive

Hello,

I have a program that acquires some data and then the user can go there with a USB pen drive to get that data for further analisys.
The machine has no keyboard and no mouse, it has a tactile LCD that is used to interface with the system.
The problem is, I don't know how to eject the USB drive before removing it from the USB connector.
When I remove it in that way, I have the risk that the data is not yet completely saved in the disk.
Does anyone know how to make and eject a removable drive from Windows?

Any help will be apreciated,
Thanks a lot,
Paulo
0 Kudos
Message 1 of 5
(3,365 Views)
To get the system's permission to remove the drive, click on the Safely
Remove Hardware icon in the system tray next to the clock. You will get a
list of removable items. After selecting one, another bubble will soon
appear telling you if it is ok to remove the drive. You can make the icon
stay visible by Customizing the Taskbar Properties and changing it's
behavior to Always Show. The icon looks like a green arrow floating over a
PCMCIA card.

"PauloM" <x@no.email> wrote in message news:192180@exchange.ni.com...
> Hello,<br><br>I have a program that acquires some data and then the user
> can go there with a USB pen drive to get that data for further
> analisys.<br>The machine has no keyboard and no mouse, it has a tactile
> LCD that is used to interface with the system.<br>The problem is, I don't
> know how to eject the USB drive before removing it from the USB
> connector.<br>When I remove it in that way, I have the risk that the data
> is not yet completely saved in the disk.<br>Does anyone know how to make
> and eject a removable drive from Windows?<br><br>Any help will be
> apreciated,<br>Thanks a lot,<br>Paulo


0 Kudos
Message 2 of 5
(3,351 Views)
Hello,

I'm sorry that didn't explain my problem very well...
I know how to remoce the device from the system, the question is, how to do it programatically?

Thanks a lot,
Paulo
0 Kudos
Message 3 of 5
(3,348 Views)
I don't know. But maybe you don't have to. How are you writing the data to
the drive? Are you using LabVIEW or drag and dropping with Explorer? If
using LabVIEW, display a warning message until you close the file.

Plug in the flash drive and look for it's driver properties in the Device
Manager. Under Policies, see what's selected. I'm guessing that in XP most
flash drives will default to disable write caching so that you can
disconnect without using Safe Removal.

"PauloM" <x@no.email> wrote in message news:192237@exchange.ni.com...
> Hello,<br><br>I'm sorry that didn't explain my problem very well...<br>I
> know how to remoce the device from the system, the question is, how to do
> it programatically?<br><br>Thanks a lot,<br>Paulo


0 Kudos
Message 4 of 5
(3,341 Views)
Programatically ejecting a USB device is probably handled through a PnP or device management function in the windows API through a dll call. I wouldn't offhand know which call to make but if it is possible the MSDN should document it online. I would read up on the use of these functions in full before playing around with them since we are at a kernel level and wouldnot want to disable the wrong device. The simplest solution is to keep a warning indicator to alter the user not to remove the drive when it is needed. This still does not keep the user from removing it when instructed not to.

-Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 5
(3,334 Views)