LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Port Reset without using DevCon.exe

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.

0 Kudos
Message 1 of 5
(5,029 Views)

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 |

0 Kudos
Message 2 of 5
(4,989 Views)

@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.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 5
(4,984 Views)

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.

0 Kudos
Message 4 of 5
(4,928 Views)
Add DevCon.exe as an item in your LabVIEW project and you can set it to 'always include' in your executable build specification and specify it's location in the destinations tab.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 5
(4,922 Views)