From 97d6a2e491c6ed08473beb2c4bac47c5cbc1201a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 20 Feb 2016 02:12:40 +0100 Subject: Imported Upstream version 1.8.16 --- lib/ipmi_sensor.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'lib/ipmi_sensor.c') diff --git a/lib/ipmi_sensor.c b/lib/ipmi_sensor.c index c138c67..063dfb0 100644 --- a/lib/ipmi_sensor.c +++ b/lib/ipmi_sensor.c @@ -1,21 +1,21 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -52,8 +52,8 @@ void print_sensor_thresh_usage(); // static int ipmi_sensor_get_sensor_reading_factors( - struct ipmi_intf * intf, - struct sdr_record_full_sensor * sensor, + struct ipmi_intf * intf, + struct sdr_record_full_sensor * sensor, uint8_t reading) { struct ipmi_rq req; @@ -88,9 +88,9 @@ ipmi_sensor_get_sensor_reading_factors( return -1; } else { /* Update SDR copy with updated Reading Factors for this reading */ - /* Note: - * The Format of the returned data is exactly as in the SDR definition (Little Endian Format), - * therefore we can use raw copy operation here. + /* Note: + * The Format of the returned data is exactly as in the SDR definition (Little Endian Format), + * therefore we can use raw copy operation here. * Note: rsp->data[0] would point to the next valid entry in the sampling table */ // BUGBUG: uses 'hardcoded' length information from SDR Definition @@ -160,7 +160,6 @@ ipmi_sensor_print_fc_discrete(struct ipmi_intf *intf, struct sdr_record_common_sensor *sensor, uint8_t sdr_record_type) { - const char *id; struct sensor_reading *sr; sr = ipmi_sdr_read_sensor_value(intf, sensor, sdr_record_type, 3); @@ -892,8 +891,20 @@ ipmi_sensor_get(struct ipmi_intf *intf, int argc, char **argv) /* need to set verbose level to 1 */ v = verbose; verbose = 1; - if (ipmi_sdr_print_listentry(intf, sdr) < 0) { - rc = (-1); + switch (sdr->type) { + case SDR_RECORD_TYPE_FULL_SENSOR: + case SDR_RECORD_TYPE_COMPACT_SENSOR: + if (ipmi_sensor_print_fc(intf, + (struct sdr_record_common_sensor *) sdr->record.common, + sdr->type)) { + rc = -1; + } + break; + default: + if (ipmi_sdr_print_listentry(intf, sdr) < 0) { + rc = (-1); + } + break; } verbose = v; sdr = NULL; -- cgit v1.2.3