diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ievents.c | 4 | ||||
-rw-r--r-- | util/ipmiutil.c | 2 | ||||
-rw-r--r-- | util/isensor.c | 16 | ||||
-rw-r--r-- | util/isensor.h | 2 | ||||
-rw-r--r-- | util/oem_hp.c | 101 |
5 files changed, 75 insertions, 50 deletions
diff --git a/util/ievents.c b/util/ievents.c index 3958138..4053eab 100644 --- a/util/ievents.c +++ b/util/ievents.c @@ -80,7 +80,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern char *progver; /*from ipmiutil.c*/ static char * progname = "ipmiutil events"; #else -static char *progver = "3.12"; +static char *progver = "3.13"; static char *progname = "ievents"; #endif static char fsensdesc = 0; /* 1= get extended sensor descriptions*/ @@ -1268,7 +1268,7 @@ int get_sensor_tag(int isdr, int genid, uchar snum, char *tag, rv = ERR_NOT_FOUND; /*got tag, but did not get SDR*/ } } - if (rv != 0) strcpy(tag,"na"); + if (rv != 0) strcpy(tag,"na "); if (fdebug) printf("get_sensor_tag(%d): find_sdr(%x,%x) rv=%d tag=/%s/\n", fsensdesc,snum,genid,rv,tag); return(rv); diff --git a/util/ipmiutil.c b/util/ipmiutil.c index 20ce7c3..6cbdf76 100644 --- a/util/ipmiutil.c +++ b/util/ipmiutil.c @@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ipmiutil.h" static char *progname = "ipmiutil"; -char *progver = "3.12"; +char *progver = "3.13"; // static char fdebug = 0; /*int ipmiutil(int argc, char **argv); */ diff --git a/util/isensor.c b/util/isensor.c index 8bb2935..df4a911 100644 --- a/util/isensor.c +++ b/util/isensor.c @@ -2635,11 +2635,11 @@ ShowSDR(char *tag, uchar *sdr) memcpy(idstr,&sdr[ioff],ilen); for (i=ilen; i<16; i++) { idstr[i] = ' '; ilen++; } idstr[ilen] = 0; /* stringify */ - if ((sdr01->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/ - else brearm = 'a'; /*automatic rearm*/ + if ((sdr01->sens_capab & 0x40) == 0) brearm = 'm'; /*manual rearm*/ + else brearm = 'a'; /*automatic rearm*/ if (fdebug) printf("entity %d.%d, idlen=%d sizeof=%lu idstr0=%c s0=%x\n", - sdr01->entity_id, sdr01->entity_inst, - ilen,sizeof(SDR01REC),idstr[0],sdr[ioff]); + sdr01->entity_id, sdr01->entity_inst, + ilen,sizeof(SDR01REC),idstr[0],sdr[ioff]); rc = GetSensorReading(sdr01->sens_num,sdr01,sens); if (rc != 0) { /* if rc != 0, leave sens values zero */ i = 41; /* Unknown */ @@ -2662,8 +2662,8 @@ ShowSDR(char *tag, uchar *sdr) sdr01->sens_num); } else val = RawToFloat(sens[0],sdr); - typestr = get_unit_type(sdr01->sens_units, sdr01->sens_base, - sdr01->sens_mod, fsimple); + typestr = get_unit_type(sdr01->sens_units, sdr01->sens_base, + sdr01->sens_mod, fsimple); #ifdef WRONG if (is_romley(vend_id,prod_id) && (sdr01->sens_type == 0x0C) && (sdr01->sens_units & 0x01)) @@ -2683,11 +2683,11 @@ ShowSDR(char *tag, uchar *sdr) else snprintf(rdgstr,sizeof(rdgstr),"%02x %s %.2f %s", sens[0], sensor_dstatus[i],val,typestr); - } + } sep[0] = 0; /*null string*/ printf("%s", tag); if (fsimple) { - sprintf(sep,"%c ",bdelim); + sprintf(sep,"%c ",bdelim); printf("%04x %c Full %c %s %c %02x %c %s %c %s%c", sdr01->recid, bdelim, bdelim, get_stype_str(sdr01->sens_type), diff --git a/util/isensor.h b/util/isensor.h index f578274..d08a0a8 100644 --- a/util/isensor.h +++ b/util/isensor.h @@ -155,6 +155,8 @@ void ShowSDR(char *tag, uchar *sdr); int GetSDRRepositoryInfo(int *nret, int *fdev); int GetSensorThresholds(uchar sens_num, uchar *data); int GetSensorReading(uchar sens_num, void *psdr, uchar *sens_data); +int GetSensorReadingFactors(uchar snum, uchar raw, int *m, int *b, int * b_exp, + int *r, int *a); double RawToFloat(uchar raw, uchar *psdr); char *decode_entity_id(int id); char *get_unit_type(int iunits, int ibase, int imod, int fshort); diff --git a/util/oem_hp.c b/util/oem_hp.c index f551176..98ba86e 100644 --- a/util/oem_hp.c +++ b/util/oem_hp.c @@ -48,7 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. extern char * progver; /*from ipmiutil.c*/ static char * progname = "ipmiutil hpoem"; #else -static char * progver = "3.08"; +static char * progver = "3.13"; static char * progname = "ihpoem"; #endif @@ -81,6 +81,11 @@ int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring, int slen) char *pstr = NULL; uchar stype, evtype, b; ushort v; + int analog = 0; + int fshort = 1; + double val; + char *typestr = NULL; + SDR01REC *sdr01 = (SDR01REC *)sdr; if (sdr == NULL || reading == NULL) return(rv); if (pstring == NULL || slen == 0) return(rv); @@ -92,8 +97,8 @@ int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring, int slen) rv = 0; } else { #ifdef OLD - int vend, prod; - get_mfgid(&vend,&prod); + int vend, prod; + get_mfgid(&vend,&prod); /* This was an anomaly for an older HP DL380 but is no longer valid */ if ((prod == 0x2000) && ((reading[2] & 0x40) == 0x40)) { /*custom Init/Unavail state if DL380*/ @@ -101,48 +106,66 @@ int decode_sensor_hp(uchar *sdr,uchar *reading,char *pstring, int slen) rv = 0; } else #endif + /* HP has packed analog readings into some of their non-Threshold sensors + * so we have to handle that. */ + if (sdr[3] == 0x01) { /*only full sensors can be analog*/ + if (evtype == 0x01) analog = 1; /*threshold*/ + else { /*if units are defined, assume analog reading */ + if ((sdr01->sens_units & 0x07) != 0) analog = 1; + if (sdr01->sens_base != 0) analog = 1; + if (sdr01->sens_mod != 0) analog = 1; + } + if ((reading[1] & 0x20) != 0) analog = 0; /*Init state, no analog*/ + else if (sdr01->sens_units == 0xC0) analog = 0; /*reading NotAvailable*/ + else if (reading[2] == 0xc7) analog = 0; /* Absent (Intel) */ + } if (evtype == 0x6f) { /*evtype==0x6f special*/ - pstr = "DiscreteEvt"; - if (stype == 0x08) { /*Power Supply presence*/ - if (reading[2] & 0x01) pstr = "Present"; - else pstr = "Absent"; - } - snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); - rv = 0; + pstr = "DiscreteEvt"; + if (stype == 0x08) { /*Power Supply presence*/ + if (reading[2] & 0x01) pstr = "Present"; + else pstr = "Absent"; + } + rv = 0; } else if (evtype == 0x0B) { /*Redundancy*/ - b = reading[2] & 0x3f; - pstr = "DiscretePS"; /*Power Supplies*/ - if (evtype == 0x0b) pstr = redund_str(b); - snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); - rv = 0; + b = reading[2] & 0x3f; + pstr = "DiscretePS"; /*Power Supplies*/ + if (evtype == 0x0b) pstr = redund_str(b); + rv = 0; } else if (evtype == 0x0A) { /*Discrete Fan*/ - v = reading[2] + (reading[3] & 0x3f); - if (v & 0x001) pstr = "Transition to Running"; - else if (v & 0x002) pstr = "Transition to In Test"; - else if (v & 0x004) pstr = "Transition to Power Off"; - else if (v & 0x008) pstr = "Transition to On Line"; - else if (v & 0x010) pstr = "Transition to Off Line"; - else if (v & 0x020) pstr = "Transition to Off Duty"; - else if (v & 0x040) pstr = "Transition to Degraded"; - else if (v & 0x080) pstr = "Transition to Power"; - else if (v & 0x100) pstr = "Install Error"; - else pstr = "Unknown"; - snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); - rv = 0; + v = reading[2] + (reading[3] & 0x3f); + if (v & 0x001) pstr = "Transition to Running"; + else if (v & 0x002) pstr = "Transition to In Test"; + else if (v & 0x004) pstr = "Transition to Power Off"; + else if (v & 0x008) pstr = "Transition to On Line"; + else if (v & 0x010) pstr = "Transition to Off Line"; + else if (v & 0x020) pstr = "Transition to Off Duty"; + else if (v & 0x040) pstr = "Transition to Degraded"; + else if (v & 0x080) pstr = "Transition to Power"; + else if (v & 0x100) pstr = "Install Error"; + else pstr = "Unknown"; + rv = 0; } else if (evtype == 0x09) { /* stype==0x03 Power Meter */ - b = reading[2] & 0x3f; - if (b & 0x01) pstr = "Disabled"; - else if (b & 0x02) pstr = "Enabled"; - else pstr = "Unknown"; - snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); - rv = 0; + b = reading[2] & 0x3f; + if (b & 0x01) pstr = "Disabled"; + else if (b & 0x02) pstr = "Enabled"; + else pstr = "Unknown"; + rv = 0; } else if ((sdr[20] & 0xC0) == 0xC0) { /*unit1==discrete*/ - b = reading[2] & 0x3f; - pstr = "DiscreteUnit"; - if (evtype == 0x0b) pstr = redund_str(b); - snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); - rv = 0; + b = reading[2] & 0x3f; + pstr = "DiscreteUnit"; + if (evtype == 0x0b) pstr = redund_str(b); + rv = 0; } + if (rv == 0) { + if (analog == 1) { + val = RawToFloat(reading[0],sdr); + typestr = get_unit_type(sdr01->sens_units, sdr01->sens_base, + sdr01->sens_mod, fshort); + snprintf(pstring,slen,"%.2f %s, %s",val,typestr,pstr); + } else { + snprintf(pstring,slen,"%02x%02x %s",reading[3],reading[2],pstr); + } + } } return(rv); } |