aboutsummaryrefslogtreecommitdiff
path: root/share/man/man4/acpi_fujitsu.4
blob: da74e671dd67a0a118508619c0245cbf66be24c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
.\"
.\" Copyright (c) 2005 Philip Paeps <philip@FreeBSD.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd February 8, 2010
.Dt ACPI_FUJITSU 4
.Os
.Sh NAME
.Nm acpi_fujitsu
.Nd Fujitsu Laptop Extras
.Sh SYNOPSIS
To compile this driver into the kernel,
place the following line in your
kernel configuration file:
.Bd -ragged -offset indent
.Cd "device acpi_fujitsu"
.Ed
.Pp
Alternatively, to load the driver as a
module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
acpi_fujitsu_load="YES"
.Ed
.Sh DESCRIPTION
The
.Nm
driver enables the ACPI-controlled buttons on Fujitsu notebooks.
The button events are sent to userspace via
.Xr devd 8 ,
and a
.Xr sysctl 8
interface is provided to simulate the hardware events.
.Pp
Using this driver, one can control the brightness of the display, the volume
of the speakers, and the internal (eraserhead) mouse pointer.
.Sh SYSCTL VARIABLES
These sysctls are currently implemented:
.Bl -tag -width indent
.It Va hw.acpi.fujitsu.lcd_brightness
Makes the LCD backlight brighter or dimmer.
.It Va hw.acpi.fujitsu.pointer_enable
Enables or disables the internal mouse pointer.
.It Va hw.acpi.fujitsu.volume
Controls the speaker volume.
.It Va hw.acpi.fujitsu.mute
Mutes the speakers.
.El
.Pp
Defaults for these sysctls can be set in
.Xr sysctl.conf 5 .
.Sh EXAMPLES
The following can be added to
.Xr devd.conf 5
in order to pass button events to a
.Pa /usr/local/sbin/acpi_oem_exec.sh
script:
.Bd -literal -offset indent
notify 10 {
        match "system"		"ACPI";
        match "subsystem"	"FUJITSU";
        action "/usr/local/sbin/acpi_oem_exec.sh $notify fujitsu";
};
.Ed
.Pp
A possible
.Pa /usr/local/sbin/acpi_oem_exec.sh
script might look like:
.Bd -literal -offset indent
#!/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=16
OEM=$2
DISPLAY_PIPE=/tmp/acpi_${OEM}_display

case ${NOTIFY} in
        0x00)
                LEVEL=`sysctl -n hw.acpi.${OEM}.mute`
                if [ "$LEVEL" = "1" ]
                then
                        MESSAGE="volume muted"
                else
                        MESSAGE="volume unmuted"
                fi
                ;;
        0x01)
                LEVEL=`sysctl -n hw.acpi.${OEM}.pointer_enable`
                if [ "$LEVEL" = "1" ]
                then
                        MESSAGE="pointer enabled"
                else
                        MESSAGE="pointer disabled"
                fi
                ;;
        0x02)
                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}%"
                ;;
        0x03)
                LEVEL=`sysctl -n hw.acpi.${OEM}.volume`
                PERCENT=`${ECHO} "${BC_PRECOMMANDS} ; \\
			${LEVEL} / ${MAX_VOLUME} * 100" | \\
			 ${CALC} | ${CUT} -d . -f 1`
                MESSAGE="volume level ${PERCENT}%"
                ;;
        *)
                ;;
        esac
        ${LOGGER} ${MESSAGE}
        if [ -p ${DISPLAY_PIPE} ]
        then
                ${ECHO} ${MESSAGE} >> ${DISPLAY_PIPE} &
        fi
exit 0
.Ed
.Sh SEE ALSO
.Xr acpi 4 ,
.Xr sysctl.conf 5 ,
.Xr devd 8 ,
.Xr sysctl 8
.Sh HISTORY
The
.Nm
driver first appeared in
.Fx 5.4 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Sean Bullington Aq Mt shegget@gmail.com ,
.An Anish Mistry Aq Mt mistry.7@osu.edu ,
and
.An Marc Santcroos Aq Mt marks@ripe.net .
.Pp
This manual page was written by
.An Philip Paeps Aq Mt philip@FreeBSD.org .