Page MenuHomeFreeBSD

asmc: add Wake-on-LAN control via sysctl
AcceptedPublic

Authored by guest-seuros on Wed, Dec 31, 5:47 PM.
Tags
None
Referenced Files
F141802756: D54439.diff
Sat, Jan 10, 3:37 PM
F141802367: D54439.id168816.diff
Sat, Jan 10, 3:31 PM
F141785100: D54439.id.diff
Sat, Jan 10, 9:03 AM
F141772341: D54439.diff
Sat, Jan 10, 4:47 AM
F141762897: D54439.diff
Sat, Jan 10, 1:45 AM
Unknown Object (File)
Fri, Jan 9, 7:07 AM
Unknown Object (File)
Thu, Jan 8, 9:06 AM
Unknown Object (File)
Wed, Jan 7, 9:20 PM
Subscribers
None

Details

Reviewers
adrian
imp
markj
Summary

Apple Mac systems support Wake-on-LAN from powered-off state (S5/G2) via the AUPO SMC key.

This change adds a convenience sysctl:

dev.asmc.0.wol (0=disabled, 1=enabled)

The AUPO key is volatile and resets to 0x00 on every boot, so WoL must be manually enabled before each shutdown to work from powered-off state.
Users need to run:
sysctl dev.asmc.0.wol=1
before shutting down the system.

Test Plan

Tested on Mac Mini 5,1 (FreeBSD 16.0-CURRENT):

  1. Boot system, check default WoL state:
  • sysctl dev.asmc.0.wol
  • Expected: 0 (disabled - AUPO resets on boot)
  1. Enable WoL before shutdown:
  • sudo sysctl dev.asmc.0.wol=1
  • Expected: Returns 1, no errors
  1. Verify AUPO was set:
  • sudo sysctl dev.asmc.0.wol
  • Expected: 1
  1. Shutdown system:
  • sudo shutdown -p now
  1. From another machine, send magic packet:
  • wakeonlan -i 192.168.3.255 <MAC_ADDRESS> <-- use your local ip range
  • Expected: System powers on and boots
  1. After boot, verify WoL state reset:
  • sysctl dev.asmc.0.wol
  • Expected: 0 (AUPO volatile, resets on boot)
  1. Test disable: (it disabled by default)
  • sudo sysctl dev.asmc.0.wol=1
  • sudo sysctl dev.asmc.0.wol=0
  • sudo shutdown -p now
  • Send magic packet

Note: My thunderbird ethernet cable is broken, so i could not test it in the laptops.

The user need to build rc.d integration or shutdown hook to keep the value set to 1

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

guest-seuros created this revision.
guest-seuros edited the test plan for this revision. (Show Details)

i got the patch from the wrong branch, the first time.

sys/dev/asmc/asmc.c
1681

Missing a newline between this and the previous function.

1698

Is there any reason not to make this sysctl handle a plain int? I don't see one, and it's more natural to do that for plain on/off switches.

This revision is now accepted and ready to land.Fri, Jan 9, 2:16 PM

What email address would you like to use in the commit author field? I see your phabricator account name was changed, and the email isn't available anymore.

oss@seuros.com (like the previous commits)