Page MenuHomeFreeBSD

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

Authored by seuros on Dec 31 2025, 5:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 21, 3:26 AM
Unknown Object (File)
Sun, Sep 20, 7:22 PM
Unknown Object (File)
Sun, Sep 20, 7:30 AM
Unknown Object (File)
Thu, Sep 10, 3:40 AM
Unknown Object (File)
Mon, Sep 7, 12:09 AM
Unknown Object (File)
Mon, Sep 7, 12:09 AM
Unknown Object (File)
Mon, Sep 7, 12:08 AM
Unknown Object (File)
Sun, Sep 6, 8:41 AM
Subscribers

Details

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 Thunderbolt 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

seuros created this revision.
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.Jan 9 2026, 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)

This version of the patch doesn't apply. Something stripped all of the tabs in the file.

How did you upload the diff?

Updated the diff .

I pasted the diff in the webview.

This revision now requires review to proceed.Jan 12 2026, 10:17 PM
In D54439#1249171, @guest-seuros wrote:

Updated the diff .

I pasted the diff in the webview.

This strips tabs, so I still can't apply the patch to the tree. Please use arc or git arc to upload patches: https://wiki.freebsd.org/Phabricator

seuros edited the summary of this revision. (Show Details)

Only add dev.asmc.*.wol when AUPO exists; add key constant

ngie added inline comments.
sys/dev/asmc/asmc.c
1730

style(9) nit.

1740
1740

I meant to also say, style(9) nit.

Address style(9) nits: remove space in cast, use explicit != 0 comparison

This revision is now accepted and ready to land.Feb 24 2026, 3:17 PM
This revision was automatically updated to reflect the committed changes.