xref: /netbsd-src/share/man/man4/swsensor.4 (revision 629fb2d91c5b1c4a6a181e2ced119580102e21b1)
1*629fb2d9Spgoyette.\"	$NetBSD: swsensor.4,v 1.13 2016/06/01 02:15:26 pgoyette Exp $
23ae668c1Spgoyette.\"
33ae668c1Spgoyette.\" Copyright (c) 2010 The NetBSD Foundation
43ae668c1Spgoyette.\" All rights reserved.
53ae668c1Spgoyette.\"
63ae668c1Spgoyette.\" This code is derived from software contributed to The NetBSD Foundation
73ae668c1Spgoyette.\" by Paul Goyette.
83ae668c1Spgoyette.\"
93ae668c1Spgoyette.\" Redistribution and use in source and binary forms, with or without
103ae668c1Spgoyette.\" modification, are permitted provided that the following conditions
113ae668c1Spgoyette.\" are met:
123ae668c1Spgoyette.\" 1. Redistributions of source code must retain the above copyright
133ae668c1Spgoyette.\"    notice, this list of conditions and the following disclaimer.
143ae668c1Spgoyette.\" 2. Redistributions in binary form must reproduce the above copyright
153ae668c1Spgoyette.\"    notice, this list of conditions and the following disclaimer in the
163ae668c1Spgoyette.\"    documentation and/or other materials provided with the distribution.
173ae668c1Spgoyette.\"
183ae668c1Spgoyette.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
193ae668c1Spgoyette.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
203ae668c1Spgoyette.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
213ae668c1Spgoyette.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
223ae668c1Spgoyette.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
233ae668c1Spgoyette.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
243ae668c1Spgoyette.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
253ae668c1Spgoyette.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
263ae668c1Spgoyette.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
273ae668c1Spgoyette.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
283ae668c1Spgoyette.\" POSSIBILITY OF SUCH DAMAGE.
293ae668c1Spgoyette.\"
30*629fb2d9Spgoyette.Dd June 1, 2016
313ae668c1Spgoyette.Dt SWSENSOR 4
323ae668c1Spgoyette.Os
333ae668c1Spgoyette.Sh NAME
343ae668c1Spgoyette.Nm swsensor
353ae668c1Spgoyette.Nd software environmental sensor
363ae668c1Spgoyette.Sh SYNOPSIS
373ae668c1Spgoyette.Cd "pseudo-device swsensor"
383ae668c1Spgoyette.Sh DESCRIPTION
393ae668c1SpgoyetteThe
403ae668c1Spgoyette.Nm
413ae668c1Spgoyettedriver provides a software environmental sensor that works with
423ae668c1Spgoyette.Xr  sysctl 8
433ae668c1Spgoyetteand
443ae668c1Spgoyette.Xr envstat 8 .
45cedd9a0bSpgoyetteThe driver is intended to be loaded as a kernel module.
46cedd9a0bSpgoyetteOne can, however, include the
47cedd9a0bSpgoyette.Nm
48cedd9a0bSpgoyettedriver directly in a kernel using the configuration from the synopsis.
4960fb8c11SwizBy default, the sensor is of type
5060fb8c11Swiz.Dv ENVSYS_UNITS_INTEGER .
51cedd9a0bSpgoyette.Pp
52eff7c483SpgoyetteThe following values can be specified in the
53cedd9a0bSpgoyette.Xr modload 8
54cedd9a0bSpgoyettecommand when loading the
55cedd9a0bSpgoyette.Nm
56cedd9a0bSpgoyettemodule to alter the driver's behavior.
57cedd9a0bSpgoyette.Pp
58eff7c483Spgoyette.Bl -tag -width "percentage"
59cedd9a0bSpgoyette.It Sy "Variable" Sy "Usage"
60cedd9a0bSpgoyette.It Li "mode"
61cedd9a0bSpgoyetteControls whether or not
62cedd9a0bSpgoyette.Nm
63cedd9a0bSpgoyetteprovides internally-maintained limits and limit checking
64cedd9a0bSpgoyette.Bl -tag -width "Value"
65cedd9a0bSpgoyette.It Sy "Value" Sy "Meaning"
66cedd9a0bSpgoyette.It Li "0"
67cedd9a0bSpgoyettesensor has no internally-maintained limits
68cedd9a0bSpgoyette.It Li "1"
69cedd9a0bSpgoyettesensor provides its own internal limit value
70cedd9a0bSpgoyette.It Li "2"
71cedd9a0bSpgoyettesensor maintains an internal adjustable limit and performs its own
72cedd9a0bSpgoyettecomparison between the sensor's limit and its current value
73cedd9a0bSpgoyette.El
74cedd9a0bSpgoyette.It Li "limit"
75e7069a34SwizThe initial alarm limit value, if limit emulation is selected (i.e., if
76cedd9a0bSpgoyette.Dv mode
77cedd9a0bSpgoyetteis set to 1 or 2)
78483caa9fSpgoyette.It Li "value_max"
79483caa9fSpgoyette.It Li "value_min"
80f1bd2eacSwizThe maximum and minimum values.
81f1bd2eacSwizThe corresponding
82f02db4b7Spgoyette.Dv ENVSYS_FVALID_MAX
83483caa9fSpgoyetteand
84f02db4b7Spgoyette.Dv ENVSYS_FVALID_MIN
85483caa9fSpgoyetteflags are implicitly set.
86483caa9fSpgoyette.It Li "percentage"
87483caa9fSpgoyetteThis boolean value controls the setting of the
88483caa9fSpgoyette.Dv ENVSYS_FPERCENT
89483caa9fSpgoyetteflag.
90cedd9a0bSpgoyette.It Li "type"
91eff7c483SpgoyetteDefine the sensor's unit/type.
92eff7c483SpgoyetteBy default, a Temperature sensor is created.
93eff7c483SpgoyetteAny of the string values from the following table can be specified:
94eff7c483Spgoyette.Bl -column "Battery capacity" "Battery charge" "Ampere hour"
95eff7c483Spgoyette.It "Temperature"      Ta "Fan"       Ta "Voltage AC"
96eff7c483Spgoyette.It "Voltage DC"       Ta "Ohms"      Ta "Watts"
97eff7c483Spgoyette.It "Ampere"           Ta "Watt hour" Ta "Ampere hour"
98eff7c483Spgoyette.It "Indicator"        Ta "Integer"   Ta "Drive"
99*629fb2d9Spgoyette.It "Battery capacity" Ta "Battery charge" Ta ""
100eff7c483Spgoyette.El
101eff7c483Spgoyette(Values are case-sensitive, and spaces must be included.)
1025c690f06Spgoyette.It Li "value"
1035c690f06SpgoyetteProvide an initial value for the sensor.
1045c690f06SpgoyetteIf this is omitted, the sensor's initial value is set to zero.
105cedd9a0bSpgoyette.El
106cedd9a0bSpgoyette.Pp
1073ae668c1SpgoyetteFor example,
108eff7c483Spgoyette.Dl Ic modload -s type=Voltage\e DC swsensor
10960fb8c11Swizwill create a sensor of type
110eff7c483Spgoyette.Dv ENVSYS_UNITS_SVOLTS_DC ,
111cedd9a0bSpgoyettewhile
112cedd9a0bSpgoyette.Dl Ic modload -i mode=1 -i limit=50 swsensor
113cedd9a0bSpgoyettewill create a sensor which has an initial, device-provided limit of 50.
1143ae668c1Spgoyette.Pp
11539f34c58SpgoyetteThe sensor's raw value and state can be manually updated by modifying the
1163ae668c1Spgoyette.Xr sysctl 8
11739f34c58Spgoyettevariables
11839f34c58Spgoyette.Dq hw.swsensor.cur_value
11939f34c58Spgoyetteand
12039f34c58Spgoyette.Dq hw.swsensor.state
12139f34c58Spgoyettevariables respectively.
1223ae668c1Spgoyette.Sh SEE ALSO
12360fb8c11Swiz.Xr modctl 2 ,
1243ae668c1Spgoyette.Xr envstat 8 ,
1253ae668c1Spgoyette.Xr sysctl 8
126e696d9fcSwiz.Sh HISTORY
127e696d9fcSwizThe
128e696d9fcSwiz.Nm
129e696d9fcSwizdriver was written by
130e696d9fcSwiz.An Paul Goyette
131e696d9fcSwizand first appeared in
132e696d9fcSwiz.Nx 6.0 .
133cedd9a0bSpgoyette.Sh BUGS
134cedd9a0bSpgoyetteThe
135cedd9a0bSpgoyette.Nm
136cedd9a0bSpgoyettedriver emulates a device with only a single sensor.
137cedd9a0bSpgoyette.Pp
138cedd9a0bSpgoyetteThe
139cedd9a0bSpgoyette.Nm
140cedd9a0bSpgoyettedriver can only emulate one hardware-managed limit; this is assumed to
141cedd9a0bSpgoyettebe the
142cedd9a0bSpgoyette.Dv critical-min
143cedd9a0bSpgoyettelimit.
144