man.bsd.lv manual page server

Manual Page Search Parameters

ACPI_THINKPAD(4) Device Drivers Manual ACPI_THINKPAD(4)

acpi_thinkpadACPI extras driver for IBM/Lenovo Thinkpad laptops

To compile this driver into the kernel, place the following line in your kernel configuration file:

device acpi_thinkpad

Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):

acpi_thinkpad_load="YES"

The acpi_thinkpad driver provides support for hotkeys and other components of IBM/Lenovo Thinkpad laptops. The main purpose of this driver is to provide an interface, accessible via sysctl(8) and devd(8), through which applications can determine the status of various laptop components.

While the sysctl(8) interface is enabled automatically after loading the driver, the devd(8) interface has to be enabled explicitly, as it may alter the default action of certain keys. This is done by setting the events sysctl as described below. Specifying which keys should generate events is done by setting a bitmask, whereas each bit represents one key or key combination. This bitmask, accessible via the eventmask sysctl, is set to availmask by default, a value representing all possible keypress events on the specific ThinkPad model.

devd(8) Ss Events

Hotkey events received by devd(8) provide the following information:

system
"ACPI"
subsystem
"THINKPAD"
type
The source of the event in the ACPI namespace. The value depends on the model.
notify
Event code (see below).

Depending on the ThinkPad model, event codes may vary. On a ThinkPad T41p these are as follows:

Fn + F1
Fn + F2
Fn + F3 (LCD backlight)
Fn + F4 (Suspend to RAM)
Fn + F5 (Bluetooth)
Fn + F6
Fn + F7 (Screen expand)
Fn + F8
Fn + F9
Fn + F10
Fn + F11
Fn + F12 (Suspend to disk)
Fn + Backspace
Fn + Insert
Fn + Delete
Fn + Home (Brightness up)
Fn + End (Brightness down)
Fn + PageUp (ThinkLight)
Fn + PageDown
Fn + Space (Zoom)
Volume Up
Volume Down
Mute
Access IBM Button

led(4) Ss Interface

The acpi_thinkpad driver provides a led(4) interface for the ThinkLight. The ThinkLight can be made to blink by writing ASCII strings to the /dev/led/thinklight device.

The following sysctls are currently implemented:

hw.acpi.thinkpad.initialmask
(read-only) Bitmask of ACPI events before the acpi_thinkpad driver was loaded.
hw.acpi.thinkpad.availmask
(read-only) Bitmask of all supported ACPI events.
hw.acpi.thinkpad.events
Enable ACPI events and set the eventmask to availmask. Without the acpi_thinkpad driver being loaded, only the Fn+F4 button generates an ACPI event.
hw.acpi.thinkpad.eventmask
Sets the ACPI events which are reported to devd(8). Fn+F3, Fn+F4 and Fn+F12 always generate ACPI events, regardless which value eventmask has. Depending on the ThinkPad model, the meaning of different bits in the eventmask may vary. On a ThinkPad T41p this is a bitwise OR of the following:

Fn + F1
Fn + F2
Fn + F3 (LCD backlight)
Fn + F4 (Suspend to RAM)
Fn + F5 (Bluetooth)
Fn + F6
Fn + F7 (Screen expand)
Fn + F8
Fn + F9
Fn + F10
Fn + F11
Fn + F12 (Suspend to disk)
Fn + Backspace
Fn + Insert
Fn + Delete
Fn + Home (Brightness up)
Fn + End (Brightness down)
Fn + PageUp (ThinkLight)
Fn + PageDown
Fn + Space (Zoom)
Volume Up
Volume Down
Mute
Access IBM Button
hw.acpi.thinkpad.hotkey
(read-only) Status of several buttons. Every time a button is pressed, the respecting bit is toggled. It is a bitwise OR of the following:

Home Button
Search Button
Mail Button
Access IBM Button
Zoom
Wireless LAN Button
Video Button
Hibernate Button
ThinkLight Button
Screen Expand
Brightness Up/Down Button
Volume Up/Down/Mute Button
hw.acpi.thinkpad.lcd_brightness
Current brightness level of the display.
hw.acpi.thinkpad.volume
Speaker volume.
hw.acpi.thinkpad.mute
Indicates, whether the speakers are muted or not.
hw.acpi.thinkpad.thinklight
Indicates, whether the ThinkLight keyboard light is activated or not.
hw.acpi.thinkpad.bluetooth
Toggle Bluetooth chip activity.
hw.acpi.thinkpad.wlan
(read-only) Indicates whether the WLAN chip is active or not.
hw.acpi.thinkpad.fan
Indicates whether the fan is in automatic (1) or manual (0) mode. Default is automatic mode. This sysctl should be used with extreme precaution, since disabling automatic fan control might overheat the ThinkPad and lead to permanent damage if the fan_level is not set accordingly.
hw.acpi.thinkpad.fan_level
Indicates at what speed the fan should run when being in manual mode. Values are ranging from 0 (off) to 7 (max). The resulting speed differs from model to model. On a T41p this is as follows:

