Record of some of the computer tech I deal with so that it's documented at least somewhere.

Wednesday 19 May 2010

Mac-Mini ACPI wake-on-lan

tl;dr : use ACPI, if you want wake-on-lan you can only suspend to ram

# uname -a
Linux mini1 2.6.32-gentoo-r7 #13 SMP Wed May 19 18:11:25 BST 2010 i686 Genuine Intel(R) CPU 1300 @ 1.66GHz GenuineIntel GNU/Linux

.config make.conf

APM

It won't have it :
CONFIG_APM=y
and yet
mini# apmd
No APM support in kernel

ACPI

mini# acpitool -e
... snip ...
Device S-state Status Sysfs node
---------------------------------------
1. PXS1 S4 disabled pci:0000:01:00.0
2. PXS2 S4 disabled pci:0000:02:00.0

mini# ethtool eth0
Settings for eth0:
... snip ...
Supports Wake-on: pg
Wake-on: d

So by default wake-on-lan is disabled (quite right too), thus :
(and *sigh* I have to show you the GPL! - is it really fucking worth it, the notice is longer than the code they gave me) :

mini# cat /etc/init.d/wol
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
need net
}

start() {
acpitool -w | grep -q enabled || acpitool -W 2
# -W 2 stupidly toggles enabled/disabled
ethtool -s eth0 wol g
}

restart() {
start
}


so now acpitool -[Ss] both work, I made a swap for storing disk based and it restores just fine, except mplayer waits until a media change before resuming to play on screen (the sound might work, I have it on mute). That's not good enough for this application, it might be an hour. I read some stuff on't'net earlier about dumping video registers and the like and ended up using sys-power/hibernate-script. It didn't do any better so I went for a quick and dirty : kill `{pgrep mplayer}

Or rather I installed daemontools and made mplayer a service (I use SLiM to auto-login to X but I realise now I could have done it with daemontools (I didn't have it installed at the time). Oh well, I learned about xdm.

Hibernate lets you run scripts on resume so I just have it kill mplayer and unclutter (which removes the cursor).

When the Mac-mini is in suspend-to-disk I can't get it to hear Wake-On-Lan magic packets, I have to use the power button to get it to resume. It works just fine with suspend-to-ram (the power led slowly pulses so you know it's on).

TuxOnIce looks like it might help but I can't be arsed with it no more.

No comments: