diff --git a/ipmitool/lib/ipmi_hpmfwupg.c b/ipmitool/lib/ipmi_hpmfwupg.c index 881d762..48dd1e3 100644 --- a/ipmitool/lib/ipmi_hpmfwupg.c +++ b/ipmitool/lib/ipmi_hpmfwupg.c @@ -206,7 +206,7 @@ extern int verbose; static int errorCount; #define HPMFWUPG_IS_RETRYABLE(error) \ -((((error==0x83)||(error==0x82)) && (errorCount++targetCap.upgradeTimeout*5; + if ( verbose ) + printf("Use File Upgrade Capabilities: %i seconds\n", upgradeTimeout); } else { - upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT; + /* Try to retreive from Caps */ + struct HpmfwupgGetTargetUpgCapabilitiesCtx targetCapCmd; + + if(HpmfwupgGetTargetUpgCapabilities(intf, &targetCapCmd) != HPMFWUPG_SUCCESS) + { + upgradeTimeout = HPMFWUPG_DEFAULT_UPGRADE_TIMEOUT; + + if ( verbose ) + printf("Use default timeout: %i seconds\n", upgradeTimeout); + } + else + { + upgradeTimeout = (targetCapCmd.resp.upgradeTimeout * 5); + if ( verbose ) + printf("Use Command Upgrade Capabilities Timeout: %i seconds\n", upgradeTimeout); + } } - /* Poll upgrade status until completion or timeout*/ - timeoutSec1 = time(NULL); - timeoutSec2 = time(NULL); - rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx); - - while((upgStatusCmd.resp.lastCmdCompCode == HPMFWUPG_COMMAND_IN_PROGRESS ) && - (timeoutSec2 - timeoutSec1 < upgradeTimeout ) && - (rc == HPMFWUPG_SUCCESS) ) + if(rc == HPMFWUPG_SUCCESS) { - /* Must wait at least 100 ms between status requests */ - usleep(100000); + /* Poll upgrade status until completion or timeout*/ + timeoutSec1 = time(NULL); timeoutSec2 = time(NULL); rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx); } + while( + (upgStatusCmd.resp.lastCmdCompCode == HPMFWUPG_COMMAND_IN_PROGRESS ) && + (timeoutSec2 - timeoutSec1 < upgradeTimeout ) && + (rc == HPMFWUPG_SUCCESS) + ) + { + /* Must wait at least 1000 ms between status requests */ + usleep(1000000); + rc = HpmfwupgGetUpgradeStatus(intf, &upgStatusCmd, pFwupgCtx); + //printf("Get Status: %x - %x = %x _ %x [%x]\n", timeoutSec2, timeoutSec1,(timeoutSec2 - timeoutSec1),upgradeTimeout, rc); + } + if ( upgStatusCmd.resp.lastCmdCompCode != 0x00 ) { if ( verbose )