Hi Anton,
I made few changes to the patch and now it doesn’t need any buffer to store the
power states now. Also not required to modify the Structures.
Let me know if you have any comments on this patch.
Below is the Patch:
Index: clients/hpipower.c
===================================================================
--- clients/hpipower.c (revision 7526)
+++ clients/hpipower.c (working copy)
@@ -299,18 +299,36 @@
if (Action <= SAHPI_POWER_CYCLE)
{
+ PowerState = 0;
+ Status = saHpiResourcePowerStateGet(SessionId,
+ ComputerPtr->ResID,
+ &PowerState);
+ if (Status != SA_OK)
+ {
+ printf("%s does not support
PowerStateGet",ComputerPtr->NameStr);
+ }
+ if (Action == PowerState)
+ {
+ printf("\n%s -- %20s is already powered
%s\n",argv[0],
+
ComputerPtr->NameStr,
+
PowerStateString[Action]);
+ }
+ else
+ {
+
HPI_POWER_DEBUG_PRINT("Setting a New Power State");
// Set the new power status for this computer
Status = saHpiResourcePowerStateSet(SessionId,
ComputerPtr->ResID,
Action);
- /* return status */
- if (Status == SA_OK)
- {
- printf("\n%s -- %20s has been successfully
powered %s\n",
- argv[0],
- ComputerPtr->NameStr,
- PowerStateString[Action]);
+ /* return status */
+ if (Status == SA_OK)
+ {
+ printf("\n%s -- %20s has been
successfully powered %s\n",
+ argv[0],
+ ComputerPtr->NameStr,
+ PowerStateString[Action]);
+ }
}
}
else // Report Power status for the system
Thanks& Regards,
Hemantha Reddy
-----Original Message-----
From: Anton Pak [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 12:50 PM
To: [email protected]; Beecherla, Hemantha
Subject: Re: [Openhpi-devel] Patch review request for modifications in
hpiclient code to fix the issue: 3425850 - hpipower command is misleading the
user
Hello Hemantha,
I have to say to current hpipower code is very misleading too. :)
See you are creating an array of 16 power states.
What about extending the COMPUTER_DATA struct to store current power state?
Anton Pak
On Tue, 19 Feb 2013 23:34:19 +0400, Beecherla, Hemantha
<[email protected]> wrote:
> Hi All,
> Hpipower client code is modified in the attached patch to fix below
> issue,
> 3425850 - hpipower command is misleading the
> user<http://sourceforge.net/tracker/?func=detail&aid=3425850&group_id=
> 71730&atid=532251>
>
> Please review the patch and provide if any suggestion.
>
> Thank you very much in advance :).
>
> Regards,
> Hemantha Reddy
------------------------------------------------------------------------------
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_feb
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel