xref: /freebsd/share/man/man4/acpi_fujitsu.4 (revision 4b9d6057)
1.\"
2.\" Copyright (c) 2005 Philip Paeps <philip@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 AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd February 8, 2010
27.Dt ACPI_FUJITSU 4
28.Os
29.Sh NAME
30.Nm acpi_fujitsu
31.Nd Fujitsu Laptop Extras
32.Sh SYNOPSIS
33To compile this driver into the kernel,
34place the following line in your
35kernel configuration file:
36.Bd -ragged -offset indent
37.Cd "device acpi_fujitsu"
38.Ed
39.Pp
40Alternatively, to load the driver as a
41module at boot time, place the following line in
42.Xr loader.conf 5 :
43.Bd -literal -offset indent
44acpi_fujitsu_load="YES"
45.Ed
46.Sh DESCRIPTION
47The
48.Nm
49driver enables the ACPI-controlled buttons on Fujitsu notebooks.
50The button events are sent to userspace via
51.Xr devd 8 ,
52and a
53.Xr sysctl 8
54interface is provided to simulate the hardware events.
55.Pp
56Using this driver, one can control the brightness of the display, the volume
57of the speakers, and the internal (eraserhead) mouse pointer.
58.Sh SYSCTL VARIABLES
59These sysctls are currently implemented:
60.Bl -tag -width indent
61.It Va hw.acpi.fujitsu.lcd_brightness
62Makes the LCD backlight brighter or dimmer.
63.It Va hw.acpi.fujitsu.pointer_enable
64Enables or disables the internal mouse pointer.
65.It Va hw.acpi.fujitsu.volume
66Controls the speaker volume.
67.It Va hw.acpi.fujitsu.mute
68Mutes the speakers.
69.El
70.Pp
71Defaults for these sysctls can be set in
72.Xr sysctl.conf 5 .
73.Sh EXAMPLES
74The following can be added to
75.Xr devd.conf 5
76in order to pass button events to a
77.Pa /usr/local/sbin/acpi_oem_exec.sh
78script:
79.Bd -literal -offset indent
80notify 10 {
81        match "system"		"ACPI";
82        match "subsystem"	"FUJITSU";
83        action "/usr/local/sbin/acpi_oem_exec.sh $notify fujitsu";
84};
85.Ed
86.Pp
87A possible
88.Pa /usr/local/sbin/acpi_oem_exec.sh
89script might look like:
90.Bd -literal -offset indent
91#!/bin/sh
92#
93if [ "$1" = "" -o "$2" = "" ]
94then
95        echo "usage: $0 notify oem_name"
96        exit 1
97fi
98NOTIFY=`echo $1`
99LOGGER="logger"
100CALC="bc"
101BC_PRECOMMANDS="scale=2"
102ECHO="echo"
103CUT="cut"
104MAX_LCD_BRIGHTNESS=7
105MAX_VOLUME=16
106OEM=$2
107DISPLAY_PIPE=/tmp/acpi_${OEM}_display
108
109case ${NOTIFY} in
110        0x00)
111                LEVEL=`sysctl -n hw.acpi.${OEM}.mute`
112                if [ "$LEVEL" = "1" ]
113                then
114                        MESSAGE="volume muted"
115                else
116                        MESSAGE="volume unmuted"
117                fi
118                ;;
119        0x01)
120                LEVEL=`sysctl -n hw.acpi.${OEM}.pointer_enable`
121                if [ "$LEVEL" = "1" ]
122                then
123                        MESSAGE="pointer enabled"
124                else
125                        MESSAGE="pointer disabled"
126                fi
127                ;;
128        0x02)
129                LEVEL=`sysctl -n hw.acpi.${OEM}.lcd_brightness`
130                PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
131			 ${LEVEL} / ${MAX_LCD_BRIGHTNESS} * 100" |\\
132			 ${CALC} | ${CUT} -d . -f 1`
133                MESSAGE="brightness level ${PERCENT}%"
134                ;;
135        0x03)
136                LEVEL=`sysctl -n hw.acpi.${OEM}.volume`
137                PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
138			${LEVEL} / ${MAX_VOLUME} * 100" | \\
139			 ${CALC} | ${CUT} -d . -f 1`
140                MESSAGE="volume level ${PERCENT}%"
141                ;;
142        *)
143                ;;
144        esac
145        ${LOGGER} ${MESSAGE}
146        if [ -p ${DISPLAY_PIPE} ]
147        then
148                ${ECHO} ${MESSAGE} >> ${DISPLAY_PIPE} &
149        fi
150exit 0
151.Ed
152.Sh SEE ALSO
153.Xr acpi 4 ,
154.Xr sysctl.conf 5 ,
155.Xr devd 8 ,
156.Xr sysctl 8
157.Sh HISTORY
158The
159.Nm
160driver first appeared in
161.Fx 5.4 .
162.Sh AUTHORS
163.An -nosplit
164The
165.Nm
166driver was written by
167.An Sean Bullington Aq Mt shegget@gmail.com ,
168.An Anish Mistry Aq Mt mistry.7@osu.edu ,
169and
170.An Marc Santcroos Aq Mt marks@ripe.net .
171.Pp
172This manual page was written by
173.An Philip Paeps Aq Mt philip@FreeBSD.org .
174