diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2011-09-16 20:52:49 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2011-09-16 20:52:49 +0000 |
commit | 18745ce448e248133b3cceaadd8a5f6a10f50e81 (patch) | |
tree | d0b5bc26a628d4dc01418634148ebc00ad5d76ed | |
parent | 9bb685bee6da4388868a400480ecd22fb0a42865 (diff) |
reorder SENSOR_* in switch() and add missing cases.
ok deraadt@
-rw-r--r-- | sbin/sysctl/sysctl.c | 9 | ||||
-rw-r--r-- | usr.bin/systat/sensors.c | 23 | ||||
-rw-r--r-- | usr.sbin/snmpd/mib.c | 5 |
3 files changed, 22 insertions, 15 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index f8ba7defd56..9125fc00119 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.179 2011/09/16 16:41:55 yuo Exp $ */ +/* $OpenBSD: sysctl.c,v 1.180 2011/09/16 20:52:48 yuo Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -2463,11 +2463,14 @@ print_sensor(struct sensor *s) case SENSOR_FANRPM: printf("%lld RPM", s->value); break; + case SENSOR_VOLTS_DC: + printf("%.2f VDC", s->value / 1000000.0); + break; case SENSOR_VOLTS_AC: printf("%.2f VAC", s->value / 1000000.0); break; - case SENSOR_VOLTS_DC: - printf("%.2f VDC", s->value / 1000000.0); + case SENSOR_OHMS: + printf("%lld ohm", s->value); break; case SENSOR_WATTS: printf("%.2f W", s->value / 1000000.0); diff --git a/usr.bin/systat/sensors.c b/usr.bin/systat/sensors.c index 1effdbfc14e..ab187b074dc 100644 --- a/usr.bin/systat/sensors.c +++ b/usr.bin/systat/sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.c,v 1.25 2011/09/16 15:44:31 yuo Exp $ */ +/* $OpenBSD: sensors.c,v 1.26 2011/09/16 20:52:48 yuo Exp $ */ /* * Copyright (c) 2007 Deanna Phillips <deanna@openbsd.org> @@ -224,13 +224,16 @@ showsensor(struct sensinfo *s) case SENSOR_FANRPM: tbprintf("%11lld RPM", s->sn_value); break; + case SENSOR_VOLTS_DC: + tbprintf("%10.2f V DC", + s->sn_value / 1000000.0); + break; case SENSOR_VOLTS_AC: tbprintf("%10.2f V AC", s->sn_value / 1000000.0); break; - case SENSOR_VOLTS_DC: - tbprintf("%10.2f V DC", - s->sn_value / 1000000.0); + case SENSOR_OHMS: + tbprintf("%11lld ohm", s->sn_value); break; case SENSOR_WATTS: tbprintf("%10.2f W", s->sn_value / 1000000.0); @@ -238,6 +241,12 @@ showsensor(struct sensinfo *s) case SENSOR_AMPS: tbprintf("%10.2f A", s->sn_value / 1000000.0); break; + case SENSOR_WATTHOUR: + tbprintf("%12.2f Wh", s->sn_value / 1000000.0); + break; + case SENSOR_AMPHOUR: + tbprintf("%10.2f Ah", s->sn_value / 1000000.0); + break; case SENSOR_INDICATOR: tbprintf("%15s", s->sn_value ? "On" : "Off"); break; @@ -260,12 +269,6 @@ showsensor(struct sensinfo *s) case SENSOR_TIMEDELTA: tbprintf("%15s", fmttime(s->sn_value / 1000000000.0)); break; - case SENSOR_WATTHOUR: - tbprintf("%12.2f Wh", s->sn_value / 1000000.0); - break; - case SENSOR_AMPHOUR: - tbprintf("%10.2f Ah", s->sn_value / 1000000.0); - break; case SENSOR_HUMIDITY: tbprintf("%3.2f%%", s->sn_value / 1000.0); break; diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c index aa508785ff7..c081d5969b9 100644 --- a/usr.sbin/snmpd/mib.c +++ b/usr.sbin/snmpd/mib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mib.c,v 1.46 2011/09/16 15:44:31 yuo Exp $ */ +/* $OpenBSD: mib.c,v 1.47 2011/09/16 20:52:48 yuo Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> @@ -1348,7 +1348,7 @@ static const char * const sensor_drive_s[SENSOR_DRIVE_STATES] = { static const char * const sensor_unit_s[SENSOR_MAX_TYPES + 1] = { "degC", "RPM", "V DC", "V AC", "Ohm", "W", "A", "Wh", "Ah", - "", "", "%", "lx", "", "sec", "" + "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree", "" }; const char * @@ -1398,6 +1398,7 @@ mib_sensorvalue(struct sensor *s) } /* FALLTHROUGH */ case SENSOR_FANRPM: + case SENSOR_OHMS: case SENSOR_INTEGER: default: ret = asprintf(&v, "%lld", s->value); |