summaryrefslogtreecommitdiff
path: root/usr.sbin/envstat/envstat.c
AgeCommit message (Collapse)Author
2023-06-19Silence wrong maybe-uninitialized raised by GCC/x86_64 10.4.0 -Os.rin
2022-11-21A driver for the Bosch BMP280 / BME280 temperature, humidity andbrad
atmospheric pressure sensor. This is an inexpensive to moderately expensive chip available from a large number of places. The driver supports all aspects of the two chips, except for the repeating read mode which would allow for sub-second queries, such as fall detection or perhaps even as an altimeter. This driver also only supports the I2C interface and not the SPI interface. The BME280, the one with humidity, is not fully tested at this point, awaiting upon a breakout board and may not show proper humidity.
2022-05-28fix various typos, mainly in comments.andvar
2021-11-27usr.sbin: remove unnecessary CONSTCOND, lint no longer needs itrillig
Since 2021-01-31, lint no longer requires a CONSTCOND comment in a do-while-0 statement since this is a common code pattern, especially in statement-like macros. sed -i -E 's,} while \(/\* ?CONSTCOND ?\*/ ?0\),} while (0),' */*.[ch]
2020-11-14Add option -n to print only the value of a sensor.mlelstv
If statistics are selected with -T, then also display max, min and average. The empty line between each display is skipped when one or more sensors are selected with -s.
2020-11-14Allow to select raw output for a single device or a list of sensors.mlelstv
2020-11-14For raw output (-x) allow to extract individual properties like drvctl -p.mlelstv
E.g. # envstat -x /vcmbox0/0/cur-value 328150000
2020-06-07Update for proplib(3) API changes.thorpej
2018-05-27Add support for light sensors that report Illuminance in lux.thorpej
2014-05-18add HYT-221/271/939 humidity/temperature I2C sensorkardel
extend envsys(4) framework by %rH (relative humidity)
2012-12-14Since we're no longer making a copy of the option args, we shouldn'tpgoyette
attempt to free it.
2012-12-13- no point in allocating memory to hold command line arguments.christos
- allocate memory inside the function used.
2012-12-13PR/47316: Henning Petersen: Memory leak in envstat with config file.christos
2012-05-11Fix alignment display for temperature, fans and integer units.njoly
2012-02-09Various English usage, spelling and markup fixes for envstat(4)-relatedriz
things, from Snader_LB.
2011-12-04change printed indicator and battery charge strings from ON and OFF to TRUEjmcneill
and FALSE, because messages like "battery present: ON" are difficult for my brain to parse.
2011-06-07Zero is a valid value for some sensors so update statistics code topgoyette
handle that.
2011-06-061. Don't print blank for Integer sensors with value of zeropgoyette
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-04Since there is no longer a value-avg property, remove the code thatpgoyette
extracts it.
2010-12-16When skipping output for a temperature of absolute zero, don't forget topgoyette
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-14Use a consistent approach for rump kernel calls made by libs.pooka
Should investigate a dynamic approach in the future.
2010-12-13RUMP_ACTION -> RUMPPRGpooka
2010-11-05adapt to new rumpclient_init() signaturepooka
2010-11-05support rump client modepooka
2010-10-05Some Integer-type sensors can have limits, so allow them to be displayed.pgoyette
2010-08-26Use <paths.h>. Remove trailing white space.jruoho
2010-08-01Print the correct value for critmin of a fan sensor.mlelstv
2010-02-15Update userland envstat(8) to handle new {high,maximum}-capacity limits.pgoyette
2010-02-12Fix double free, when requesting an invalid sensor.njoly
2010-02-12remove the fourth (empty) column from the -T printouts; ok pgoyettecnst
2010-02-09fix a typo resulting in warn-max being shown in two columns (one time ↵cnst
instead of crit-min); ok pgoyette
2010-01-30Since we never have both a limit value and a limit %capacity value,pgoyette
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.
2009-04-04fix pasto: don't print the critcap when the warncap was asked. Also off bychristos
one in length. From Anon-Ymous. XXX: Should pull up to 5.0
2009-02-14Add support for showing temperatures in Kelvin.ahoka
2008-08-221. provide for warning-min and warning-max alarm levels in addition topgoyette
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-09simplify the code, from xtraeme.christos
2008-05-25remove printf when the sensor has no statistics; requested by xtraeme.christos
2008-05-24Don't code using side-effects (eliminate queue variable). Unconfuses Coveritychristos
CID 5031.
2008-05-24Coverity CID 5034: Use after free. Restructure the code to simplify it andchristos
print the error.
2008-04-29Don't show statistics in sensors that will provide a percentage.xtraeme
2008-04-26Add missing cast, noticed by Paul Goyette in current-users@.xtraeme
2008-04-26Cur -> Current for the header.xtraeme
2008-04-26In default display mode, fix up the indentation for the criticalxtraeme
limits so that they appear in the correct column.
2008-04-26* Improve default display output by adding a header that will matchxtraeme
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-17Remove the 'dvnprinted' bool member of sensor_t, it's unused.xtraeme
2008-04-17* Add support to show output from specified sensors in multiple devicesxtraeme
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.
2007-11-16Implement the 'refresh-timeout' property in device blocks for thextraeme
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-03- Rename ENVSYS_BATTERY_STATE units to ENVSYS_BATTERY_CAPACITY andxtraeme
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-10-07New configuration file format for the envsys framework:xtraeme
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-09-25- Simplify find_sensors().xtraeme
- Remove a block that is not used anymore in check_sensors().