Hello Jim,

patches are attached. There is one additional, which I already sent to
the list as https://sourceforge.net/mailarchive/message.php?msg_id=29341119

Thank you very much for your review!

Jan

On 06/04/2012 02:55 PM, Jim Mankovich wrote:
> Jan,
> 
> I reviewed your changes and they look good to me.
> 
> If you would like me to commit these changes to the cvs repository for you
> please send me  the patches as email attachments instead of inline email
> text.
> 
> The ipmitool delloem commands are available in distro packaged versions of
> ipmitool 1.8.11 .
> 
> Thanks,
> 
> -- Jim Mankovich | jm...@hp.com --
> 
> 
> On 5/31/2012 12:48 PM, Jan Safranek wrote:
>> On 05/31/2012 06:07 PM, Jim Mankovich wrote:
>>> Jan,
>>>
>>> What version of ipmitool source were all these patches created from,
>>> (TOB cvs or 1.8.11 or ...)?
>> It's against current cvs, as delloem command hasn't been part of any
>> release yet.
>>
>>> Have you completed all your testing of these changes?
>> Yes, the bigendian patch went through our QA, the others are relatively
>> simple and I tested them on my own.
>>
>>> Has anyone code reviewed your  changes?
>> Well, not yet.That's why I send them here.
>>
>> Jan
>>
>>> -- Jim Mankovich | jm...@hp.com --
>>>
>>>
>>> On 5/31/2012 4:35 AM, Jan Safranek wrote:
>>>> 'ipmitool dellem powermonitor' command should convert data from
>>>> network-format to the native one, otherwise it shows garbage on
>>>> ppc/ppc64
>>>> platform.
>>>>
>>>> Signed-off-by: Jan Safranek<jsafr...@redhat.com>
>>>> ---
>>>>
>>>>     lib/ipmi_delloem.c |   59
>>>> +++++++++++++++++++++++++++++++++++++++++++++++++++-
>>>>     1 files changed, 58 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
>>>> index b17a1ac..e9e17a0 100644
>>>> --- a/lib/ipmi_delloem.c
>>>> +++ b/lib/ipmi_delloem.c
>>>> @@ -3302,7 +3302,11 @@ static int ipmi_powermgmt(struct ipmi_intf*
>>>> intf)
>>>>             return -1;
>>>>         }
>>>>         bmctimeconvval=(uint32_t*)rsp->data;
>>>> +#if WORDS_BIGENDIAN
>>>> +    bmctimeconv=BSWAP_32(*bmctimeconvval);
>>>> +#else
>>>>         bmctimeconv=*bmctimeconvval;
>>>> +#endif
>>>>
>>>>         /* get powermanagement info*/
>>>>         req.msg.netfn = DELL_OEM_NETFN;
>>>> @@ -3335,7 +3339,15 @@ static int ipmi_powermgmt(struct ipmi_intf*
>>>> intf)
>>>>
>>>>
>>>>         pwrMonitorInfo = (IPMI_POWER_MONITOR*)rsp->data;
>>>> -
>>>> +#if WORDS_BIGENDIAN
>>>> +    cumStartTimeConv = BSWAP_32(pwrMonitorInfo->cumStartTime);
>>>> +    cumReadingConv = BSWAP_32(pwrMonitorInfo->cumReading);
>>>> +    maxPeakStartTimeConv = BSWAP_32(pwrMonitorInfo->maxPeakStartTime);
>>>> +    ampPeakTimeConv = BSWAP_32(pwrMonitorInfo->ampPeakTime);
>>>> +    ampReadingConv = BSWAP_16(pwrMonitorInfo->ampReading);
>>>> +    wattPeakTimeConv = BSWAP_32(pwrMonitorInfo->wattPeakTime);
>>>> +    wattReadingConv = BSWAP_16(pwrMonitorInfo->wattReading);
>>>> +#else
>>>>         cumStartTimeConv = pwrMonitorInfo->cumStartTime;
>>>>         cumReadingConv = pwrMonitorInfo->cumReading;
>>>>         maxPeakStartTimeConv = pwrMonitorInfo->maxPeakStartTime;
>>>> @@ -3343,6 +3355,7 @@ static int ipmi_powermgmt(struct ipmi_intf* intf)
>>>>         ampReadingConv = pwrMonitorInfo->ampReading;
>>>>         wattPeakTimeConv = pwrMonitorInfo->wattPeakTime;
>>>>         wattReadingConv = pwrMonitorInfo->wattReading;
>>>> +#endif
>>>>
>>>>         ipmi_time_to_str(cumStartTimeConv, cumStartTime);
>>>>
>>>> @@ -3528,6 +3541,10 @@ static int ipmi_get_power_headroom_command
>>>> (struct ipmi_intf * intf,uint8_t unit
>>>>             printf("power headroom  Data               : %x %x %x %x ",
>>>>             /*need to look into
>>>> */                                                                 
>>>> rsp->data[0], rsp->data[1], rsp->data[2], rsp->data[3]);
>>>>         powerheadroom= *(( POWER_HEADROOM *)rsp->data);
>>>> +#if WORDS_BIGENDIAN
>>>> +    powerheadroom.instheadroom = BSWAP_16(powerheadroom.instheadroom);
>>>> +    powerheadroom.peakheadroom = BSWAP_16(powerheadroom.peakheadroom);
>>>> +#endif
>>>>
>>>>         printf ("Headroom\n");
>>>>         printf ("Statistic                     Reading\n");
>>>> @@ -3685,6 +3702,11 @@ static int
>>>> ipmi_get_instan_power_consmpt_data(struct ipmi_intf* intf,
>>>>         }
>>>>
>>>>         * instpowerconsumptiondata = * (
>>>> (IPMI_INST_POWER_CONSUMPTION_DATA*) (rsp->data));
>>>> +#if WORDS_BIGENDIAN
>>>> +    instpowerconsumptiondata->instanpowerconsumption =
>>>> BSWAP_16(instpowerconsumptiondata->instanpowerconsumption);
>>>> +    instpowerconsumptiondata->instanApms =
>>>> BSWAP_16(instpowerconsumptiondata->instanApms);
>>>> +    instpowerconsumptiondata->resv1 =
>>>> BSWAP_16(instpowerconsumptiondata->resv1);
>>>> +#endif
>>>>
>>>>         return 0;
>>>>
>>>> @@ -3816,6 +3838,12 @@ static int
>>>> ipmi_get_avgpower_consmpt_history(struct ipmi_intf* intf,IPMI_AVGPOWE
>>>>         }
>>>>
>>>>         *pavgpower = *( (IPMI_AVGPOWER_CONSUMP_HISTORY*) rsp->data);
>>>> +#if WORDS_BIGENDIAN
>>>> +    pavgpower->lastminutepower = BSWAP_16(pavgpower->lastminutepower);
>>>> +    pavgpower->lasthourpower = BSWAP_16(pavgpower->lasthourpower);
>>>> +    pavgpower->lastdaypower = BSWAP_16(pavgpower->lastdaypower);
>>>> +    pavgpower->lastweakpower = BSWAP_16(pavgpower->lastweakpower);
>>>> +#endif
>>>>
>>>>         return 0;
>>>>     }
>>>> @@ -3882,6 +3910,16 @@ static int
>>>> ipmi_get_peakpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_
>>>>
>>>>         }
>>>>         *pstPeakpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
>>>> +#if WORDS_BIGENDIAN
>>>> +    pstPeakpower->lastminutepower =
>>>> BSWAP_16(pstPeakpower->lastminutepower);
>>>> +    pstPeakpower->lasthourpower =
>>>> BSWAP_16(pstPeakpower->lasthourpower);
>>>> +    pstPeakpower->lastdaypower = BSWAP_16(pstPeakpower->lastdaypower);
>>>> +    pstPeakpower->lastweakpower =
>>>> BSWAP_16(pstPeakpower->lastweakpower);
>>>> +    pstPeakpower->lastminutepowertime =
>>>> BSWAP_32(pstPeakpower->lastminutepowertime);
>>>> +    pstPeakpower->lasthourpowertime =
>>>> BSWAP_32(pstPeakpower->lasthourpowertime);
>>>> +    pstPeakpower->lastdaypowertime =
>>>> BSWAP_32(pstPeakpower->lastdaypowertime);
>>>> +    pstPeakpower->lastweekpowertime =
>>>> BSWAP_32(pstPeakpower->lastweekpowertime);
>>>> +#endif
>>>>         return 0;
>>>>     }
>>>>
>>>> @@ -3948,6 +3986,16 @@ static int
>>>> ipmi_get_minpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_C
>>>>
>>>>         }
>>>>         *pstMinpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
>>>> +#if WORDS_BIGENDIAN
>>>> +    pstMinpower->lastminutepower =
>>>> BSWAP_16(pstMinpower->lastminutepower);
>>>> +    pstMinpower->lasthourpower = BSWAP_16(pstMinpower->lasthourpower);
>>>> +    pstMinpower->lastdaypower = BSWAP_16(pstMinpower->lastdaypower);
>>>> +    pstMinpower->lastweakpower = BSWAP_16(pstMinpower->lastweakpower);
>>>> +    pstMinpower->lastminutepowertime =
>>>> BSWAP_32(pstMinpower->lastminutepowertime);
>>>> +    pstMinpower->lasthourpowertime =
>>>> BSWAP_32(pstMinpower->lasthourpowertime);
>>>> +    pstMinpower->lastdaypowertime =
>>>> BSWAP_32(pstMinpower->lastdaypowertime);
>>>> +    pstMinpower->lastweekpowertime =
>>>> BSWAP_32(pstMinpower->lastweekpowertime);
>>>> +#endif
>>>>         return 0;
>>>>     }
>>>>
>>>> @@ -4183,6 +4231,15 @@ static int ipmi_get_power_cap(struct
>>>> ipmi_intf* intf,IPMI_POWER_CAP* ipmipowerca
>>>>         }
>>>>
>>>>         * ipmipowercap = *((IPMI_POWER_CAP*)(rsp->data));
>>>> +#if WORDS_BIGENDIAN
>>>> +    ipmipowercap->PowerCap = BSWAP_16(ipmipowercap->PowerCap);
>>>> +    ipmipowercap->MaximumPowerConsmp =
>>>> BSWAP_16(ipmipowercap->MaximumPowerConsmp);
>>>> +    ipmipowercap->MinimumPowerConsmp =
>>>> BSWAP_16(ipmipowercap->MinimumPowerConsmp);
>>>> +    ipmipowercap->totalnumpowersupp =
>>>> BSWAP_16(ipmipowercap->totalnumpowersupp);
>>>> +    ipmipowercap->AvailablePower =
>>>> BSWAP_16(ipmipowercap->AvailablePower);
>>>> +    ipmipowercap->SystemThrottling =
>>>> BSWAP_16(ipmipowercap->SystemThrottling);
>>>> +    ipmipowercap->Resv = BSWAP_16(ipmipowercap->Resv);
>>>> +#endif
>>>>
>>>>         return 0;
>>>>     }
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>>
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways today's security and
>>>> threat landscape has changed and how IT managers can respond.
>>>> Discussions
>>>> will include endpoint security, mobile security and the latest in
>>>> malware
>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Ipmitool-devel mailing list
>>>> Ipmitool-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
>>>>
>>> ------------------------------------------------------------------------------
>>>
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond.
>>> Discussions
>>> will include endpoint security, mobile security and the latest in
>>> malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Ipmitool-devel mailing list
>>> Ipmitool-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
>>
>> ------------------------------------------------------------------------------
>>
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Ipmitool-devel mailing list
>> Ipmitool-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
>>

