3

I put my PowerMac at work to sleep so that I can use Wake-on-LAN to do remote work on it. However the office cleaner often touches the keyboard or the mouse button unintentionally. So the question is:

How to disable mouse and keyboard wake up; to just use the power button and wake-on-LAN to wake/sleep instead?

Don't tell me to disconnect mouse and keyboard.

  • Is there a reason why you need to use wake on LAN to access it? – jmlumpkin May 6 '11 at 17:07
  • It's an old Powermac (G5) and it's quite loud even at idle. And i don't access it frequently as my Linux box to be always powered on. – Lamnk May 6 '11 at 20:49
  • Ah, makes sense. Though if its at work, is the noise that much of a concern, when you would wake it up anyways with WoL? – jmlumpkin May 6 '11 at 21:20
  • Are you ok with solutions that minimize the awake time or do you truly require that the sleeping Mac truly not respond to existing KB and mouse events? – bmike Apr 22 '12 at 14:40
7

The solution I can offer is to use Sleepwatcher and add the following to your ~/.wakeup script:

#!/bin/bash

WR=`syslog | grep -i "Wake reason =" | tail -1 | awk '{ print $11 }'`

if [[ "$WR" =~ EHC[0-9] ]]; then
    pmset sleepnow
fi

This won't prevent your Mac from waking via keyboard or mouse. It will however sleep the computer immediately after it is woken via keyboard, mouse, or any other USB device.

According to an anonymous user this works for some versions of OS X (e.g. Mavericks):

#!/bin/bash

WR=`syslog | grep -i "Wake reason:" | tail -1 | awk '{ print $11 }'`

if [[ "$WR" =~ EHC[0-9] ]]; then
    pmset sleepnow
fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .