How to reset USB device every boot (Windows)
Mia Lopez
My mouse (Saitek R.A.T.7) is not working well when i tun on my PC, X axis is not working as intended. I have to plug it out and then in to computer to make it work well. Is there some way to make mouse reset or something like that everytime my ststem starts? (I have already tried all conventional stuff like drivers to make mouse work).
2 Answers
Getting devcon
You can use the devcon utility to remove a USB device and perform a hardware scan to redetect the device. If you are on a 64-bit version of Windows, the IA-64 exe will not work since IA-64 is a different architecture than x64. In this case, you can extract the correct exe file from the Windows Driver Kit ISO, as described here or download the exe from here, as provided by one of the people commenting on that blog post.
Note: You really do need to get the correct 64-bit version of the exe if your OS is 64-bit. You can use the i386 version to list devices, but the remove command will fail!
Resetting the device using devcon
When you have the correct exe for your system (32-bit or 64-bit) you need to figure out the device ID for your mouse. These commands need to be run from an elevated command prompt.
Hint: you can start an elevated command prompt by finding the command prompt in the start menu, right clicking the menu item and selecting run as administrator. In Windows 8, from the desktop view, you can press win+x and select command prompt (admin) in the menu that pops up.
Begin by asking devcon to list the status for all USB devices. Example:
C:\Users\test\devcon\amd64>devcon status USB*
USB\ROOT_HUB\4&1C613B58&0 Name: USB Root Hub Driver is running.
USB\ROOT_HUB\4&1FB366D1&0 Name: USB Root Hub Driver is running.
USB\ROOT_HUB\4&3156ABA9&0 Name: USB Root Hub Driver is running.
USB\ROOT_HUB\4&6F1F2E5&0 Name: USB Root Hub Driver is running.
USB\ROOT_HUB20\4&E98E22D&0 Name: USB Root Hub Driver is running.
USB\VID_03F0&PID_171D\5&D4290CB&2&1 Name: HP Integrated Bluetooth module Driver is running.
6 matching device(s) found.In this example I will cycle the Bluetooth module. First disconnect the device using the remove parameter of the devcon command. Specify the device path by prefixing it with @. Note that the & character, which appears in the device name, is used as a control character to the command prompt just like in UNIX, so you need to put the device name in quote marks to successfully pass it to the devcon command.
Hint: you can copy and paste text from the command prompt window by clicking it's task icon in the top left corner of the window and use the edit menu. After you've selected text, ress enter to perform the copy operation.
C:\Users\test\devcon\amd64>devcon remove "@USB\VID_03F0&PID_171D\5&D4290CB&2&1"
USB\VID_03F0&PID_171D\5&D4290CB&2&1 : Removed
1 device(s) were removed.Now give devcon the rescan command to find the device again.
C:\Users\test\devcon\amd64>devcon rescan
Scanning for new hardware.
Scanning completed.At this point, you might want to try running these command while the mouse is in a faulty state. It may be that the mouse requires a physical power cycle to start working properly, and that this method doesn't actually fix the problem.
Running the commands at startup with elevated privileges
You can now use the Windows task scheduler to run the command on startup. Create a .cmd file containing the following lines. Replace the file path with the full path to the place where you store devcon.exe. Replace the device path with the correct device path for your mouse. Remember the quotes, and the @. Make sure the file has a .cmd extension and not a .cmd.txt extension.
C:\Users\test\devcon\amd64\devcon remove "@USB\VID_03F0&PID_171D\5&D4290CB&2&1"
C:\Users\test\devcon\amd64\devcon rescanStart the task scheduler (start menu, all programs, accessories, system tools, task scheduler). In the right panel, select "create task". Enter a name for the task. Select "run whether user is logged in or not" and "run with highest privileges." In the triggers tab, create a trigger for "on startup". In the actions tab, create a new action and find your .cmd file. Click OK and OK, and reboot. Now, the problem should hopefully be solved.
This guide me to solve my problem, but a little suggestion, use 64bit (amd64 folder) version of devcon if the windows is 64 bit, else it will show "remove failed"