Fix delloem powermonitor on big-endian platforms.

From: Jan Safranek <jsafr...@redhat.com>

'ipmitool dellem powermonitor' command should convert data from
network-format to the native one, otherwise it shows garbage on ppc/ppc64
platform.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 lib/ipmi_delloem.c |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)


diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
index b17a1ac..e9e17a0 100644
--- a/lib/ipmi_delloem.c
+++ b/lib/ipmi_delloem.c
@@ -3302,7 +3302,11 @@ static int ipmi_powermgmt(struct ipmi_intf* intf)
         return -1;
     }
     bmctimeconvval=(uint32_t*)rsp->data;
+#if WORDS_BIGENDIAN
+    bmctimeconv=BSWAP_32(*bmctimeconvval);
+#else
     bmctimeconv=*bmctimeconvval;
+#endif
 
     /* get powermanagement info*/
     req.msg.netfn = DELL_OEM_NETFN;
@@ -3335,7 +3339,15 @@ static int ipmi_powermgmt(struct ipmi_intf* intf)
 
 
     pwrMonitorInfo = (IPMI_POWER_MONITOR*)rsp->data;
-
+#if WORDS_BIGENDIAN
+    cumStartTimeConv = BSWAP_32(pwrMonitorInfo->cumStartTime);
+    cumReadingConv = BSWAP_32(pwrMonitorInfo->cumReading);
+    maxPeakStartTimeConv = BSWAP_32(pwrMonitorInfo->maxPeakStartTime);
+    ampPeakTimeConv = BSWAP_32(pwrMonitorInfo->ampPeakTime);
+    ampReadingConv = BSWAP_16(pwrMonitorInfo->ampReading);
+    wattPeakTimeConv = BSWAP_32(pwrMonitorInfo->wattPeakTime);
+    wattReadingConv = BSWAP_16(pwrMonitorInfo->wattReading);
+#else
     cumStartTimeConv = pwrMonitorInfo->cumStartTime;
     cumReadingConv = pwrMonitorInfo->cumReading;
     maxPeakStartTimeConv = pwrMonitorInfo->maxPeakStartTime;
@@ -3343,6 +3355,7 @@ static int ipmi_powermgmt(struct ipmi_intf* intf)
     ampReadingConv = pwrMonitorInfo->ampReading;
     wattPeakTimeConv = pwrMonitorInfo->wattPeakTime;
     wattReadingConv = pwrMonitorInfo->wattReading;
+#endif
 
     ipmi_time_to_str(cumStartTimeConv, cumStartTime);
 
@@ -3528,6 +3541,10 @@ static int ipmi_get_power_headroom_command (struct ipmi_intf * intf,uint8_t unit
         printf("power headroom  Data               : %x %x %x %x ",
         /*need to look into */                                                                  rsp->data[0], rsp->data[1], rsp->data[2], rsp->data[3]);
     powerheadroom= *(( POWER_HEADROOM *)rsp->data);
+#if WORDS_BIGENDIAN
+    powerheadroom.instheadroom = BSWAP_16(powerheadroom.instheadroom);
+    powerheadroom.peakheadroom = BSWAP_16(powerheadroom.peakheadroom);
+#endif
 
     printf ("Headroom\n");
     printf ("Statistic                     Reading\n");   
@@ -3685,6 +3702,11 @@ static int ipmi_get_instan_power_consmpt_data(struct ipmi_intf* intf,
     }
 
     * instpowerconsumptiondata = * ( (IPMI_INST_POWER_CONSUMPTION_DATA*) (rsp->data));
+#if WORDS_BIGENDIAN
+    instpowerconsumptiondata->instanpowerconsumption = BSWAP_16(instpowerconsumptiondata->instanpowerconsumption);
+    instpowerconsumptiondata->instanApms = BSWAP_16(instpowerconsumptiondata->instanApms);
+    instpowerconsumptiondata->resv1 = BSWAP_16(instpowerconsumptiondata->resv1);
+#endif
 
     return 0;
 
@@ -3816,6 +3838,12 @@ static int ipmi_get_avgpower_consmpt_history(struct ipmi_intf* intf,IPMI_AVGPOWE
     }
 
     *pavgpower = *( (IPMI_AVGPOWER_CONSUMP_HISTORY*) rsp->data);
+#if WORDS_BIGENDIAN
+    pavgpower->lastminutepower = BSWAP_16(pavgpower->lastminutepower);
+    pavgpower->lasthourpower = BSWAP_16(pavgpower->lasthourpower);
+    pavgpower->lastdaypower = BSWAP_16(pavgpower->lastdaypower);
+    pavgpower->lastweakpower = BSWAP_16(pavgpower->lastweakpower);
+#endif
 
     return 0;
 }
@@ -3882,6 +3910,16 @@ static int ipmi_get_peakpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_
 
     }
     *pstPeakpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
+#if WORDS_BIGENDIAN
+    pstPeakpower->lastminutepower = BSWAP_16(pstPeakpower->lastminutepower);
+    pstPeakpower->lasthourpower = BSWAP_16(pstPeakpower->lasthourpower);
+    pstPeakpower->lastdaypower = BSWAP_16(pstPeakpower->lastdaypower);
+    pstPeakpower->lastweakpower = BSWAP_16(pstPeakpower->lastweakpower);
+    pstPeakpower->lastminutepowertime = BSWAP_32(pstPeakpower->lastminutepowertime);
+    pstPeakpower->lasthourpowertime = BSWAP_32(pstPeakpower->lasthourpowertime);
+    pstPeakpower->lastdaypowertime = BSWAP_32(pstPeakpower->lastdaypowertime);
+    pstPeakpower->lastweekpowertime = BSWAP_32(pstPeakpower->lastweekpowertime);
+#endif
     return 0;
 }
 
@@ -3948,6 +3986,16 @@ static int ipmi_get_minpower_consmpt_history(struct ipmi_intf* intf,IPMI_POWER_C
 
     }
     *pstMinpower =* ((IPMI_POWER_CONSUMP_HISTORY*)rsp->data);
