ACPI_IBM(4) | Device Drivers Manual | ACPI_IBM(4) |
acpi_ibm
— ACPI
extras driver for IBM laptops
To compile this driver into the kernel, place the following line in your kernel configuration file:
device acpi_ibm
Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):
acpi_ibm_load="YES"
The acpi_ibm
driver provides support for
hotkeys and other components of IBM 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.
Hotkey events received by devd(8) provide the following information:
ACPI
"IBM
"Depending on the ThinkPad model, event codes may vary. On a ThinkPad T41p these are as follows:
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0a
0x0b
0x0c
0x0d
0x0e
0x0f
0x10
0x11
0x12
0x13
0x14
0x15
0x16
0x17
0x18
The acpi_ibm
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:
acpi_ibm
driver was loaded.acpi_ibm
driver being loaded, only the Fn+F4
button generates an ACPI event.1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
524288
1048576
2097152
4194304
8388608
acpi_ibm
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 maybe handled twice
(e.g., Brightness up/down) if ACPI BIOS already handled the event.Defaults for these sysctls can be set in sysctl.conf(5).
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 dev.acpi_${OEM}.0.bluetooth` if [ "$LEVEL" = "1" ] then sysctl dev.acpi_${OEM}.0.bluetooth=0 MESSAGE="bluetooth disabled" else sysctl dev.acpi_${OEM}.0.bluetooth=1 MESSAGE="bluetooth enabled" fi ;; 0x10|0x11) LEVEL=`sysctl -n dev.acpi_${OEM}.0.lcd_brightness` PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \ ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\ ${CALC} | ${CUT} -d . -f 1` MESSAGE="brightness level ${PERCENT}%" ;; 0x12) LEVEL=`sysctl -n dev.acpi_${OEM}.0.thinklight` if [ "$LEVEL" = "1" ] then MESSAGE="thinklight enabled" else MESSAGE="thinklight disabled" fi ;; 0x15|0x16) LEVEL=`sysctl -n dev.acpi_${OEM}.0.volume` PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \ ${LEVEL} / ${MAX_VOLUME} * 100" | \ ${CALC} | ${CUT} -d . -f 1` MESSAGE="volume level ${PERCENT}%" ;; 0x17) LEVEL=`sysctl -n dev.acpi_${OEM}.0.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_ibm
.
sysctl dev.acpi_ibm.0.handlerevents='0x04 0x10 0x11'
in sysctl.conf(5):
dev.acpi_ibm.0.handlerevents=0x04\ 0x10\ 0x11
The acpi_ibm
device driver first appeared
in FreeBSD 6.0.
The acpi_ibm
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>.
June 19, 2015 | Debian |