diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2012-09-20 20:11:59 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2012-09-20 20:11:59 +0000 |
commit | 862a65ad28ed788f381eaec33721df1ee8b6ee61 (patch) | |
tree | 6f03c3aec2b8c99104edb01384f26c9896b7f700 /usr.sbin/snmpd | |
parent | 0e23b6d7673107501af89200b19d0af5aea84086 (diff) |
add more sensor types to sensor framework.
- Pressure (10^-3 Pa)
- distance (10^-6 m)
- acceleration (10^-6 m/s^2)
ok deraadt@ reyk@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/mib.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c index 734b6056f59..68ddc7c2f20 100644 --- a/usr.sbin/snmpd/mib.c +++ b/usr.sbin/snmpd/mib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mib.c,v 1.59 2012/09/18 08:29:09 reyk Exp $ */ +/* $OpenBSD: mib.c,v 1.60 2012/09/20 20:11:58 yuo Exp $ */ /* * Copyright (c) 2012 Joel Knight <joel@openbsd.org> @@ -2580,7 +2580,8 @@ 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", "%RH", "Hz", "degree", "" + "", "", "%", "lx", "", "sec", "%RH", "Hz", "degree", + "mm", "Pa", "m/s^2", "" }; const char * @@ -2611,6 +2612,7 @@ mib_sensorvalue(struct sensor *s) case SENSOR_AMPHOUR: case SENSOR_LUX: case SENSOR_FREQ: + case SENSOR_ACCEL: ret = asprintf(&v, "%.2f", s->value / 1000000.0); break; case SENSOR_INDICATOR: @@ -2620,6 +2622,10 @@ mib_sensorvalue(struct sensor *s) case SENSOR_HUMIDITY: ret = asprintf(&v, "%.2f%%", s->value / 1000.0); break; + case SENSOR_DISTANCE: + case SENSOR_PRESSURE: + ret = asprintf(&v, "%.2f", s->value / 1000.0); + break; case SENSOR_TIMEDELTA: ret = asprintf(&v, "%.6f", s->value / 1000000000.0); break; |