This is an old post from one of my old sites, but since people
still seem to have this issue I decided to re-post it here. Below are
some solutions problems you might experience with USB devices in
Windows XP, especially so when the computers resumes from S1/S3 standby
or hibernation. However, these tricks can be applied to most any USB
device giving you grief and in need of resetting. A reset of a device
is very tricky to automate, so these steps aren’t pretty. At all. Never
the less, if you’re reading this you probably don’t care, right? OK,
so let’s get down to it.
PLEASE READ
In many cases, the problem is exactly what Windows is telling you. If
you get an error about a device exceeding it’s power limits, that might
be precisely what is happening.
Power hungry devices like external hard drives, coffee warmers,
vibrators and alike require more power than what an USB port can
supply. In these cases, none of the below will help. What you need then
is a product like a powered USB Hub to help power the device.
A hub will probably solve the problem for 90% of you. If you know this isn’t the case, read on.
PLEASE READ #2:
Off course I won’t take responsibility for something you mess up. So if
you are thinking of suing me because you wiped out your hard drive
attempting the below, tough luck. Won’t happen.
Step 1: Getting XP to shut up about device problems. In my case, I got this in my face every time resuming the computer from standby:
A USB device has exceeded the power limits of its hub port. For assistance in solving this problem, click this message.
Annoying, since it in my case is total bullshit. To get rid of
messages like this (and we really really want to don’t we?) open the
device manager (start menu -> run -> devmgmt.msc). Now, expand
the USB group at the bottom of the list and double-click any “Universal
Host Controller”. Click the “Advanced”-tab, and check the “Don’t tell
me about USB problems” option at the bottom. Click OK and close the
device manager.
Now,
this might be enough for some of you. If you’re not using the port
windows is nagging about then go to the fridge and grab a beer because
this is all you have to do in order to shut it up. However, the
port/device will still be disabled. If you do need the port/device and
still feel eternally damned, read on.
Step 2: Reset USB device/port. This is the tricky
and really really ugly part, so lock up you children and pet your dog
before proceeding. For this we need a little application called devcon
from MS.
Grab it
and put it in C:\Windows (or any other place, but we’ll use this in
our examples below). Then, open the device manager (start menu ->
run -> devmgmt.msc).
What we need to do now is find out which hub (port) our troubled device
is connected to. To do this, expand the USB group at the bottom of the
list. In sequence, open every “USB Root Hub” and click the “Power”-tab
to see if your device is listed there.
When
you have found the hub that has your device listed, click the
“Details”-tab. Write down the name shown in the list between the first
and second \-sign, for example “ROOT_HUB20″, on a piece of paper.
In
the example above it’s the “USB Mass Storage Device” that keeps
shutting down, and by doing the above we found out it’s connected to
ROOT_HUB20.
Next, start a Command Prompt (start menu -> run -> cmd). Type in
the following, replacing ROOT_HUB20 with what you wrote down on your
paper.
C:\>devcon remove *ROOT_HUB20*
USB\ROOT_HUB20\4&32FF5014&0 : Removed
1 device(s) removed.
C:\>devcon rescan
Scanning for new hardware.
Scanning completed.
Now windows should remove and re-detect the hub and any eventual
devices attached to it, re-enabling them in the process. If not, you
probably got the wrong hub. Redo the above steps until it works.
Great, now we’ve managed to reset the device. Let’s do a batch file
outta this so we don’t have to poke around manually every time we need a
reset. Open notepad (start menu -> run -> notepad) and put in
the following (replace ROOT_HUB20 as above):
@ECHO OFF
C:\WINDOWS\devcon remove *ROOT_HUB20*
C:\WINDOWS\devcon rescan
Go to the “File”-menu, choose “Save”. In the “File name”-field, enter
“C:\WINDOWS\usbreset.bat” (yes, without the “‘s) and click “Save”.
If you’re not experiencing your problems particularly when windows
resumes from standby, this is probably the end of the line. Just put a
shortcut to the batch file on your desktop or do start menu -> run
-> usbreset whenever you want to reset the device. However, if you
are having the problems on resume and still feel somewhat damned, read
on.
Step 3: Automating it. We’re getting closer. Can you feel it? We need some more stuff for this next step, namely a
sleep command and Nate DeSimone’s neat
Hibernate Trigger.
Put sleep.exe in C:\Windows to start with. We now need to edit our
batch-file again as below (start menu -> run -> notepad
C:\WINDOWS\usbreset.bat):
@ECHO OFF
C:\WINDOWS\sleep 5
C:\WINDOWS\devcon remove *ROOT_HUB20*
C:\WINDOWS\sleep 2
C:\WINDOWS\devcon rescan
The sleep’s are there to cut the hardware some slack when waking up
all dazed and confused. I wouldn’t mind something like that myself in
the morning. Anyways, save the batch-file (CTRL-S) and then install
Hibernate Trigger we just downloaded. During install, choose to have it
start with windows.
After completing install, start the program from your start-menu. On
the second line (wakeup command) input “C:\WINDOWS\usbreset.bat” (yes,
without the “‘s). Check the minimize box and then minimize the
application. This should be it! Try sedating the machine, wake it, get
upset when it isn’t working, fiddle around some more and then finally
go get yourself a beer when you got it working.
Visitor contributed thoughts:
MB: Very much the same with not extra sw. make the following file (change Dev ID)
C:\sleep.bat
———————————
RUNDLL32.EXE PowrProf.Dll,SetSuspendState
devcon remove USB\\VID_0424*
devcon rescan
———————————-
Then setup a schudled task when the system has been idle x amount of time (hibernate needs to be switched off).
Edwin: Was only not so charmed about the Hibernate Trigger progam, but used the Vista native Task Scheduler instead:
Create Task -> Triggers -> New -> On an event -> Log: System -> Source: Power-Troubleshooter -> Event ID: 1
Also tick “Run with highest privileges” at the General tab.
And next select your batchfile at the actions tab.
Evaldas Jocys: You don’t need sleep.exe to add delays, use ping command instead.
You can reset multiple devices by calling :ResetUsb function with parameter (%1).
—————————————-
@ECHO OFF
:: What we need to do now is find out which hub (port) our troubled device is connected to.
:: 1. Open the device manager (start menu -> run -> devmgmt.msc).
:: 2. Expand the \”Universal Serial Bus controllers\” at the bottom of the list.
:: 3. In sequence, open every \”USB Root Hub\” and click the [Power] tab to see if your device is listed there.
:: 4. When you have found the hub that has your device listed, click the [Details] tab.
:: 5. Write down the name shown in the list between the first and second \\-sign, for example “ROOT_HUB20″
:: 6. Add CALL :ResetUsb *ROOT_HUB20* here … (you can add as many lines as you want…)
::CALL :ResetUsb *ROOT_HUB20*
CALL :ResetUsb *ROOT_HUB20*
GOTO:EOF
:ResetUsb
:: Delay for 5 seconds.
ping 1.0.0.0 -n 1 -w 5000 > nul
devcon remove %1
:: Delay for 2 seconds.
ping 1.0.0.0 -n 1 -w 2000 > nul
devcon rescan
GOTO:EOF