Add two additional chars to the component name string. For the default Pigeon Point firmware names we need a couple of extra chars to actually be able to tell what component is which.
Before: ----------------------------------------------------- |ID | Name | Versions | | | | Active | Backup | ----------------------------------------------------- |*0 |H8S-AMCc F/| 2.00 10000000 | 2.00 0F000000 | | 1 |H8S-AMCc B/| 2.00 00000000 | ---.-- -------- | | 2 |H8S-AMCc F/| 2.00 10000000 | ---.-- -------- | ----------------------------------------------------- After: -------------------------------------------------------- |ID | Name | Versions | | | | Active | Backup | -------------------------------------------------------- |* 0|H8S-AMCc F/W | 2.00 10000000 | 2.00 0F000000 | | 1|H8S-AMCc B/L | 2.00 00000000 | ---.-- -------- | | 2|H8S-AMCc F/I | 2.00 10000000 | ---.-- -------- | -------------------------------------------------------- Signed-off-by: Dan Gora <d...@adax.com> --- ipmitool/lib/ipmi_hpmfwupg.c | 78 ++++++++++++++++++++--------------------- 1 files changed, 38 insertions(+), 40 deletions(-) diff --git a/ipmitool/lib/ipmi_hpmfwupg.c b/ipmitool/lib/ipmi_hpmfwupg.c index 4c17530..bc0bddc 100644 --- a/ipmitool/lib/ipmi_hpmfwupg.c +++ b/ipmitool/lib/ipmi_hpmfwupg.c @@ -1130,13 +1130,16 @@ void HpmDisplayLine(char *s, int n) * Description: This function the displays the Upgrade header information * *****************************************************************************/ -void HpmDisplayUpgradeHeader(int option) +void HpmDisplayUpgradeHeader(void) { printf("\n"); HpmDisplayLine("-",79 ); - printf("|ID | Name | Versions | %% |\n"); - printf("| | | Active | Backup | File | |\n"); - printf("|----|-----------|-----------------|-----------------|-----------------|------|\n"); + printf( + "|ID | Name | Versions | %% |\n"); + printf( + "| | | Active | Backup | File | |\n"); + printf( + "|----|-------------|-----------------|-----------------|-----------------|----|\n"); } /**************************************************************************** @@ -1154,7 +1157,7 @@ void HpmDisplayUpgrade( int skip, unsigned int totalSent, static int old_percent=1; if (skip) { - printf(" Skip |\n"); + printf("Skip|\n"); return; } fflush(stdout); @@ -1162,16 +1165,17 @@ void HpmDisplayUpgrade( int skip, unsigned int totalSent, percent = ((float)totalSent/displayFWLength)*100; if (percent != old_percent) { - if ( percent == 0 ) printf(" 0 %% |"); - else if (percent == 100) printf("\b\b\b\b\b\b\b100 %% |\n"); - else printf("\b\b\b\b\b\b\b%3d %% |", percent); + if ( percent == 0 ) printf(" 0%%|"); + else if (percent == 100) printf("\b\b\b\b\b100%%|\n"); + else printf("\b\b\b\b\b%3d%%|", percent); old_percent = percent; } if (totalSent== displayFWLength) { /* Display the time taken to complete the upgrade */ - printf("| | Upload Time: %02ld.%02ld | Image Size: %05x |\n", + printf( + "| |Upload Time: %02ld:%02ld | Image Size: %05x |\n", timeElapsed/60,timeElapsed%60,totalSent); } } @@ -1187,17 +1191,17 @@ void HpmDisplayVersionHeader(int mode) { if ( mode & IMAGE_VER) { - HpmDisplayLine("-",72 ); - printf("|ID | Name | Versions |\n"); - printf("| | | Active | Backup | File |\n"); - HpmDisplayLine("-",72 ); + HpmDisplayLine("-",74 ); + printf("|ID | Name | Versions |\n"); + printf("| | | Active | Backup | File |\n"); + HpmDisplayLine("-",74 ); } else { - HpmDisplayLine("-",54 ); - printf("|ID | Name | Versions |\n"); - printf("| | | Active | Backup |\n"); - HpmDisplayLine("-",54 ); + HpmDisplayLine("-",56 ); + printf("|ID | Name | Versions |\n"); + printf("| | | Active | Backup |\n"); + HpmDisplayLine("-",56 ); } } @@ -1210,19 +1214,20 @@ void HpmDisplayVersionHeader(int mode) *****************************************************************************/ void HpmDisplayVersion(int mode, VERSIONINFO *pVersion, int upgradable) { - char descString[12]; - memset(&descString,0x00,12); + char descString[16]; + + memset(&descString,0x00,sizeof(descString)); /* * Added this to ensure that even if the description string * is more than required it does not give problem in displaying it */ - strncpy(descString,pVersion->descString,11); + strncpy(descString,pVersion->descString,13); /* * If the cold reset is required then we can display * on it * so that user is aware that he needs to do payload power * cycle after upgrade */ - printf("|%c%c%2d|%-11s|", + printf("|%c%c%2d|%-13s|", pVersion->coldResetRequired?'*':' ', upgradable ? '^': ' ', pVersion->componentId,descString); @@ -1422,12 +1427,9 @@ int HpmfwupgTargetCheck(struct ipmi_intf * intf, int option) if (option & VIEW_MODE) { - HpmDisplayLine("-",53 ); - if (flagColdReset) - { - fflush(stdout); - lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); - } + HpmDisplayLine("-",56 ); + fflush(stdout); + lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); printf("\n\n"); } return HPMFWUPG_SUCCESS; @@ -2030,12 +2032,10 @@ int HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf, } if (option & VIEW_MODE) { - HpmDisplayLine("-",72); - if (flagColdReset) { - fflush(stdout); - lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); - lprintf(LOG_NOTICE,"(^) Indicates component would be upgraded"); - } + HpmDisplayLine("-",74); + fflush(stdout); + lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); + lprintf(LOG_NOTICE,"(^) Indicates component would be upgraded"); } return HPMFWUPG_SUCCESS; } @@ -2073,7 +2073,7 @@ int HpmfwupgUpgradeStage(struct ipmi_intf *intf, struct HpmfwupgUpgradeCtx* pFwu if (option & VERSIONCHECK_MODE || option & FORCE_MODE) { - HpmDisplayUpgradeHeader(0); + HpmDisplayUpgradeHeader(); } /* Perform actions defined in the image */ @@ -2171,13 +2171,11 @@ int HpmfwupgUpgradeStage(struct ipmi_intf *intf, struct HpmfwupgUpgradeCtx* pFwu } } - HpmDisplayLine("-",78); + HpmDisplayLine("-",79); + + fflush(stdout); + lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); - if (flagColdReset) - { - fflush(stdout); - lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); - } return rc; } -- 1.7.7 ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel