Commit Graph

95 Commits

Author SHA1 Message Date
kardel 54c2251d60 add HYT-221/271/939 humidity/temperature I2C sensor
extend envsys(4) framework by %rH (relative humidity)
2014-05-18 11:46:23 +00:00
pgoyette 270592accd Since we're no longer making a copy of the option args, we shouldn't
attempt to free it.
2012-12-14 05:29:28 +00:00
christos dd6ce158a9 - no point in allocating memory to hold command line arguments.
- allocate memory inside the function used.
2012-12-13 20:06:42 +00:00
christos 83779a48b3 PR/47316: Henning Petersen: Memory leak in envstat with config file. 2012-12-13 19:31:25 +00:00
njoly 8b220255d1 Fix alignment display for temperature, fans and integer units. 2012-05-11 18:41:12 +00:00
riz af51433848 Various English usage, spelling and markup fixes for envstat(4)-related
things, from Snader_LB.
2012-02-09 18:10:26 +00:00
jmcneill 1d4bba4173 change printed indicator and battery charge strings from ON and OFF to TRUE
and FALSE, because messages like "battery present: ON" are difficult for my
brain to parse.
2011-12-04 19:34:22 +00:00
pgoyette 83a2ecf6cc Zero is a valid value for some sensors so update statistics code to
handle that.
2011-06-07 17:24:32 +00:00
pgoyette c84ec94ab0 1. Don't print blank for Integer sensors with value of zero
2. Properly print percentages in -T statistics mode
3. Always set Sensor Type (units) to a non-NULL value
4. Enable printing of percentages for Integer sensors
2011-06-06 20:48:56 +00:00
pgoyette dec626b5e2 Since there is no longer a value-avg property, remove the code that
extracts it.
2011-06-04 13:29:02 +00:00
pgoyette 120c01c6d1 When skipping output for a temperature of absolute zero, don't forget to
skip past the display columns that the value would otherwise occupy.

Fixes display issue when swsensor(4) is used and it has a value of 0K,
as reported by njoly@
2010-12-16 14:37:23 +00:00
pooka 57ec646236 Use a consistent approach for rump kernel calls made by libs.
Should investigate a dynamic approach in the future.
2010-12-14 08:04:14 +00:00
pooka 3d4766ce57 RUMP_ACTION -> RUMPPRG 2010-12-13 18:00:38 +00:00
pooka 7d1c54af24 adapt to new rumpclient_init() signature 2010-11-05 13:52:41 +00:00
pooka 1ec3731938 support rump client mode 2010-11-05 13:42:37 +00:00
pgoyette 58f7870b48 Some Integer-type sensors can have limits, so allow them to be displayed. 2010-10-05 00:14:55 +00:00
jruoho d439ff278b Use <paths.h>. Remove trailing white space. 2010-08-26 05:25:57 +00:00
mlelstv 1898a7c316 Print the correct value for critmin of a fan sensor. 2010-08-01 15:39:52 +00:00
pgoyette 74999bdda4 Update userland envstat(8) to handle new {high,maximum}-capacity limits. 2010-02-15 22:37:14 +00:00
njoly 9a9cbde160 Fix double free, when requesting an invalid sensor. 2010-02-12 14:26:27 +00:00
cnst 7397d018ca remove the fourth (empty) column from the -T printouts; ok pgoyette 2010-02-12 05:02:40 +00:00
cnst 0854bc43a8 fix a typo resulting in warn-max being shown in two columns (one time instead of crit-min); ok pgoyette 2010-02-09 05:32:51 +00:00
pgoyette c6140fa206 Since we never have both a limit value and a limit %capacity value,
remove the Capacity column.

Reduce inter-column spacing, and display all four limits on one page,
rather than using the -W command line option to switch between critical
and warning limits.  (The -W option is still permitted, but has no
effect.)

%capacity limits are displayed in the WarnMin and CritMin columns, but
have a trailing % sign.
2010-01-30 02:56:39 +00:00
christos 9587268219 fix pasto: don't print the critcap when the warncap was asked. Also off by
one in length. From Anon-Ymous.
XXX: Should pull up to 5.0
2009-04-04 18:43:01 +00:00
ahoka 4f97e87b0c Add support for showing temperatures in Kelvin. 2009-02-14 16:08:22 +00:00
pgoyette 6d65ba8398 1. provide for warning-min and warning-max alarm levels in addition to
critical-min and critical-max; also, a battery warning-capacity is
   added in addition to a critical-capacity.

2. usr.sbin/envstat is modified to introduce a -W command line switch to
   display the warning-* values instead of the critical-* values, and
   envstat(8) and envsys.conf(5) man pages are updated appropriately.

3. Treat user-defined limits as a single continuum and generate a single
   event regardless of how many boundaries a change in sensor value
   crosses;  ditto for driver-defined limits.

Fixes my PR/39021
Fixes my PR/39022

OK'd by christos@ bouyer@ cube@
2008-08-22 11:27:50 +00:00
christos 7b65855e71 simplify the code, from xtraeme. 2008-08-09 04:49:23 +00:00
christos 1c8ebda697 remove printf when the sensor has no statistics; requested by xtraeme. 2008-05-25 20:03:05 +00:00
christos 2fa9c865b5 Don't code using side-effects (eliminate queue variable). Unconfuses Coverity
CID 5031.
2008-05-24 15:55:13 +00:00
christos 54cf942f77 Coverity CID 5034: Use after free. Restructure the code to simplify it and
print the error.
2008-05-24 15:45:58 +00:00
xtraeme dbce9233f7 Don't show statistics in sensors that will provide a percentage. 2008-04-29 21:46:17 +00:00
xtraeme b02a77aff5 Add missing cast, noticed by Paul Goyette in current-users@. 2008-04-26 20:58:51 +00:00
xtraeme f4ac0ac2c7 Cur -> Current for the header. 2008-04-26 11:28:26 +00:00
xtraeme 7dbfb3923c In default display mode, fix up the indentation for the critical
limits so that they appear in the correct column.
2008-04-26 11:15:14 +00:00
xtraeme f960b01be8 * Improve default display output by adding a header that will match
current value as well as critical limits set and sensor unit.

* Add a new flag: -T. When it's enabled statistics will be created for
  the sensors. Max, min and average statistics as well as sensor unit
  will be displayed. Must be used with an interval.

You can see the new code in action here:

http://www.netbsd.org/~xtraeme/envstat_stats.txt

Thanks to jmcneill@ for comments and ideas.
2008-04-26 02:56:57 +00:00
xtraeme e7638e85c4 Remove the 'dvnprinted' bool member of sensor_t, it's unused. 2008-04-17 21:19:12 +00:00
xtraeme b16a06cd38 * Add support to show output from specified sensors in multiple devices
via the -s flag (the requirement for -d is not there anymore). [1]

You can do something like the following now:

$ envstat -s "acpibat0:charge,acpibat0:charge state,acpitz0:temperature"
[acpibat0]
       charge:      3.015 Ah (79.70%)
 charge state:     NORMAL
[acpitz0]
  temperature:     54.000 degC
$

* As bonus, the code has been modified to use a simple queue for
  the sensors, and this has simplified and improved some parts of the
  code as well.

[1] Item requested by joerg@ yesterday.
2008-04-17 20:51:48 +00:00
xtraeme 27ddba0559 Implement the 'refresh-timeout' property in device blocks for the
configuration files. This sets the timeout value that will be used
to check for critical limits.

The value can be viewed by the 'envstat -D' command.
2007-11-16 08:01:37 +00:00
xtraeme 4e10a84855 - Rename ENVSYS_BATTERY_STATE units to ENVSYS_BATTERY_CAPACITY and
introduce ENVSYS_BATTERY_CHARGE, which is the same than an Indicator and
  it's used to know if the battery is currently charging or discharging.

- Require two sensors at least for SME_CLASS_BATTERY to make the low-power
  condition work: a ENVSYS_BATTERY_CAPACITY plus ENVSYS_BATTERY_CHARGE.

- Simplify sme_event_check_lowpower() and make it check the required
  sensors in the SME_CLASS_ACADAPTER and SME_CLASS_BATTERY classes.
  If the acadapter is not ready, trust the state returned by the battery
  device.

Based on suggestion from joerg@.
2007-11-03 23:05:21 +00:00
xtraeme f2803256d9 New configuration file format for the envsys framework:
foo0 {
	#
	# CPU Temperature
	#
	sensor0 {
		critical-max = 70C;
		critical-min = 20C;
	}
	...
}
...

Removed the -m flag that was previously used to set properties for
sensors. Now the -c flag will process all properties specified in
the file (accepted as argument).

To remove all properties that were set, the new -S flag can be used.
This will restore default values for all devices.
2007-10-07 04:16:47 +00:00
xtraeme ccaf6fc177 - Simplify find_sensors().
- Remove a block that is not used anymore in check_sensors().
2007-09-25 15:09:32 +00:00
xtraeme 9df195ed98 Merge a patch from Iain Hibbert (plunky@):
- some unclear language cleaned up
- inconsistent usage of 'device' and 'driver' to refer to the same thing
- difficult error handling

And print the device name if -d flag is not specified for any driver
registered, e.g:

$ envstat
[aiboost0]
  CPU Temperature:     36.000 degC  max:   70.000 degC  min:   15.000 degC
   MB Temperature:     38.000 degC  max:   50.000 degC  min:   15.000 degC
    Vcore Voltage:      1.232 V     max:    1.350 V     min:    1.150 V
     +3.3 Voltage:      3.264 V     max:    3.500 V     min:    3.000 V
       +5 Voltage:      5.017 V     max:    5.600 V     min:    4.500 V
      +12 Voltage:     11.932 V     max:   13.500 V     min:   11.200 V
    CPU FAN Speed:       1268 RPM
$
2007-09-25 14:20:48 +00:00
plunky c231a9012a sort options 2007-09-20 18:38:49 +00:00
xtraeme e4ac7a291b Another typo in a comment. 2007-09-10 17:41:26 +00:00
xtraeme 6f1f4d144f Fix a comment. 2007-09-10 17:40:44 +00:00
xtraeme 5316ee99b1 Check argc before calling open(2), and use the out label in another
error case.
2007-09-10 17:39:14 +00:00
xtraeme fc321f6650 Fix a lint(1) warning and remove oldsize in print_sensors(), it's
not used.
2007-09-10 14:25:17 +00:00
xtraeme 25be892bac Don't forget to check if -s was specified without -d, and add a macro
to check it in two places.
2007-09-10 14:15:11 +00:00
xtraeme 16f28d90fc Redo how the arguments are processed, so that arguments not allowed
will call usage(). Also remove an extra free().
2007-09-10 13:58:50 +00:00
xtraeme 6263ca5fa3 Update to match current kernel code. 2007-09-04 16:54:37 +00:00