ChrisL Posted December 11, 2006 Share Posted December 11, 2006 What I want to do is to restart a stopped USB device.The thing is that a USB card reader occasionally drops out and the drive letters dissapear.What I would like to do is to be able to restart the device, or force windows to rescan the hardware.If I stop the device manually I have this status in device manager....Windows cannot use this hardware device because it has been prepared for "safe removal", but it has not been removed from the computer.Telling device manager to rescan for devices doesn't work.Do any of you clever people know of a call that can be made to force windows to restart the device?Thanks [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Bert Posted December 11, 2006 Share Posted December 11, 2006 Larry, GOOD FIND! That will come in handy! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
ChrisL Posted December 11, 2006 Author Share Posted December 11, 2006 devconhttp://support.microsoft.com/?kbid=311272also, I am researching another possibility...Lar.Thanks Larry... can't wait for your other possibility [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
ChrisL Posted December 11, 2006 Author Share Posted December 11, 2006 I gave up on setupapi.dll + GUID + PVOID hell... This can be done without devcon.exe if you are brave enough to learn setupapi.dll. Lar. Well thanks for looking.. This is what I have so far using Devcon which seems to work OK Fileinstall ("Devcon.exe", @tempdir & "\Devcon.exe",1) $iniFile = "DriveMonitor.ini" $DriveList= IniReadSection($iniFile,"MonitorDrives") While 1 If NOT DrivesAreOK() then RunWait (@tempdir & "\Devcon restart USB\ROOT*", @tempdir, @sw_hide) EndIf Sleep (1000 * 60);checks once a minute WEnd Func DrivesAreOK() Local $dOK = 1 For $i = 1 to Ubound ($DriveList) -1 If DriveStatus($DriveList[$i][1] & ":") = "INVALID" then $dOK = 0 Next Return $dOK EndFunc The ini file looks like this [MonitorDrives] 1=F 2=G 3=H 4=I 5=J 6=K [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now