LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Devcon working with CVI

Hi

 

Everyone

 

I am using devcon the utlility of microsoft for restart my connection USB of a dispositive (scanner) but I have a big problem, when I run the application devcon with a bat file I have not problem, I can see in the device manager of my computer  how the application restart the connection USB  with the dispositive but the problem begin when I want  to call the file bat with a application development in CVI 7.1. When I execute the application of cvi  devcon  not work, I don't see any change in the device manager.

I am using the function Launchexecutable of CVI for to call the file .bat that has  been configurated for run the devcon utility.

 

somebody can help me with this problem.

 

I will appreciated your help

 

 

Thanks.

 

Mario Ku. 

 

  

0 Kudos
Message 1 of 6
(4,453 Views)

Hi Mario,

 

It can even be a simple file path typo or missing double backslashes in path string ("c:\\...\\...\\devcon.bat").

 

Did you check the return value of LaunchExecutable function?

It returns 0 for success and negative values for errors.

 

There 22 different error conditions documented. It may help.

Message Edited by ebalci on 24-12-2009 07:58 AM
S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 6
(4,448 Views)

How are you using LaunchExecutable to run your batch file? Depending on the commands included in it you may need to prepend to the command string "cmd /c": some informations can be found here and here.

 

Are you sure the batch file is called? You could edit it to add some echo command redirected to an output file to help you in understanding which part of the batch is executed and which is not.

Additionally, devcon itself returns an errorlevel which may be trapped inside the batch file to give you informations on whether it was successful or not.

Message Edited by Roberto Bozzolo on 12-24-2009 10:00 AM


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(4,437 Views)

Hi

 

To all

 

Thanks for your fast responces.

 

Ebalci

 

 I have checked the path in where I am call to file.bat and this has double \\  this is correct  I am call to aplication  of this form

 

char c_pathExecutable[50]={"c:\\Utility_Devcon\\i386\\restartUSB_sierra.bat"}; 

 

i_status = LaunchExecutableEx(c_pathExecutable, LE_SHOWNORMAL,&LaunchExecutable);

 

inside of the file .bat I have configurated the call  to utiility devcon.exe for restart the dispositive USB. 

 

also I have verify the response of the function LaunchExecutable of CVI and this return me 0 of success but I have the same problem, I dont see that the restart of the dispositive in the device manager.

 

Robert

 

I believe that the file .bat is not execute of correct form because in the call to the aplication Devcon.exe  I have configurated other file for get the responce of if the devcon was succesful.

I have configurated the file .bat of this form.

 

devcon restart USB\VID_05* >> devcon_restart.txt.

 

in devcon_restart.txt  I can see if devcon is working well. 

 

if I run the aplication .bat alone devcon work well devcon denerate  the file  devcon_restart.txt and in this file   I get the message "USB\VID_05E0&PID_1200\S/N:2E07A5FF59B29F49AA36559EBACC66E3_REV:PAAABC06-001-R00-: Restarted
1 device(s) restarted.

 

but when I run the file .bat with the aplication cvi devcon does not generate the file devcon_restart.txt .

 

 

Do you have some other idea for fixed the problem?? 
 

 

 

 

 

 

 

 

0 Kudos
Message 4 of 6
(4,428 Views)

Is it possible to try that on our machines if send us the files?

 

Does it require any special hardware?

Even so, we may see the txt file being created with an error message in it.

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 6
(4,414 Views)

Thanks so muchfor your help.

 

 The aplication is running now the problem was with the file .bat, I needed to add the path of the devcon.exe in the  configuration of the file .bat  see below.

 

cd C:\Utility_Devcon\i386

devcon restart USB\VID_05* > devcon_restart.txt

 

I needed to add the first line for that the aplication in cvi work well . the problem was that  the aplication run the file .bat but never find the path for can run the devcon.exe

 

with this linea the file .bat run well.

 

Regards.

 

 

0 Kudos
Message 6 of 6
(4,410 Views)