LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect USB Stick insertion

I am trying to write a LabVIEW app that will be able to detect that a USB stick/key has been inserted into the computer. I know that I can get the names and serial numbers of all the drives that are currently mounted. However, I do not know how to check to see if one of them is a USB mass storage device, more specifically a USB stick as opposed to a USB-attached optical drive.
 
I could just check the size of the device and if it is under 4GB assume that it is a USB key. But if there is a more elegant way of doing it that I can be more sure of, I would like to do it.
 
Using LabVIEW 8.2.1
 
Kyle
0 Kudos
Message 1 of 9
(9,767 Views)
You could try the VI mentioned in this LAVA thread.

Or, you can try this C# class.
0 Kudos
Message 2 of 9
(9,757 Views)
Thank you. I think I am just going to go with the polling with the list directory VI every 100 ms or around that. Just compare the new list of drives to the old ones, if there is a new one I will take the action that I want.
 
I think the environment is controlled enough that we won't have issues with that. No one will be swapping drives out like mad (or at least they shouldn't be!).
 
Kyle

Message Edited by Kyle Thompson on 05-29-2007 08:07 AM

0 Kudos
Message 3 of 9
(9,655 Views)
For those interested, take a look Device Monitor Demo at:
 
George Zou
Message 4 of 9
(9,587 Views)

Hello,

 

I need to detect the USB stick insertion in cRIO RT 9014? List Directoy/Folder does not list the driver names in cRIO. It lists the ni-rt folder only. How do I detect the USB stick insertion and copy a file to the USB memory from cRIO RT.

 

Thanks in advance.

 

A Senthilnathan

Message 5 of 9
(9,012 Views)

Hi A. Senthilnathan,

 

The USB stick insterted in your cRIO RT 9014 will show up as the u:/ drive. To access it, you can ftp into the cRIO by going to ftp://xxx.xxx.xxx.xxx/u😕 .

 

Thank you for choosing National Instruments.

 

Aaron Peña

National Instruments

Applications Engineer

http://www.ni.com/support

Message 6 of 9
(8,964 Views)

Hi Aaron Peña,

 

Thanks for your help. It works good for me.

 

Thanks

A Senthilnathan 

0 Kudos
Message 7 of 9
(8,945 Views)

@zou wrote:
 
For those interested, take a look Device Monitor Demo at:
 

This is my problem too (Detect USB Flash inserting)

But your program does not work. Does it ? I got an error while opening it by LV2010

0 Kudos
Message 8 of 9
(7,912 Views)

To monitor USB devices I would recommend using this C# Class as recommended above.  Good Luck

Applications Engineer
National Instruments
Message 9 of 9
(7,866 Views)