summaryrefslogtreecommitdiff
path: root/util/oem_lenovo.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-02-24 21:18:20 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-02-24 21:18:20 +0100
commit7a40b1039a0cef3c47c75260f47aba0548c1cdbb (patch)
tree9cc82aefd88f309aea07c58dbd6056922bdbea9c /util/oem_lenovo.c
parentf504e2f8269ff2f133f0700c8ad03ad4f05df49a (diff)
parente6806f1d217e07f52759e4fa1c792d1fe02f0d50 (diff)
Merge tag 'upstream/3.0.2'
Upstream version 3.0.2
Diffstat (limited to 'util/oem_lenovo.c')
-rw-r--r--util/oem_lenovo.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/util/oem_lenovo.c b/util/oem_lenovo.c
index 9c5079f..a1162bb 100644
--- a/util/oem_lenovo.c
+++ b/util/oem_lenovo.c
@@ -57,12 +57,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ievents.h"
#include "oem_lenovo.h"
+extern uchar bitnum(ushort value); /*isensor.c*/
+extern char fdebug; /*ipmicmd.c*/
void set_loglevel(int level); /*prototype */
-static char * progver = "3.01";
+static char * progver = "3.02";
static char * progname = "ioemlenovo";
static int verbose = 0;
-static char fdebug = 0;
static uchar g_bus = PUBLIC_BUS;
static uchar g_sa = BMC_SA;
static uchar g_lun = BMC_LUN;
@@ -70,7 +71,6 @@ static uchar g_addrtype = ADDR_SMI;
static int vend_id = 0;
static int prod_id = 0;
-extern uchar bitnum(ushort value); /*isensor.c*/
/*
* decode_sensor_lenovo
@@ -116,7 +116,18 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
case 0x08: pstr = "Disabled"; break;
default: pstr = "OK*"; break;
}
- snprintf(pstring,slen,"%04x %s",bval,pstr);
+ rv = 0;
+ }
+ break;
+ case 0x0D: /* Disk Drive slots */
+ if (etype == 0x6F) {
+ switch(bval) {
+ case 0x00: pstr = "Absent"; break;
+ case 0x01: pstr = "Present"; break;
+ case 0x21: pstr = "NotRedundant"; break;
+ case 0x40: pstr = "NotAvailable"; break; /*not initialized*/
+ default: pstr = "Faulty"; break; /*e.g. 0x03*/
+ }
rv = 0;
}
break;
@@ -126,7 +137,6 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
else if (bval & 0x01) pstr = "FirmwareError"; /*bit 0*/
else if ((bval & 0x02) != 0) pstr = "FirmwareHang"; /*bit 1*/
else pstr = "OK*";
- snprintf(pstring,slen,"%04x %s",bval,pstr);
rv = 0;
}
break;
@@ -138,7 +148,6 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
case 0x02: pstr = "CableError"; break;
default: pstr = "OK*"; break;
}
- snprintf(pstring,slen,"%04x %s",rval,pstr);
rv = 0;
}
break;
@@ -148,14 +157,12 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
case 0x00: pstr = "OK"; break; /*No Media*/
default: pstr = "Asserted"; break;
}
- snprintf(pstring,slen,"%04x %s",rval,pstr);
rv = 0;
}
case 0x21: /*All PCI Error, PCI 1, Internal RAID, No Op ROM, etc.*/
if (etype == 0x6F) {
if (bval == 0x00) pstr = "OK";
else pstr = "Fault";
- snprintf(pstring,slen,"%04x %s",bval,pstr);
rv = 0;
}
break;
@@ -180,7 +187,6 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
case 0x07: pstr = "ChangedOK"; break; /*entity 21,22*/
default: pstr = "_"; break;
}
- snprintf(pstring,slen,"%04x %s",rval,pstr);
rv = 0;
}
break;
@@ -188,7 +194,6 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
if (etype == 0x07) {
if ((bval & 0x04) != 0) pstr = "Faulty";
else pstr = "OK";
- snprintf(pstring,slen,"%04x %s",bval,pstr);
rv = 0;
}
break;
@@ -196,12 +201,12 @@ int decode_sensor_lenovo(uchar *sdr,uchar *reading,char *pstring, int slen)
if (etype == 0x08) {
if ((bval & 0x02) != 0) pstr = "Faulty";
else pstr = "OK";
- snprintf(pstring,slen,"%04x %s",bval,pstr);
rv = 0;
}
break;
default: break;
}
+ if (rv == 0) snprintf(pstring,slen,"%s",pstr);
// if (rv == 0) strncpy(pstring, pstr, slen);
return(rv);
}