diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-24 05:56:41 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-24 05:56:41 +0200 |
commit | 2ae382d10a07feaed2d8e06ce078084ecaf1b447 (patch) | |
tree | b9c8c5ab3485c040b19443e4a573f48b9092d47d /util/ihealth.c | |
parent | 7d5dd1122da7acfca715242ec6cb6d1fd844691b (diff) | |
parent | db5e8f26947114f06480dd22b9db7e22e50ee133 (diff) |
Merge tag 'upstream/3.0.0'
Upstream version 3.0.0
Diffstat (limited to 'util/ihealth.c')
-rw-r--r-- | util/ihealth.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/util/ihealth.c b/util/ihealth.c index abc7fdb..1389ba2 100644 --- a/util/ihealth.c +++ b/util/ihealth.c @@ -82,7 +82,7 @@ extern int oem_supermicro_get_firmware_str(char *pstr, int sz); /*oem_supermicro * Global variables */ static char * progname = "ihealth"; -static char * progver = "2.99"; +static char * progver = "3.00"; static char fdebug = 0; static char fipmilan = 0; static char fcanonical = 0; @@ -135,6 +135,36 @@ int oem_get_health(char *pstr, int sz) return rv; } +char *getdmiprod(void) +{ + char *prod = ""; +#ifdef LINUX + static char dmiprod[32]; + char cmd[160]; + char *dmitmp = "/tmp/dmi.tmp"; + FILE *fp; + int rv, i; + if (fipmilan) return(prod); + sprintf(cmd,"dmidecode | grep -A6 \"^Base Board\" |grep 'Product Name' |cut -f2 -d':' |awk '{ print $1 }' >%s",dmitmp); + rv = system(cmd); + if (rv == 0) { + fp = fopen(dmitmp,"r"); + if (fp == NULL) rv = -1; + else { + if (fgets(dmiprod, sizeof(dmiprod), fp) == NULL) rv = -2; + else { + for (i=0; i<sizeof(dmiprod); i++) { + if (dmiprod[i] == '\n') { dmiprod[i] = '\0'; break; } + } + prod = dmiprod; + } + fclose(fp); + } + } +#endif + return(prod); +} + int get_lan_stats(uchar chan) { uchar idata[2]; @@ -616,7 +646,7 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec) case VENDOR_INTEL: /*=0x000157*/ if (do_hsc && (dtype == BMC)) /*if HSC option, also show extra*/ sprintf(extraver," (Boot %x.%x PIA %x.%x)", /*BMC extra*/ - devrec[11],devrec[12],devrec[13],devrec[14]); + devrec[11],devrec[12],devrec[13],devrec[14]); switch(prod) { /* show product names for some */ case 0x000C: prodstr = "(TSRLT2)"; /*SCB2*/ bChan = 7; break; @@ -649,15 +679,18 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec) fmBMC = 1; break; default: prodstr = ""; break; } - if (is_romley(mfg,prod)) { - intel_romley_desc(mfg,prod,&prodstr); - snprintf(prodoem,sizeof(prodoem),"(%s)",prodstr); - prodstr = prodoem; - do_me = 1; kcs_loops = URNLOOPS; - do_hsc = 1; /*the HSC is embedded, so not the same*/ + if (is_romley(mfg,prod)) { + intel_romley_desc(mfg,prod,&prodstr); + snprintf(prodoem,sizeof(prodoem),"(%s)",prodstr); + prodstr = prodoem; + do_me = 1; kcs_loops = URNLOOPS; + do_hsc = 1; /*the HSC is embedded, so not the same*/ sprintf(extraver,".%d (Boot %x.%x)", /*BMC extra*/ (devrec[13] + (devrec[14] << 8)),devrec[11],devrec[12]); - } + } + if (is_grantley(mfg,prod)) { + intel_grantley_desc(mfg,prod,&prodstr); + } break; case VENDOR_KONTRON: /*=0x003A98=15000.*/ i = devrec[11] + (devrec[12] << 8); @@ -757,6 +790,7 @@ void show_devid_all(int dtype, uchar *devrec, int sdevrec) prodstr = ""; break; } /*end switch(prod)*/ + if (prodstr == "") prodstr = getdmiprod(); if (kcs_loops != 0) set_max_kcs_loops(kcs_loops); } /*end-else BMC*/ |