04-07-2016 08:32 AM
The problem I'm facing is as follows: I have a device connected to a USB port of a laptop and control this device with Labview. The device shuts itself off when it encounters errors that are prescribed by the device manufacturors; in this case, it is a water bob, that when it sinks (thereby physically sensing a change in water level in a water bath) the device registers an error and shuts itself off and cuts the connection to the PC. In order to fix the problem, the user puts more water into the water bath, thereby raising the bob once more, and resets the device. By resetting the device though, the connection to the PC remains off, and so it's necessary to also unplug and replug the USB cable to the PC. This wouldn't be a big problem, except that control of this device is a larger part of a Labview program, and thus all of the error handling, etc. should be within the program. Yes, the user does have to reset the device and pour water, and so it shouldn't be such a big deal to just unplug and replug a cable in. However, as the software continues to run despite hardware problems, I would like the program to simply continue once the water problem has been solved.
Thus my question: Is there a way to rest the USB port just using Labview? I've read about DevCon.exe. from Microsoft, but this would mean that all future users of this software would also have to have DevCon.exe. installed on their PCs. Is there a different, rawer method of doing this, or do I simply tell the user to pull and replug the USB cable?
As this question has little to do with the Labview program I've written, and more to do with a method that I will insert into the program, I have attached nothing.
04-08-2016 04:41 AM
Dear cwatanabe92,
here you can find a description how to force Windows to rescan the USB-Ports.
How Do I Force Windows to Remove and Redetect a USB Device?
Kind Regards,
SG3 | Staff Applications Engineering | National Instruments | NIG |
04-08-2016 04:59 AM
@SG3 wrote:Dear @cwatanabe92,
here you can find a description how to force Windows to rescan the USB-Ports.
How Do I Force Windows to Remove and Redetect a USB Device?
The OP specifically asked about options not involving DevCon. Unfortunately, no, not that I know of (short of physically disconnecting the cable) - but the DevCon utility doesn't need to be installed so you can distribute it with your application. We did this with an application recently and it worked pretty well.
04-12-2016 03:22 AM
Oh, I wasn't aware that the executable doesn't need to be installed on the local machine...any tips on first steps toward distributing it with the program? Sounds like a clever way around necessitating the installation of the executable.
04-12-2016 03:32 AM