Friday 20 November 2009

Ensuring mice don't disturb a sleeping Windows 7 machine

Having recently made the leap to running Windows 7 on my main laptop, things have, in general, been pretty good. There have been a couple of niggles (eg. Explorer crashing and restarting (something that it now does very well), most commonly caused by IZArc's shell integration) but all-in-all I'm happy to have a cleaner and quicker machine for everyday use.

I was particularly looking forward to benefiting from the updated power management and sleep/hibernate functions that at last seem to be reliable on a Windows machine. I had persisted with "sleeping" my XP build but it was always a game of chance as to whether the thing would wake up successfully - I always had to make sure I closed down anything valuable before beginning the hypnosis. Windows 7 rapidly loses conciousness when commanded to do so and has yet to fail to return (touch wood!).

One element of behaviour, however, did seem strange. Sometimes when I suspended my machine it would immediately wake up and I would have to suspend it a second time. After a few iterations I realised it was the act of unplugging a borrowed USB mouse after the suspend process had completed that was causing the problem.

Whilst I'm happy to have the option, I think it's highly unlikely that many people will want to have an accidental mouse click or a device removal wake their system. Perhaps it would be better if this option was switched off by default? No matter.

A little Googling pointed me to "powercfg -devicequery wake_armed" and this revealed that a "HID-complaint mouse" was indeed capable of waking the system. Issuing "powercfg -devicedisablewake "HID-compliant mouse"" removed this device from the list and now all is good. (This command has the same effect as unticking the "Allow this device to wake the computer" on the "Power Management" tab of the device's properties in Device Manager.)

If this turns out to be my biggest difficulty with my new OS then, of course, I'll be a very happy bunny!

No comments :