+#if WORDS_BIGENDIAN
+    pstMinpower->lastminutepower = BSWAP_16(pstMinpower->lastminutepower);
+    pstMinpower->lasthourpower = BSWAP_16(pstMinpower->lasthourpower);
+    pstMinpower->lastdaypower = BSWAP_16(pstMinpower->lastdaypower);
+    pstMinpower->lastweakpower = BSWAP_16(pstMinpower->lastweakpower);
+    pstMinpower->lastminutepowertime = BSWAP_32(pstMinpower->lastminutepowertime);
+    pstMinpower->lasthourpowertime = BSWAP_32(pstMinpower->lasthourpowertime);
+    pstMinpower->lastdaypowertime = BSWAP_32(pstMinpower->lastdaypowertime);
+    pstMinpower->lastweekpowertime = BSWAP_32(pstMinpower->lastweekpowertime);
+#endif
     return 0;
 }
 
@@ -4183,6 +4231,15 @@ static int ipmi_get_power_cap(struct ipmi_intf* intf,IPMI_POWER_CAP* ipmipowerca
     }
 
     * ipmipowercap = *((IPMI_POWER_CAP*)(rsp->data));
+#if WORDS_BIGENDIAN
+    ipmipowercap->PowerCap = BSWAP_16(ipmipowercap->PowerCap);
+    ipmipowercap->MaximumPowerConsmp = BSWAP_16(ipmipowercap->MaximumPowerConsmp);
+    ipmipowercap->MinimumPowerConsmp = BSWAP_16(ipmipowercap->MinimumPowerConsmp);
+    ipmipowercap->totalnumpowersupp = BSWAP_16(ipmipowercap->totalnumpowersupp);
+    ipmipowercap->AvailablePower = BSWAP_16(ipmipowercap->AvailablePower);
+    ipmipowercap->SystemThrottling = BSWAP_16(ipmipowercap->SystemThrottling);
+    ipmipowercap->Resv = BSWAP_16(ipmipowercap->Resv);
+#endif
 
     return 0;
 }
Fix stack overflow in delloem setled

From: Jan Safranek <jsafr...@redhat.com>

The buffer should be bigger to hold the 10 character, which are set later
in the function.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 lib/ipmi_delloem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
index e9e17a0..9ecf427 100644
--- a/lib/ipmi_delloem.c
+++ b/lib/ipmi_delloem.c
@@ -4861,7 +4861,7 @@ CheckSetLEDSupport(struct ipmi_intf * intf)
 {
     struct ipmi_rs * rsp = NULL;
     struct ipmi_rq req = {0};
-    uint8_t data[4];
+    uint8_t data[10];
 
     SetLEDSupported = 0;
     req.msg.netfn = DELL_OEM_NETFN;
delloem commands should not act before parsing command line.

From: Jan Safranek <jsafr...@redhat.com>

e..g 'ipmitool delloem lan help' should *not* check remote system for DELL
OEM commands before listing help. People tend to write scripts on different
machines and listing help is very helpful. In addition, why check for
setled support if only lan support is needed?

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 lib/ipmi_delloem.c |  159 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 89 insertions(+), 70 deletions(-)


diff --git a/lib/ipmi_delloem.c b/lib/ipmi_delloem.c
index 9ecf427..963a321 100644
--- a/lib/ipmi_delloem.c
+++ b/lib/ipmi_delloem.c
@@ -248,17 +248,13 @@ ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv)
 {
     int rc = 0;
 
-    ipmi_idracvalidator_command(intf);
-    CheckLCDSupport (intf);
-    CheckSetLEDSupport (intf);
-
     if (argc == 0 || strncmp(argv[0], "help\0", 5) == 0) 
     {
         usage();
         return 0;
     }
 
-    if (IsLCDSupported() && (0 ==strncmp(argv[current_arg], "lcd\0", 4)) ) 
+    if (0 ==strncmp(argv[current_arg], "lcd\0", 4))
     {
         ipmi_delloem_lcd_main (intf,argc,argv);
     }
@@ -268,12 +264,12 @@ ipmi_delloem_main(struct ipmi_intf * intf, int argc, char ** argv)
         ipmi_delloem_mac_main (intf,argc,argv);
     }
     /* lan address*/
-    else if (IsLANSupported() && strncmp(argv[current_arg], "lan\0", 4) == 0) 
+    else if (strncmp(argv[current_arg], "lan\0", 4) == 0)
     {
         ipmi_delloem_lan_main (intf,argc,argv);
     }
     /* SetLED support */
-    else if (IsSetLEDSupported() && strncmp(argv[current_arg], "setled\0", 7) == 0)
+    else if (strncmp(argv[current_arg], "setled\0", 7) == 0)
     {
         ipmi_delloem_setled_main (intf,argc,argv);
     }
