NAME
asmc – Apple System Management Controller driver
SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file:
device asmc
DESCRIPTION
The asmc driver controls the Apple System Management Controller (SMC for short) found on Intel Apple systems.
With this driver, you can configure your keyboard backlight brightness, check temperatures of several sensors, check the speed of the internal fans and check the status of the Sudden Motion Sensor.
Variables related to the SMC control and inspection are exported via sysctl(3) under the device tree dev.asmc.
KEYBOARD BACKLIGHT
The keyboard brightness on all laptop models, e.g., MacBook Pro, can be controlled by writing a value to the dev.asmc.%d.light.control sysctl MIB or with backlight(8) utility.
The following sysctl MIBs contains the raw value returned by the left and right light sensors: dev.asmc.%d.light.left or dev.asmc.%d.light.right.
TEMPERATURES
The number of temperature sensors and their description varies among systems. You can inspect the temperature sensors on your system by traversing the dev.asmc.temp sysctl MIB.
All values are in degrees celsius.
SYSTEM FANS
The dev.asmc.fan.%d sysctl tree contains the leaf nodes speed, safespeed, minspeed, maxspeed and targetspeed. Each of these leaf nodes represent the current fan speed, the safest minimum fan speed, the minimum speed and the maximum speed respectively.
All values are in RPM.
POWER MANAGEMENT
The dev.asmc.%d.auto_poweron sysctl controls whether the machine automatically powers on when AC power is restored after an unclean power loss (SMC key “AUPO”). A value of 1 enables automatic power-on; 0 disables it.
RAW SMC KEY ACCESS
When the kernel is compiled with the ASMC_DEBUG option, a set of sysctl nodes is provided under dev.asmc.%d.raw for reading and writing arbitrary SMC keys by name.
- dev.asmc.%d.raw.key
-
Set the 4-character SMC key name to access (e.g., “AUPO”). Setting this automatically queries the key's length and type.
- dev.asmc.%d.raw.value
-
Read or write the key's value as a hex string.
- dev.asmc.%d.raw.len
-
The auto-detected value length in bytes (read-only).
- dev.asmc.%d.raw.type
-
The 4-character SMC type string (e.g., “ui8”, “flt”) (read-only).
Example usage:
sysctl dev.asmc.0.raw.key=AUPO sysctl dev.asmc.0.raw.value sysctl dev.asmc.0.raw.value=01
SUDDEN MOTION SENSOR
The Sudden Motion Sensor (SMS for short) is a device that detects laptop movement and notifies the operating system via an interrupt. The sysctl MIBs present under dev.asmc.sms all relate to the SMS.
The most interesting usage of this device is to park the disk heads when the laptop is moved harshly. Configure devd(8) the following way to automatically park your hard drives using camcontrol(8):
notify 0 {
match "system" "ACPI";
match "subsystem" "asmc";
action "/sbin/camcontrol idle X";
};
Do not forget to change X in the command example to match the target hard drive, e.g., ada0.
Also, please note that parking the disk heads too many times can dramatically reduce your hard drive's life span. Do not rely solely on the SMS to protect your hard drive: good care and common sense can increase your hard drive's life.
HARDWARE
The asmc driver supports the Apple SMC on the following systems:
-
iMac
-
MacBook
-
MacBook Air
-
MacBook Pro
-
Mac Mini
-
Mac Pro
FILES
- /dev/backlight/asmc0
-
Keyboard backlight(8) device node.
SEE ALSO
apple_bce(4), backlight(8), camcontrol(8), devd(8), sysctl(8)
HISTORY
The asmc driver first appeared in FreeBSD 8.0. The driver was heavily modified in FreeBSD 15.1 to support additional Apple SMC functionality and platforms.
AUTHORS
Rui Paulo ⟨[email protected]⟩ wrote asmc as a 2007 Google Summer of Code project.
BUGS
This driver also supports ARM64 Mac models (in theory), but this has not been tested yet.