off
~3000 RPM
~3600 RPM
~4300 RPM
hw.acpi.thinkpad.fan_speed
(read-only) Fan speed in rounds per minute. A few older ThinkPads report the fan speed in levels ranging from 0 (off) to 7 (max).
hw.acpi.thinkpad.thermal
(read-only) Shows the readings of up to eight different temperature sensors. Most ThinkPads include six or more temperature sensors but only expose the CPU temperature through acpi_thermal(4). Some ThinkPads have the below sensor layout which might vary depending on the specific model:

  1. CPU
  2. Mini PCI Module
  3. HDD
  4. GPU
  5. Built-in battery
  6. UltraBay battery
  7. Built-in battery
  8. UltraBay battery
hw.acpi.thinkpad.handlerevents
devd(8) events handled by acpi_thinkpad when events is set to 1. Events are specified as a whitespace-separated list of event code in hexadecimal or decimal form. Note that the event may be handled twice (eg. Brightness up/down) if ACPI BIOS already handled the event.
hw.sensors.acpi_thinkpad0.tempX
Show the readings of up to eight different temperature sensors.
hw.sensors.acpi_thinkpad0.fan0
Fan speed in rounds per minute.

Defaults for these sysctls can be set in sysctl.conf(5). Sensors can be monitored by sensorsd(8).

/dev/led/thinklight
ThinkLight led(4) device node

The following can be added to devd.conf(5) in order to pass button events to a /usr/local/sbin/acpi_oem_exec.sh script:

notify 10 {
        match "system"          "ACPI";
        match "subsystem"       "IBM";
        action "/usr/local/sbin/acpi_oem_exec.sh $notify ibm";
};

A possible /usr/local/sbin/acpi_oem_exec.sh script might look like:

#!/bin/sh
#
if [ "$1" = "" -o "$2" = "" ]
then
        echo "usage: $0 notify oem_name"
        exit 1
fi
NOTIFY=`echo $1`
LOGGER="logger"
CALC="bc"
BC_PRECOMMANDS="scale=2"
ECHO="echo"
CUT="cut"
MAX_LCD_BRIGHTNESS=7
MAX_VOLUME=14
OEM=$2
DISPLAY_PIPE=/tmp/acpi_${OEM}_display

case ${NOTIFY} in
        0x05)
                LEVEL=`sysctl -n hw.acpi.${OEM}.bluetooth`
                if [ "$LEVEL" = "1" ]
                then
                        sysctl hw.acpi.${OEM}.bluetooth=0
                        MESSAGE="bluetooth disabled"
                else
                        sysctl hw.acpi.${OEM}.bluetooth=1
                        MESSAGE="bluetooth enabled"
                fi
                ;;
        0x10|0x11)
                LEVEL=`sysctl -n hw.acpi.${OEM}.lcd_brightness`
                PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \
                         ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\
                         ${CALC} | ${CUT} -d . -f 1`
                MESSAGE="brightness level ${PERCENT}%"
                ;;
        0x12)
                LEVEL=`sysctl -n hw.acpi.${OEM}.thinklight`
                if [ "$LEVEL" = "1" ]
                then
                        MESSAGE="thinklight enabled"
                else
                        MESSAGE="thinklight disabled"
                fi
                ;;
        0x15|0x16)
                LEVEL=`sysctl -n hw.acpi.${OEM}.volume`
                PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \
                        ${LEVEL} / ${MAX_VOLUME} * 100" | \
                         ${CALC} | ${CUT} -d . -f 1`
                MESSAGE="volume level ${PERCENT}%"
                ;;
        0x17)
                LEVEL=`sysctl -n hw.acpi.${OEM}.mute`
                if [ "$LEVEL" = "1" ]
                then
                        MESSAGE="volume muted"
                else
                        MESSAGE="volume unmuted"
                fi
                ;;
        *)
                ;;
esac
${LOGGER} ${MESSAGE}
if [ -p ${DISPLAY_PIPE} ]
then
        ${ECHO} ${MESSAGE} >> ${DISPLAY_PIPE} &
fi
exit 0

The following example specify that event code 0x04 (Suspend to RAM), 0x10 (Brightness up) and 0x11 (Brightness down) are handled by acpi_thinkpad.

sysctl hw.acpi.thinkpad.handlerevents='0x04 0x10 0x11'

in sysctl.conf(5):

hw.acpi.thinkpad.handlerevents=0x04\ 0x10\ 0x11

acpi(4), led(4), sysctl.conf(5), devd(8), sensorsd(8), sysctl(8)

The acpi_thinkpad device driver first appeared in FreeBSD 6.0 and was imported into DragonFly 2.1.

The acpi_thinkpad driver was written by Takanori Watanabe <takawata@FreeBSD.org> and later mostly rewritten by Markus Brueffer <markus@FreeBSD.org>. This manual page was written by Christian Brueffer <brueffer@FreeBSD.org> and Markus Brueffer <markus@FreeBSD.org>.

October 19, 2014 DragonFly-5.6.1