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