ID: 70 - Fixes and updates for ipmitool hpm

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 | ---.-- -------- |
--------------------------------------------------------

Commit for Dan Gora
This commit is contained in:
Zdenek Styblik 2013-07-17 10:25:28 +00:00
parent 30e4efe8a4
commit 3bd53a2f78

View File

@ -1130,13 +1130,16 @@ void HpmDisplayLine(char *s, int n)
* Description: This function the displays the Upgrade header information * Description: This function the displays the Upgrade header information
* *
*****************************************************************************/ *****************************************************************************/
void HpmDisplayUpgradeHeader(int option) void HpmDisplayUpgradeHeader(void)
{ {
printf("\n"); printf("\n");
HpmDisplayLine("-",79 ); HpmDisplayLine("-",79 );
printf("|ID | Name | Versions | %% |\n"); printf(
printf("| | | Active | Backup | File | |\n"); "|ID | Name | Versions | %% |\n");
printf("|----|-----------|-----------------|-----------------|-----------------|------|\n"); printf(
"| | | Active | Backup | File | |\n");
printf(
"|----|-------------|-----------------|-----------------|-----------------|----|\n");
} }
/**************************************************************************** /****************************************************************************
@ -1163,15 +1166,16 @@ void HpmDisplayUpgrade( int skip, unsigned int totalSent,
if (percent != old_percent) if (percent != old_percent)
{ {
if ( percent == 0 ) printf(" 0%%|"); if ( percent == 0 ) printf(" 0%%|");
else if (percent == 100) printf("\b\b\b\b\b\b\b100 %% |\n"); else if (percent == 100) printf("\b\b\b\b\b100%%|\n");
else printf("\b\b\b\b\b\b\b%3d %% |", percent); else printf("\b\b\b\b\b%3d%%|", percent);
old_percent = percent; old_percent = percent;
} }
if (totalSent== displayFWLength) if (totalSent== displayFWLength)
{ {
/* Display the time taken to complete the upgrade */ /* 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); timeElapsed/60,timeElapsed%60,totalSent);
} }
} }
@ -1187,17 +1191,17 @@ void HpmDisplayVersionHeader(int mode)
{ {
if ( mode & IMAGE_VER) if ( mode & IMAGE_VER)
{ {
HpmDisplayLine("-",72 ); HpmDisplayLine("-",74 );
printf("|ID | Name | Versions |\n"); printf("|ID | Name | Versions |\n");
printf("| | | Active | Backup | File |\n"); printf("| | | Active | Backup | File |\n");
HpmDisplayLine("-",72 ); HpmDisplayLine("-",74 );
} }
else else
{ {
HpmDisplayLine("-",54 ); HpmDisplayLine("-",56 );
printf("|ID | Name | Versions |\n"); printf("|ID | Name | Versions |\n");
printf("| | | Active | Backup |\n"); printf("| | | Active | Backup |\n");
HpmDisplayLine("-",54 ); HpmDisplayLine("-",56 );
} }
} }
@ -1210,19 +1214,20 @@ void HpmDisplayVersionHeader(int mode)
*****************************************************************************/ *****************************************************************************/
void HpmDisplayVersion(int mode, VERSIONINFO *pVersion, int upgradable) void HpmDisplayVersion(int mode, VERSIONINFO *pVersion, int upgradable)
{ {
char descString[12]; char descString[16];
memset(&descString,0x00,12);
memset(&descString,0x00,sizeof(descString));
/* /*
* Added this to ensure that even if the description string * Added this to ensure that even if the description string
* is more than required it does not give problem in displaying it * 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 * If the cold reset is required then we can display * on it
* so that user is aware that he needs to do payload power * so that user is aware that he needs to do payload power
* cycle after upgrade * cycle after upgrade
*/ */
printf("|%c%c%2d|%-11s|", printf("|%c%c%2d|%-13s|",
pVersion->coldResetRequired?'*':' ', pVersion->coldResetRequired?'*':' ',
upgradable ? '^': ' ', upgradable ? '^': ' ',
pVersion->componentId,descString); pVersion->componentId,descString);
@ -1422,12 +1427,9 @@ int HpmfwupgTargetCheck(struct ipmi_intf * intf, int option)
if (option & VIEW_MODE) if (option & VIEW_MODE)
{ {
HpmDisplayLine("-",53 ); HpmDisplayLine("-",56 );
if (flagColdReset)
{
fflush(stdout); fflush(stdout);
lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset");
}
printf("\n\n"); printf("\n\n");
} }
return HPMFWUPG_SUCCESS; return HPMFWUPG_SUCCESS;
@ -2035,13 +2037,11 @@ int HpmfwupgPreUpgradeCheck(struct ipmi_intf *intf,
} }
if (option & VIEW_MODE) { if (option & VIEW_MODE) {
HpmDisplayLine("-",72); HpmDisplayLine("-",74);
if (flagColdReset) {
fflush(stdout); fflush(stdout);
lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset");
lprintf(LOG_NOTICE,"(^) Indicates component would be upgraded"); lprintf(LOG_NOTICE,"(^) Indicates component would be upgraded");
} }
}
return HPMFWUPG_SUCCESS; return HPMFWUPG_SUCCESS;
} }
@ -2078,7 +2078,7 @@ int HpmfwupgUpgradeStage(struct ipmi_intf *intf, struct HpmfwupgUpgradeCtx* pFwu
if (option & VERSIONCHECK_MODE || option & FORCE_MODE) if (option & VERSIONCHECK_MODE || option & FORCE_MODE)
{ {
HpmDisplayUpgradeHeader(0); HpmDisplayUpgradeHeader();
} }
/* Perform actions defined in the image */ /* Perform actions defined in the image */
@ -2176,13 +2176,11 @@ int HpmfwupgUpgradeStage(struct ipmi_intf *intf, struct HpmfwupgUpgradeCtx* pFwu
} }
} }
HpmDisplayLine("-",78); HpmDisplayLine("-",79);
if (flagColdReset)
{
fflush(stdout); fflush(stdout);
lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset"); lprintf(LOG_NOTICE,"(*) Component requires Payload Cold Reset");
}
return rc; return rc;
} }