1.\"- 2.\" Copyright (c) 2007, 2008, 2009 Rui Paulo <rpaulo@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 18.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 23.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24.\" POSSIBILITY OF SUCH DAMAGE. 25.\" 26.\" $FreeBSD$ 27.\" 28.Dd April 2, 2019 29.Dt ASMC 4 30.Os 31.Sh NAME 32.Nm asmc 33.Nd device driver for the Apple System Management Controller (SMC) 34.Sh SYNOPSIS 35To compile this driver into the kernel, place the following line in your 36kernel configuration file: 37.Bd -ragged -offset indent 38.Cd "device asmc" 39.Ed 40.Pp 41Alternatively, to load the driver as a 42module at boot time, place the following line in 43.Xr loader.conf 5 : 44.Bd -literal -offset indent 45asmc_load="YES" 46.Ed 47.Sh DESCRIPTION 48The 49.Nm 50driver controls the Apple System Management Controller (SMC for short) 51found on Intel Apple systems. 52.Pp 53The SMC is known to be found on the following systems: 54.Pp 55.Bl -bullet -offset indent -compact 56.It 57MacBook 58.It 59MacBook Pro 60.It 61Intel MacMini 62.It 63Mac Pro 64.It 65MacBook Air 66.It 67Intel iMac 68.El 69.Pp 70With this driver, you can configure your keyboard backlight 71brightness, check temperatures of several sensors, check the speed of 72the internal fans and check the status of the Sudden Motion Sensor. 73.Pp 74Variables related to the SMC control and inspection are exported via 75.Xr sysctl 3 76under the device tree 77.Va dev.asmc . 78.Sh KEYBOARD BACKLIGHT 79On 80.Tn MacBook Pro 81systems, you can control the keyboard brightness by writing a value to 82the 83.Va dev.asmc.%d.light.control 84sysctl MIB. 85.Pp 86The following sysctl MIBs contains the raw value returned by the left 87and right light sensors: 88.Va dev.asmc.%d.light.left 89or 90.Va dev.asmc.%d.light.right . 91.Sh TEMPERATURES 92The number of temperature sensors and their description varies among 93systems. 94You can inspect the temperature sensors on your system by traversing 95the 96.Va dev.asmc.temp 97sysctl MIB. 98.Pp 99All values are in degrees celsius. 100.Sh SYSTEM FANS 101The 102.Va dev.asmc.fan.%d 103sysctl tree contains the leaf nodes 104.Va speed , 105.Va safespeed , 106.Va minspeed , 107.Va maxspeed 108and 109.Va targetspeed . 110Each of these leaf nodes represent the current fan speed, the safest 111minimum fan speed, the minimum speed and the maximum speed 112respectively. 113.Pp 114All values are in RPM. 115.Sh SUDDEN MOTION SENSOR 116The Sudden Motion Sensor (SMS for short) is a device that detects 117laptop movement and notifies the operating system via an interrupt. 118The sysctl MIBs present under 119.Va dev.asmc.sms 120all relate to the SMS. 121.Pp 122The most interesting usage of this device is to park the disk heads 123when the laptop is moved harshly. 124First, you need to install 125.Xr ataidle 8 Pq Pa ports/sysutils/ataidle 126and then configure 127.Xr devd 8 128the following way: 129.Bd -literal -offset indent 130notify 0 { 131 match "system" "ACPI"; 132 match "subsystem" "asmc"; 133 action "/usr/local/sbin/ataidle -s X Y"; 134}; 135.Ed 136.Pp 137Do not forget to change the 138.Ar X 139and 140.Ar Y 141values in the command above. 142.Pp 143Also, please note that parking the disk heads too many times can 144dramatically reduce your hard drive's life span. 145Do not rely solely on 146the SMS to protect your hard drive: good care and common sense can 147increase your hard drive's life. 148.Sh SEE ALSO 149.Xr ataidle 8 Pq Pa ports/sysutils/ataidle , 150.Xr devd 8 , 151.Xr sysctl 8 152.Sh HISTORY 153The 154.Nm 155driver first appeared in 156.Fx 8.0 . 157.Sh AUTHORS 158.An Rui Paulo Aq Mt rpaulo@FreeBSD.org 159(Google Summer of Code project) 160.Sh BUGS 161Support for the latest models was never tested and is most likely not 162fully working. 163