Commit Graph

83 Commits

Author SHA1 Message Date
xtraeme
71045d13c0 Explain some more about the events that will send to powerd(8)
(if running) in the critical-{capacity,max,min} properties when the
limit has been reached.
2007-10-07 15:23:41 +00:00
xtraeme
2839febced Use two global dictionaries rather than only one:
- use one for temporary sensor dictionaries.
- use one as the dictionary that will be returned to send_dictionary().

This fixes multiple settings in multiple devices.
2007-10-07 13:48:03 +00:00
xtraeme
8259fb204b Use another main rule to avoid a conflict in the grammar.
Suggestion from martin@.
2007-10-07 13:46:22 +00:00
xtraeme
7447ac47db Xref envsys.conf(5) 2007-10-07 12:43:19 +00:00
xtraeme
bca7b7f673 Pass -I${.CURDIR} -I. like others do. 2007-10-07 12:19:37 +00:00
xtraeme
b0a8720beb Accept '+' or '-' characters at the start of SP_STRING. 2007-10-07 05:11:08 +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
3b0395d28d replace inadvertently removed N 2007-09-20 19:48:26 +00:00
plunky
c231a9012a sort options 2007-09-20 18:38:49 +00:00
xtraeme
3f2361dc7d Mention aps(4). 2007-09-11 21:47:37 +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
xtraeme
85f08bb0ab Fix typo in previous. 2007-09-02 21:31:24 +00:00
xtraeme
13af8b9adc Add the -I flag that skips sensors with invalid state. They are shown
by default, but this is for users that don't want to print them.
2007-09-02 21:25:24 +00:00
xtraeme
1b3709ecde Add a new sensor type to sysmon_envsys(9): ENVSYS_GSTRING.
ENVSYS_GSTRING (aka Generic String) uses the genstr member in
the envsys_data_t struct to add a generic string that envstat(8)
will show as value or state.

It's like the ENVSYS_DRIVER, but doesn't use value_cur. Below
is the dictionary created on these sensors:

<dict>
	<key>description</key>
	<string>acpibat0 charge state</string>
	<key>generic-state-string</key>
	<string>NORMAL</string>
	<key>monitoring-supported</key>
	<false/>
	<key>state</key>
	<string>valid</string>
	<key>type</key>
	<string>Generic string</string>
</dict>

Note that it's limited to 32 chars, but we can grow it if needed.

envstat(8) will print ENVSYS_GSTRING sensors as:

$ envstat -dacpibat0 -s"acpibat0 charge state"
  acpibat0 charge state:     NORMAL
$
2007-09-02 19:36:59 +00:00
xtraeme
769bd9886e In temperature sensors, do not convert to degC or degF if there's
no value returned.
2007-08-29 16:55:17 +00:00
xtraeme
51e9d204ec Check if the dictionary is empty and print a message if it's true. 2007-08-26 10:20:33 +00:00
seb
2d1475af34 Fix typo.
Ok'ed by xtraeme@
2007-08-07 10:17:17 +00:00
xtraeme
8d2fbe8ac8 The caller of prop_dictionary_externalize is responsible to free the
returned buffer... make it so. Reminded by prop_dictionary(3).
2007-08-05 23:20:44 +00:00
xtraeme
9293272695 Erm... fix previous. 2007-07-21 11:11:10 +00:00
xtraeme
6d38d74b11 Fix a logic bug: report a message and error if -s or -m is being used
without -d.
2007-07-21 10:59:57 +00:00
xtraeme
37fa16db65 Return the value returned by prop_dictionary_recv_ioctl() if the -x flag
is specified too.
2007-07-17 18:15:02 +00:00
xtraeme
8b1500977e - Return the value returned by prop_dictionary_{recv,send}_ioctl
in all cases.
- Skip sensors that do not have a description object in its dictionary.
2007-07-17 17:40:59 +00:00
xtraeme
0a6f85e0f3 Only allow to use ENVSYS_SETDICTIONARY if the user has write permission
in the /dev/sysmon device.

