1 .\" $OpenBSD: sensor_attach.9,v 1.4 2007/03/22 16:55:31 deraadt Exp $
2 .\" $DragonFly: src/share/man/man9/sensor_attach.9,v 1.1 2007/10/02 12:57:00 hasso Exp $
4 .\" Copyright (c) 2006 Michael Knudsen <mk@openbsd.org>
5 .\" Copyright (c) 2006 Constantine A. Murenin <cnst+openbsd@bugmail.mojo.ru>
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. The name of the author may not be used to endorse or promote products
15 .\" derived from this software without specific prior written permission.
17 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19 .\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 .\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 .Nm sensordev_install ,
35 .Nm sensordev_deinstall ,
36 .Nm sensor_task_register ,
37 .Nm sensor_task_unregister
40 .Fd #include <sys/sensors.h>
42 .Fn "sensordev_install" "struct ksensordev *sensdev"
44 .Fn "sensordev_deinstall" "struct ksensordev *sensdev"
47 .Fn "sensor_attach" "struct ksensordev *sensdev" "struct ksensor *sens"
49 .Fn "sensor_detach" "struct ksensordev *sensdev" "struct ksensor *sens"
52 .Fn "sensor_task_register" "void *arg" "void (*func)(void *)" "int period"
54 .Fn "sensor_task_unregister" "void *arg"
58 framework API provides a mechanism for manipulation of hardware sensors
59 that are available under the
65 adds the sensor specified by the
67 argument to the sensor device specified by the
71 can be used to remove sensors previously added by
75 registers the sensor device specified by the
77 argument so that all sensors that are attached to the device become
78 accessible via the sysctl interface.
79 .Fn sensordev_deinstall
80 can be used to remove sensor devices previously registered by
81 .Fn sensordev_install .
83 Drivers are responsible for retrieving, interpreting and normalising
84 sensor values and updating the sensor struct periodically.
85 If the driver needs process context, for example to sleep, it can
86 register a task with the sensor framework.
88 .Fn sensor_task_register
89 is used to register a periodic task to update sensors.
92 argument is a pointer to the function to run with an interval of
97 parameter is the argument given to the
101 .Fn sensor_task_unregister
102 removes all tasks previously registered with
103 .Fn sensor_task_register
109 .Fn sensor_task_register
111 .Fn sensor_task_unregister
112 functions that are included in
115 are not compatible with
118 includes an implementation that is similar and compatible
119 with an earlier version of
122 functions that was available from
127 Drivers that only call
128 .Fn sensor_task_register
129 and don't check its return value are not affected by this
131 compatibility notice.
138 The sensor framework was written by
139 .An Alexander Yurchenko Aq grange@openbsd.org
140 and first appeared in
142 .An David Gwynne Aq dlg@openbsd.org
143 later extended it for
145 .An Constantine A. Murenin Aq cnst+openbsd@bugmail.mojo.ru
146 extended it even further by introducing the concept of sensor devices in
149 The framework was ported to
152 .An Constantine A. Murenin
153 as a Google Summer of Code 2007 project.