Commit Graph

166 Commits

Author SHA1 Message Date
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
xtraeme 2b869145f4 Last one: mention adt7467c(4). 2007-03-14 01:22:44 +00:00
xtraeme 21a60be327 Mention ipmi(4), nsclpcsio(4), owtemp(4), tctrl(4) and tm121temp(4). 2007-03-14 01:12:27 +00:00
xtraeme eb277efe09 Mention aiboost(4), it(4), ug(4) and viaenv(4), bump date. 2007-03-14 01:03:12 +00:00
wiz b5bca6912d Bump date for previous. Remove trailing whitespace. 2006-12-23 09:48:47 +00:00
reed 623f8d5ade Add a useful example. 2006-12-14 02:33:18 +00:00
gson d9fde78727 In -i mode, flush standard output after each line. This is needed to
make the output appear in a timely fashion when redirected to a file
or pipe.
2006-08-31 10:25:04 +00:00
wiz 996e601d13 One r in the option string is enough; from Jeff Ito. 2004-06-03 16:48:53 +00:00
wiz 50c34bcf41 Remove unhandled option letter c from option string, noted by Jeff Ito. 2004-06-03 15:47:04 +00:00
wiz 856533536c Sync usage with man page.
From Kouichirou Hiratsuka in PR 25798.
2004-06-03 14:51:32 +00:00
kochi ffaf7e29a6 add references to ACPI man pages. 2004-04-25 03:13:00 +00:00
mrg 1505f78b5b - move the row printing code into it's own function.
- pay attention to interval processing with row printing (-r -iN).

the latter fixes PR#24522.
2004-03-25 01:26:57 +00:00
mrg 057c3b737e in -r mode, if given "-s sensor_list", only list the given sensors instead
of always listing them all
2004-03-21 10:52:26 +00:00
soren 12e7c81811 As pointed out by Dave Huang, revert back to using 273.15 rather than 273.16
when converting between kelvin and celsius.
2004-02-02 10:36:19 +00:00
soren cf458c9f73 C = K + 273.16. 2004-02-02 07:55:14 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
mycroft e7e5d0f4f6 Don't display data for sensors with ENVSYS_FCURVALID not set.
Clean up a little.
2003-10-31 20:37:53 +00:00
martin 89fe22c05c Not all size_t's are equal to int... 2003-02-21 07:23:43 +00:00
christos c837eea5e5 - pass lint
- use size_t where appropriate
- use err/warn instead of printf, and don't hide the error messages from ioctl.
- keep units in sync (someone added integer in the header file and forgot
  to update envsys.c)
2003-02-20 20:57:08 +00:00
christos 1748ad5426 fix usage [add -r] 2003-01-11 23:44:47 +00:00
christos cee2d9b418 exit 0 when -r 2003-01-05 22:16:22 +00:00
chris 8eae0df210 Update -r option to display data in correct units, IE temperature in degC or
degF, fan speed is now correct, and indicators will now show ON/OFF.
2003-01-05 01:56:42 +00:00
augustss 167e6beba4 Add -r to synopsis. 2003-01-02 14:01:30 +00:00
wiz 8b0cfb2d8e New sentence, new line. Bump date for -r description. 2003-01-02 13:55:29 +00:00
augustss 532c81c75d Document the -r flag. 2003-01-02 11:55:52 +00:00
augustss 9381d1a428 Include <paths.h> 2003-01-01 12:16:40 +00:00
augustss a57c1af9e5 ANSIfy. 2003-01-01 12:14:21 +00:00
explorer 0c77fcf312 add ENVSYS_INDICATOR and ENVSYS_INTEGER types 2002-12-31 05:27:29 +00:00
wiz 76cb93f4d7 Drop a trailing empty line. 2002-01-19 03:11:44 +00:00
cgd 25bdbb661e convert to use getprogname() 2001-02-19 23:22:40 +00:00
augustss 826490bf58 Indicate that the device argument is not mandatory. 2000-07-02 00:55:47 +00:00
thorpej 3cf08199ac If the `device' argument is not specified, attempt to open /dev/sysmon. 2000-06-24 00:41:10 +00:00
simonb fd4ede242b Don't declare 'extern opt*' getopt variables. 2000-04-14 06:26:52 +00:00
groo 38cfdfd8fc Add envstat(8) for displaying sensor readings from any envsys(4)
compatible device.
2000-03-10 05:51:56 +00:00