LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

determining if a drive exists

We have a SCSI drive (connected to our PC through a USB port).  Through the process of our fault insertion test, we need to disconnect a loopback cable that completes the loop from the PC to the SCSI.  Anyway, my test tries to test the SCSI by doing a file open/write/close/open/read/close.  If we disconnect the loopback cable, we are able to still write to the SCSI once (we think it's doing some type of cache write), but then a second attempt hangs the test because it can't see the drive any longer.  Is there a way from labview to query the OS to determine what (valid) drives it thinks it sees?  I've used the File/Directory Info VI, and the path to the disconnected drive returns True out of the 'directory' (boolean) output.  Any ideas?
0 Kudos
Message 1 of 2
(2,523 Views)

"mrbean" <x@no.email> wrote in message news:1173901207646-491842@exchange.ni.com...
We have a SCSI drive (connected to our PC through a USB port).&nbsp;&nbsp;Through the process of our fault insertion test, we need to disconnect&nbsp;a loopback cable that completes the loop from the PC to the SCSI.&nbsp; Anyway, my test tries to&nbsp;test the SCSI by doing a file open/write/close/open/read/close.&nbsp; If we disconnect the loopback cable, we are able to still write to the SCSI once (we think it's doing some type of cache write), but then a second attempt hangs the test because it can't see the drive any longer.&nbsp; Is there a way from labview to query the OS to determine what (valid) drives it thinks it sees?&nbsp; I've used the File/Directory Info VI, and the path to the disconnected drive returns True out of the 'directory' (boolean) output.&nbsp; Any ideas?


You can use the API "DWORD GetLogicalDrives(VOID)" for this. It returns a bitmask of the currently available disk drives (1=A, 2=B, 4=C, 8=D). It's in kernel32.dll.


Put a new Call Library Function node on the diagram, dubble click it, browse to kernel32.dll. Select GetLogicalDrives from the function, and put the return type to numeric. You can put the Calling Conventions to stdcall, but there are no input parameters, so it doesn't matter.


Regards,


Wiebe.
0 Kudos
Message 2 of 2
(2,508 Views)