Monday, April 27, 2015

Troubleshooting USB driver in Windows

Disclaimer: techniques described in this article are not supported by me or Microsoft. They are very likely to break your system and make it unusable, so anything you try is at your own risk and assumes that you are able and willing to fix it yourself. That should be pretty obvious anyway.


I still use Windows 7 and recently it has been a bit like being the last survivor in an abandoned city when most other people have left to OS X or the Ubuntu village. And yes, things break or stop working or simply get stuck. The reason is probably that I overload my system with tons upon tons of programs and libraries (can't even count how many programming environments I have set up) and being in a state of general messiness.

The most recent problem I had was the mouse not working after wakeup. Something inside the system was stuck because some system calls seemed to be taking their time.

First thing I thought of was how to restart the PnP hardware service or subsystem. That turned out not really possible but at least I set the ShellHWDetection service to run in its own process instead of sharing a process with other services. This allows me to restart it in case of problems. To do that, use this command in an elevated prompt:

sc.exe config ShellHWDetection type= own

(keep the space after type=, takes effect upon reboot).

You can see services running in each process using the excellent Process Explorer from www.sysinternals.com

I also noticed that I have VMware USB Arbitration Service running and that's clearly a good target for troubleshooting my mouse problem. Since I use VirtualBox, not VMware on my machine, having this service is a bit redundant (it probably comes with vSphere client that I use to administer our ESXi server). Disabling it alone, however, is not enough.

After searching a bit, I was able to find the list of hidden non-PnP drivers in the Device Manager. To get there, right click on your computer on the desktop and select Manage... Then in the list on the left, select Device Manager and finally enable Show hidden devices in the View menu.

This list by itself is pretty interesting on its own but for my problem, I found that I have VMware hcmon installed. Given that I only use vSphere client and having issues with the mouse, I decided to disable it and see if it helps. I also disabled the VirtualBox USB Monitor Driver. Of course I won't be able to use mouse in my VMs now but if this fixes my problem, it'll be an interesting discovery. Some day I should try to disable one service after another in a VM to see how does it crash the system.

So far it seems it has helped :)
Additionally, there's a command that can list all drivers on your system. You can use it to find drivers not signed by Microsoft which could be a cause of trouble. It's

driverquery.exe /fo csv /v


in combination with sigcheck.exe again from SysInternals as described here http://serverfault.com/questions/130042/is-there-a-command-line-equivalent-of-sigverif-exe


2 comments:

  1. The guys on this forum seem to know their stuff
    http://www.msfn.org/board/topic/140247-trace-windows-7-bootshutdownhibernatestandbyresume-issues/

    ReplyDelete
  2. And this guy, too http://bsodtutorials.blogspot.hk/2013/11/keyed-events.html

    ReplyDelete