Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/openseachest_util_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -1082,11 +1082,13 @@ extern "C"
#define SET_POWER_CONSUMPTION_VALUE powerConsumptionIdentifierValue
#define SET_POWER_CONSUMPTION_WATTS_VALUE powerConsumptionWatts
#define SET_POWER_CONSUMPTION_DEFAULT_FLAG setDefaultPowerConsumption
#define SET_POWER_CONSUMPTION_DISABLED_FLAG setDisabledPowerConsumption
#define SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE powerConsumptionActiveLevel
#define SET_POWER_CONSUMPTION_VARS \
bool SET_POWER_CONSUMPTION_FLAG = false; \
uint8_t SET_POWER_CONSUMPTION_VALUE = UINT8_C(0); \
bool SET_POWER_CONSUMPTION_DEFAULT_FLAG = false; \
bool SET_POWER_CONSUMPTION_DISABLED_FLAG = false; \
uint8_t SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE = UINT8_C(0); \
double SET_POWER_CONSUMPTION_WATTS_VALUE = 0.0;
#define SET_POWER_CONSUMPTION_LONG_OPT_STRING "setPowerConsumption"
Expand Down
5 changes: 3 additions & 2 deletions src/openseachest_util_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ void print_Trim_Unmap_Range_Help(bool shortHelp)

void print_Show_Power_Consumption_Help(bool shortHelp)
{
printf("\t--%s\t(SAS Only)\n", SHOW_POWER_CONSUMPTION_LONG_OPT_STRING);
printf("\t--%s\n", SHOW_POWER_CONSUMPTION_LONG_OPT_STRING);
if (!shortHelp)
{
print_str("\t\tThis option will show the power consumption\n");
Expand All @@ -1660,7 +1660,7 @@ void print_Show_Power_Consumption_Help(bool shortHelp)

void print_Set_Power_Consumption_Help(bool shortHelp)
{
printf("\t--%s [default | highest | intermediate | lowest | watt value]\t(SAS Only) \n",
printf("\t--%s [default | highest | intermediate | lowest | disabled | watt value]\n",
SET_POWER_CONSUMPTION_LONG_OPT_STRING);
if (!shortHelp)
{
Expand All @@ -1671,6 +1671,7 @@ void print_Set_Power_Consumption_Help(bool shortHelp)
print_str("\t\t-highest - sets the active level to \"highest\"\n");
print_str("\t\t-intermediate - sets the active level to \"intermediate\"\n");
print_str("\t\t-lowest - sets the active level to \"lowest\"\n");
print_str("\t\t-disabled - sets power consumption control to disabled (SATA Only)\n");
print_str("\t\t-watt value - sets the device to a nearest watt value\n");
print_str("\t\tless than or equal to the value entered.\n");
print_str("\t\tPower consumption watt values are listed with the\n");
Expand Down
14 changes: 10 additions & 4 deletions utils/C/openSeaChest/openSeaChest_PowerControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ int main(int argc, char* argv[])
{
SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE = 3;
}
else if (strcmp(optarg, "disabled") == 0)
{
SET_POWER_CONSUMPTION_DISABLED_FLAG = true;
}
else
{
if (!get_And_Validate_Double_Input(optarg, M_NULLPTR, ALLOW_UNIT_NONE,
Expand Down Expand Up @@ -2509,15 +2513,17 @@ int main(int argc, char* argv[])
if (SET_POWER_CONSUMPTION_FLAG)
{
eReturnValues pcRet = SUCCESS;
if (SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE == PC_ACTIVE_LEVEL_IDENTIFIER)
if (!SET_POWER_CONSUMPTION_DEFAULT_FLAG && !SET_POWER_CONSUMPTION_DISABLED_FLAG &&
SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE == PC_ACTIVE_LEVEL_IDENTIFIER)
{
pcRet = map_Watt_Value_To_Power_Consumption_Identifier(
&deviceList[deviceIter], SET_POWER_CONSUMPTION_WATTS_VALUE, &SET_POWER_CONSUMPTION_VALUE);
}
if (pcRet == SUCCESS)
{
switch (set_Power_Consumption(&deviceList[deviceIter], SET_POWER_CONSUMPTION_ACTIVE_LEVEL_VALUE,
SET_POWER_CONSUMPTION_VALUE, SET_POWER_CONSUMPTION_DEFAULT_FLAG, false))
SET_POWER_CONSUMPTION_VALUE, SET_POWER_CONSUMPTION_DEFAULT_FLAG,
SET_POWER_CONSUMPTION_DISABLED_FLAG))
{
case SUCCESS:
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -3291,6 +3297,8 @@ void utility_Usage(bool shortUsage)
print_Standby_Y_Help(shortUsage);
print_Standby_Z_Help(shortUsage);
print_Transition_Power_Help(shortUsage);
print_Set_Power_Consumption_Help(shortUsage);
print_Show_Power_Consumption_Help(shortUsage);

// SATA Only Options
print_str("\n\tSATA Only:\n\t=========\n");
Expand All @@ -3306,8 +3314,6 @@ void utility_Usage(bool shortUsage)
print_SAS_Phy_Help(shortUsage);
print_SAS_Phy_Partial_Help(shortUsage);
print_SAS_Phy_Slumber_Help(shortUsage);
print_Set_Power_Consumption_Help(shortUsage);
print_Show_Power_Consumption_Help(shortUsage);
// NVMe Only
print_str("\n\tNVMe Only:\n\t=========\n");
print_Show_NVM_Power_States_Help(shortUsage);
Expand Down
Loading