02-18-2010 06:36 AM
Hi, I am using a USB6211 with windows XP, LabVIEW 2009. The card in integrated in to a measurement device that the user will plug in when they want to take measurements, and then remove once the measurements have been made. The user will do this a number of times accross the duration of the test.
I have written some code that determines when the device is plugged in or disconnected and this seems to work well, however I have randomly had a full windows crash and I am wondering if this is due to the plugging/unplugging of the device from the USB.
I have had a search and the post below implies thats this is safe to do, however I want to make sure that this isnt going to cause me a problem down the line.
Any ideas?
http://forums.ni.com/ni/board/message?board.id=250&message.id=24254&query.id=1441111#M24254
Solved! Go to Solution.
02-18-2010 06:47 AM
Do you want to unplug/replug the USB or just a card connect/disconnect is enough. If the latter is enough just switch the card power ON/OFF using any card application if you have or with the help of a small hardware. Please post back if you want more details.
Mathan
02-18-2010 06:51 AM
Hi,
Try to use devcon utility.
With this utility I was able to "reconnect" my USB device programmatically without physical disconnection.
Andrey.
02-22-2010 09:28 AM
Hi, thanks for the replies - the devcon utility might be useful for me in the future however I managed to solve my problem as follows.
In my original code (figure 1) i was trying to access the serial number of the device, which if connected return error = FALSE. If an error was detected i would retry after 5 seconds, however if the device was connected/disconnected whilst comunication was in progress windows would crash.
I have now modified the code to check the active device names (figure 2). If my device is not connected then the search function will return index = -1. Because I am no longer checking the device directly it no longer matters if the device becomes connected/disconnected during the check.
Thanks for the help
09-02-2010 04:28 PM
how do you use the devcon utility?
I file that i downloaded from the microsoft website opens up cmd prompt for a second and goes away.
I'm programmatically trying to reset the usb port. (unplug and plug in)
Best Regards,
Ro