xref: /netbsd-src/share/man/man4/swsensor.4 (revision 629fb2d91c5b1c4a6a181e2ced119580102e21b1)
1.\"	$NetBSD: swsensor.4,v 1.13 2016/06/01 02:15:26 pgoyette Exp $
2.\"
3.\" Copyright (c) 2010 The NetBSD Foundation
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Paul Goyette.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd June 1, 2016
31.Dt SWSENSOR 4
32.Os
33.Sh NAME
34.Nm swsensor
35.Nd software environmental sensor
36.Sh SYNOPSIS
37.Cd "pseudo-device swsensor"
38.Sh DESCRIPTION
39The
40.Nm
41driver provides a software environmental sensor that works with
42.Xr  sysctl 8
43and
44.Xr envstat 8 .
45The driver is intended to be loaded as a kernel module.
46One can, however, include the
47.Nm
48driver directly in a kernel using the configuration from the synopsis.
49By default, the sensor is of type
50.Dv ENVSYS_UNITS_INTEGER .
51.Pp
52The following values can be specified in the
53.Xr modload 8
54command when loading the
55.Nm
56module to alter the driver's behavior.
57.Pp
58.Bl -tag -width "percentage"
59.It Sy "Variable" Sy "Usage"
60.It Li "mode"
61Controls whether or not
62.Nm
63provides internally-maintained limits and limit checking
64.Bl -tag -width "Value"
65.It Sy "Value" Sy "Meaning"
66.It Li "0"
67sensor has no internally-maintained limits
68.It Li "1"
69sensor provides its own internal limit value
70.It Li "2"
71sensor maintains an internal adjustable limit and performs its own
72comparison between the sensor's limit and its current value
73.El
74.It Li "limit"
75The initial alarm limit value, if limit emulation is selected (i.e., if
76.Dv mode
77is set to 1 or 2)
78.It Li "value_max"
79.It Li "value_min"
80The maximum and minimum values.
81The corresponding
82.Dv ENVSYS_FVALID_MAX
83and
84.Dv ENVSYS_FVALID_MIN
85flags are implicitly set.
86.It Li "percentage"
87This boolean value controls the setting of the
88.Dv ENVSYS_FPERCENT
89flag.
90.It Li "type"
91Define the sensor's unit/type.
92By default, a Temperature sensor is created.
93Any of the string values from the following table can be specified:
94.Bl -column "Battery capacity" "Battery charge" "Ampere hour"
95.It "Temperature"      Ta "Fan"       Ta "Voltage AC"
96.It "Voltage DC"       Ta "Ohms"      Ta "Watts"
97.It "Ampere"           Ta "Watt hour" Ta "Ampere hour"
98.It "Indicator"        Ta "Integer"   Ta "Drive"
99.It "Battery capacity" Ta "Battery charge" Ta ""
100.El
101(Values are case-sensitive, and spaces must be included.)
102.It Li "value"
103Provide an initial value for the sensor.
104If this is omitted, the sensor's initial value is set to zero.
105.El
106.Pp
107For example,
108.Dl Ic modload -s type=Voltage\e DC swsensor
109will create a sensor of type
110.Dv ENVSYS_UNITS_SVOLTS_DC ,
111while
112.Dl Ic modload -i mode=1 -i limit=50 swsensor
113will create a sensor which has an initial, device-provided limit of 50.
114.Pp
115The sensor's raw value and state can be manually updated by modifying the
116.Xr sysctl 8
117variables
118.Dq hw.swsensor.cur_value
119and
120.Dq hw.swsensor.state
121variables respectively.
122.Sh SEE ALSO
123.Xr modctl 2 ,
124.Xr envstat 8 ,
125.Xr sysctl 8
126.Sh HISTORY
127The
128.Nm
129driver was written by
130.An Paul Goyette
131and first appeared in
132.Nx 6.0 .
133.Sh BUGS
134The
135.Nm
136driver emulates a device with only a single sensor.
137.Pp
138The
139.Nm
140driver can only emulate one hardware-managed limit; this is assumed to
141be the
142.Dv critical-min
143limit.
144