Use O_RDONLY for ENVSYS_GETDICTIONARY and O_RDWR for ENVSYS_SETDICTIONARY
in envstat(8).

Fixes PR kern/36661 by YAMAMOTO Takashi.
2007-07-17 15:43:08 +00:00
xtraeme
2577f77bbc Add the -r flag, which is a dummy flag... only added for compatibility
reasons.
2007-07-17 13:12:46 +00:00
xtraeme
45e944a6cf Define a set of macros to avoid writting same code many times. 2007-07-13 00:42:57 +00:00
xtraeme
425df11cce Add a missing printf in parse_dictionary() and simplify this part to
avoid code duplication in two places.
2007-07-12 22:52:54 +00:00
xtraeme
0938d9b438 Remove a comment that is not valid anymore. 2007-07-12 18:34:07 +00:00
xtraeme
ff9bb2708d - Do not refrence memory already freed, thanks to Geoff C. Wing for
the analysis. Closes PR bin/36636.
- Also use the longest string for the column alignment counting all
  sensors available from all devices, not per-device.

Thanks to rmind@ for help.
2007-07-12 18:24:35 +00:00
xtraeme
ec5dc77a7c tyop 2007-07-05 20:17:43 +00:00
xtraeme
2ce86bd863 Align drive state string like other sensor types. 2007-07-05 14:11:08 +00:00
xtraeme
84b0b63b4c Before checking sensor type:
- check if if its state is invalid
- print the 'N/A' string and continue

This avoids code duplication.
2007-07-05 14:08:37 +00:00
xtraeme
7233bc845c Print invalid state with 'N/A' for Indicators, like any other sensors.
We follow the following scheme now:

value_cur set => ON
value_cur not set => OFF
invalid state => N/A
2007-07-05 13:51:28 +00:00
xtraeme
ada961ab89 Print 'N/A' for invalid sensors rather than an asterisk, with the
exception of Indicator sensors.

Indicator sensors now will print "ON" if they are in valid state, or
"OFF" if they are in invalid state.
2007-07-05 12:11:05 +00:00
xtraeme
96deb6cebd By popular demand, do not skip sensors with invalid state. Print them
with an asterisk, as was suggested by Greg. A. Woods.

Example:

$ ./envstat -dlm0 -s "CPU Fan,System Fan,Aux Fan"
     System Fan:       *
     CPU Fan:       1308 RPM
     Aux Fan:          *
$

Except Integer and Driver sensors, which shouldn't need that.
2007-07-04 19:56:02 +00:00
xtraeme
501645e90d Fix the example that used -s without -d, found by hira@. 2007-07-04 17:16:15 +00:00
xtraeme
5e67825d91 Improve description about the -s flag, it must be used with -d. 2007-07-04 17:15:03 +00:00
xtraeme
3ab4d7d8eb Two grammar fixes from Zafer Aydogan. 2007-07-02 20:37:06 +00:00
xtraeme
af211bb4e3 Imported envsys 2, a brief description of the new features:
(Part 3: userland)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
  and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
  sysmon_power(9) and powerd(8), that means there is no 32 bytes event
  size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
2007-07-01 07:39:45 +00:00
xtraeme
664bf29811 Mention mfi(4), bump date. 2007-05-07 11:00:43 +00:00
bouyer
982bad256f Add bio(4) and associated bioctl(8) from OpenBSD, a driver control block
device controllers, and more specifically raid controllers.
Add a new sensor type, ENVSYS_DRIVE, to report drive status. From OpenBSD.
Add bio and sysmon support to mfi(4). This allow userland to query
status for drives and logical volumes attached to a mfi(4) controller. While
there fix some debug printfs in mfi so they compile.
Add bio(4) to amd64 and i386 GENERIC.
2007-05-01 17:18:52 +00:00
xtraeme
6aad6735ab * tctrl(4) -> sparc/tctrl(4)
* Mention sparc64/envctrl(4) (hi tnn)
2007-04-19 14:26:58 +00:00
xtraeme
83e93a7d4f Erm add missing char. 2007-03-14 01:25:42 +00:00