@@ -312,15 +308,12 @@ static void usage(void)
     lprintf(LOG_NOTICE, "usage: delloem <command> [option...]");
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "commands:");
-    if (IsLCDSupported())
-        lprintf(LOG_NOTICE, "    lcd"); 
-    lprintf(LOG_NOTICE, "    mac");         
-    if (IsLANSupported())
-        lprintf(LOG_NOTICE, "    lan");
-    if (IsSetLEDSupported())
-	lprintf(LOG_NOTICE,    "    setled");         
-    lprintf(LOG_NOTICE, "    powermonitor");        
-	lprintf(LOG_NOTICE, "    vFlash");
+    lprintf(LOG_NOTICE, "    lcd");
+    lprintf(LOG_NOTICE, "    mac");
+    lprintf(LOG_NOTICE, "    lan");
+    lprintf(LOG_NOTICE, "    setled");
+    lprintf(LOG_NOTICE, "    powermonitor");
+    lprintf(LOG_NOTICE, "    vFlash");
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "For help on individual commands type:");
     lprintf(LOG_NOTICE, "delloem <command> help");
@@ -354,13 +347,20 @@ static int ipmi_delloem_lcd_main (struct ipmi_intf * intf, int argc, char ** arg
 
 
     /* ipmitool delloem lcd info*/
-    if (argc == 1) 
+    if (argc == 1 || strcmp(argv[current_arg], "help") == 0)
     {
         ipmi_lcd_usage();
+        return 0;
+    }
+    CheckLCDSupport (intf);
+    ipmi_idracvalidator_command(intf);
+    if (!IsLCDSupported()) {
+        printf("lcd is not supported on this system.\n");
+        return -1;
     }
     else if (strncmp(argv[current_arg], "info\0", 5) == 0) 
     {
-		if((iDRAC_FLAG==IDRAC_11G) || (iDRAC_FLAG==IDRAC_12G) )            
+	if((iDRAC_FLAG==IDRAC_11G) || (iDRAC_FLAG==IDRAC_12G) )
             rc = ipmi_lcd_get_info_wh(intf);
         else
             rc = ipmi_lcd_get_info(intf);
@@ -1835,27 +1835,25 @@ static void
 ipmi_lcd_usage(void)
 {
     lprintf(LOG_NOTICE, "");
-    if(iDRAC_FLAG==0)
-    {
-        lprintf(LOG_NOTICE, "   lcd set {none}|{default}|{custom <text>}");
-        lprintf(LOG_NOTICE, "      Set LCD text displayed during non-fault conditions");
-    }
-    else if( (iDRAC_FLAG==IDRAC_11G) || (iDRAC_FLAG==IDRAC_12G) )
-    {
-        lprintf(LOG_NOTICE, "   lcd set {mode}|{lcdqualifier}|{errordisplay}");
-		lprintf(LOG_NOTICE, "      Allows you to set the LCD mode and user-defined string.");
-        lprintf(LOG_NOTICE, "");
-        lprintf(LOG_NOTICE, "   lcd set mode {none}|{modelname}|{ipv4address}|{macaddress}|");
-        lprintf(LOG_NOTICE, "   {systemname}|{servicetag}|{ipv6address}|{ambienttemp}");
-        lprintf(LOG_NOTICE, "   {systemwatt }|{assettag}|{userdefined}<text>");
-		lprintf(LOG_NOTICE, "	   Allows you to set the LCD display mode to any of the preceding parameters");
-		lprintf(LOG_NOTICE, "");
-        lprintf(LOG_NOTICE, "   lcd set lcdqualifier {watt}|{btuphr}|{celsius}|{fahrenheit}");
-		lprintf(LOG_NOTICE, "      Allows you to set the unit for the system ambient temperature mode.");		
-        lprintf(LOG_NOTICE, "");
-        lprintf(LOG_NOTICE, "   lcd set errordisplay {sel}|{simple}");
-		lprintf(LOG_NOTICE, "      Allows you to set the error display.");				
-    }
+    lprintf(LOG_NOTICE, "Generic DELL HW:");
+    lprintf(LOG_NOTICE, "   lcd set {none}|{default}|{custom <text>}");
+    lprintf(LOG_NOTICE, "      Set LCD text displayed during non-fault conditions");
+
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "iDRAC 11g or iDRAC 12g:");
+    lprintf(LOG_NOTICE, "   lcd set {mode}|{lcdqualifier}|{errordisplay}");
+    lprintf(LOG_NOTICE, "      Allows you to set the LCD mode and user-defined string.");
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lcd set mode {none}|{modelname}|{ipv4address}|{macaddress}|");
+    lprintf(LOG_NOTICE, "   {systemname}|{servicetag}|{ipv6address}|{ambienttemp}");
+    lprintf(LOG_NOTICE, "   {systemwatt }|{assettag}|{userdefined}<text>");
+    lprintf(LOG_NOTICE, "	   Allows you to set the LCD display mode to any of the preceding parameters");
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lcd set lcdqualifier {watt}|{btuphr}|{celsius}|{fahrenheit}");
+    lprintf(LOG_NOTICE, "      Allows you to set the unit for the system ambient temperature mode.");
+    lprintf(LOG_NOTICE, "");
+    lprintf(LOG_NOTICE, "   lcd set errordisplay {sel}|{simple}");
+    lprintf(LOG_NOTICE, "      Allows you to set the error display.");
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "   lcd info");
     lprintf(LOG_NOTICE, "      Show LCD text that is displayed during non-fault conditions");
@@ -1894,6 +1892,12 @@ static int ipmi_delloem_mac_main (struct ipmi_intf * intf, int argc, char ** arg
     int rc = 0;
 
     current_arg++;
+    if (argc > 1 && strcmp(argv[current_arg], "help") == 0)
+    {
+        ipmi_mac_usage();
+        return 0;
+    }
+    ipmi_idracvalidator_command(intf);
     if (argc == 1)
     {
         rc = ipmi_macinfo(intf, 0xff);
@@ -2417,11 +2421,17 @@ static int ipmi_delloem_lan_main (struct ipmi_intf * intf, int argc, char ** arg
     int nic_selection = 0;
 	char nic_set[2] = {0};
     current_arg++;
-    if (argv[current_arg] == NULL)
+    if (argv[current_arg] == NULL || strcmp(argv[current_arg], "help") == 0)
     {
         ipmi_lan_usage();
+        return 0;
+    }
+    ipmi_idracvalidator_command(intf);
+    if (!IsLANSupported())
+    {
+        printf("lan is not supported on this system.\n");
         return -1;
-    }               
+    }
     else if (strncmp(argv[current_arg], "set\0", 4) == 0)
     {
         current_arg++;
@@ -2476,6 +2486,7 @@ static int ipmi_delloem_lan_main (struct ipmi_intf * intf, int argc, char ** arg
     else
     {
         ipmi_lan_usage();
+        return -1;
     }
 }
 
@@ -2855,27 +2866,27 @@ ipmi_lan_usage(void)
 {
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "   lan set <Mode> ");
-	if(iDRAC_FLAG == IDRAC_12G) {
-		lprintf(LOG_NOTICE, "      sets the NIC Selection Mode :");
-		lprintf(LOG_NOTICE, "      	dedicated, shared with lom1, shared with lom2,shared with lom3,shared ");
-		lprintf(LOG_NOTICE, "		with lom4,shared with failover lom1,shared with failover lom2,shared ");
-		lprintf(LOG_NOTICE, "		with failover lom3,shared with failover lom4,shared with Failover all ");
-		lprintf(LOG_NOTICE, "		loms, shared with Failover None).");
-	} else {
-	    lprintf(LOG_NOTICE, "      sets the NIC Selection Mode (dedicated, shared, shared with failover lom2, ");	
-	    lprintf(LOG_NOTICE, "      			shared with Failover all loms).");
-	}
+
+    lprintf(LOG_NOTICE, "      sets the NIC Selection Mode :");
+    lprintf(LOG_NOTICE, "          on iDRAC12g :");
+
+    lprintf(LOG_NOTICE, "              dedicated, shared with lom1, shared with lom2,shared with lom3,shared ");
+    lprintf(LOG_NOTICE, "              with lom4,shared with failover lom1,shared with failover lom2,shared ");
+    lprintf(LOG_NOTICE, "              with failover lom3,shared with failover lom4,shared with Failover all ");
+    lprintf(LOG_NOTICE, "              loms, shared with Failover None).");
+    lprintf(LOG_NOTICE, "          on other systems :");
+    lprintf(LOG_NOTICE, "              dedicated, shared, shared with failover lom2,");
+    lprintf(LOG_NOTICE, "              shared with Failover all loms.");
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "   lan get ");
-	if(iDRAC_FLAG == IDRAC_12G) {
-		lprintf(LOG_NOTICE, "      returns the current NIC Selection Mode (dedicated, shared with lom1, shared ");
-		lprintf(LOG_NOTICE, "		with lom2, shared with lom3, shared with lom4,shared with failover lom1,");
-		lprintf(LOG_NOTICE, "		shared with failover lom2,shared with failover lom3,shared with failover ");
-		lprintf(LOG_NOTICE, "		lom4,shared with Failover all loms,shared with Failover None).");
-	}else {
-		lprintf(LOG_NOTICE, "      returns the current NIC Selection Mode (dedicated, shared, shared with failover");
-		lprintf(LOG_NOTICE, "      			lom2, shared with Failover all loms).");
-	}
+    lprintf(LOG_NOTICE, "          on iDRAC12g :");
+    lprintf(LOG_NOTICE, "              returns the current NIC Selection Mode (dedicated, shared with lom1, shared ");
+    lprintf(LOG_NOTICE, "              with lom2, shared with lom3, shared with lom4,shared with failover lom1,");
+    lprintf(LOG_NOTICE, "              shared with failover lom2,shared with failover lom3,shared with failover ");
+    lprintf(LOG_NOTICE, "              lom4,shared with Failover all loms,shared with Failover None).");
+    lprintf(LOG_NOTICE, "          on other systems :");
+    lprintf(LOG_NOTICE, "              dedicated, shared, shared with failover,");
+    lprintf(LOG_NOTICE, "              lom2, shared with Failover all loms.");
     lprintf(LOG_NOTICE, "");
     lprintf(LOG_NOTICE, "   lan get active");
     lprintf(LOG_NOTICE, "      returns the current active NIC (dedicated, LOM1, LOM2, LOM3, LOM4).");       
@@ -2902,6 +2913,12 @@ static int ipmi_delloem_powermonitor_main (struct ipmi_intf * intf, int argc, ch
     int rc = 0;
 
     current_arg++;
+    if (argc > 1 && strcmp(argv[current_arg], "help") == 0)
+    {
+        ipmi_powermonitor_usage();
+        return 0;
+    }
+    ipmi_idracvalidator_command(intf);
     if (argc == 1)
     {
         rc = ipmi_powermgmt(intf);
@@ -4767,12 +4784,13 @@ ipmi_delloem_vFlash_process(struct ipmi_intf* intf, int current_arg, char ** arg
 		return -1;
 	}
 
-	if (argv[current_arg] == NULL)
+	if (argv[current_arg] == NULL || strcmp(argv[current_arg], "help") == 0)
 	{
 		ipmi_vFlash_usage();
-		return -1;
+		return 0;
 	}
-	else if (!strncmp(argv[current_arg], "info\0", 5))
+        ipmi_idracvalidator_command(intf);
+	if (!strncmp(argv[current_arg], "info\0", 5))
 	{
 		current_arg++;
 		if (argv[current_arg] == NULL)
@@ -4798,11 +4816,6 @@ ipmi_delloem_vFlash_process(struct ipmi_intf* intf, int current_arg, char ** arg
 		}
 	}
 	/* TBD other vFlash subcommands */
-	else if (!strncmp(argv[current_arg], "help\0", 5))
-	{
-		ipmi_vFlash_usage();
-		return 0;
-	}
 	else
 	{
 		ipmi_vFlash_usage();
@@ -5072,10 +5085,16 @@ ipmi_delloem_setled_main(struct ipmi_intf * intf, int argc, char ** argv)
     }
 
     /* ipmitool delloem setled info*/
-    if (argc == 1) 
+    if (argc == 1 || strcmp(argv[current_arg], "help") == 0)
     {
         ipmi_setled_usage();
-	return 0;
+        return 0;
+    }
+    CheckSetLEDSupport (intf);
+    if (!IsSetLEDSupported())
+    {
+        printf("'setled' is not supported on this system.\n");
+        return -1;
     }
     else if (sscanf(argv[current_arg], "%*x:%x:%x.%x", &b,&d,&f) == 3) {
         /* We have bus/dev/function of drive */
Fix exit code on '-o list' or '-o help' option

From: Jan Safranek <jsafr...@redhat.com>

'ipmitool -o list' should return zero exit code.

Signed-off-by: Jan Safranek <jsafr...@redhat.com>
---

 lib/ipmi_main.c |    1 +
 1 file changed, 1 insertion(+)


diff --git a/lib/ipmi_main.c b/lib/ipmi_main.c
index 22e3179..c88f457 100644
--- a/lib/ipmi_main.c
+++ b/lib/ipmi_main.c
@@ -573,6 +573,7 @@ ipmi_main(int argc, char ** argv,
 			if (strncmp(oemtype, "list", 4) == 0 ||
 					strncmp(oemtype, "help", 4) == 0) {
 				ipmi_oem_print();
+				rc = 0;
 				goto out_free;
 			}
 			break;
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to