Can you send this patch as an attachment? Or better yet, attach it to
https://sourceforge.net/tracker/index.php?func=detail&aid=1843714&group_id=71730&atid=532251
Thanks.
--Renier
[EMAIL PROTECTED] wrote on 11/30/2007 12:43:56
AM:
> Here is the patch for hpievents and hpi_cmd as suggested by Renier
>
> =================================Cut Here============================
> diff -Naur openhpi-2.10.1/clients/hpievents.c openhpi-2.10.
> 1/clients/hpievents.c
> --- openhpi-2.10.1/clients/hpievents.c
> +++ openhpi-2.10.1/clients/hpievents.c
> @@ -171,6 +171,7 @@
> printf( "Go and get the event\n");
> while (1) {
> rdr.RdrType = SAHPI_NO_RECORD;
> + rptentry.ResourceId = 0;
>
> rv = saHpiEventGet( sessionid, timeout, &event, &rdr, &rptentry,
NULL);
> if (rv != SA_OK) {
> @@ -189,10 +190,20 @@
> }
> break;
> } else {
> - if (rdr.RdrType == SAHPI_NO_RECORD)
> - oh_print_event(&event, NULL, 4);
> - else
> + if (rdr.RdrType != SAHPI_NO_RECORD)
> oh_print_event(&event, &rdr.Entity, 4);
> + else if (rptentry.ResourceId != 0)
> + oh_print_event(&event, &rptentry.
> ResourceEntity, 4);
> + else {
> + rptentryid = event.Source;
> + rv = saHpiRptEntryGet(sessionid,
> rptentryid, &nextrptentryid, &rptentry);
> + if(rv == SA_OK)
> + oh_print_event(&event,
> &rptentry.ResourceEntity, 4);
> + else {
> + printf("Wrong resource Id
> <%d> detected", event.Source);
> + oh_print_event(&event, NULL, 4);
> + }
> + }
> }
> }
>
> diff -Naur openhpi-2.10.1/hpi_shell/session.c openhpi-2.10.
> 1/hpi_shell/session.c
> --- openhpi-2.10.1/hpi_shell/session.c
> +++ openhpi-2.10.1/hpi_shell/session.c
> @@ -95,6 +95,10 @@
> {
> SaHpiEventT event;
> SaErrorT rv;
> + SaHpiRptEntryT rptentry;
> + SaHpiRdrT rdr;
> + SaHpiEntryIdT rptentryid;
> + SaHpiEntryIdT nextrptentryid;
>
> rv = saHpiSubscribe(Domain->sessionId);
> if (rv != SA_OK) {
> @@ -104,6 +108,8 @@
>
> while(1) {
> for(;;) {
> + rdr.RdrType = SAHPI_NO_RECORD;
> + rptentry.ResourceId = 0;
> memset(&event, 0xF, sizeof(event));
> rv = saHpiEventGet(Domain->sessionId,
> SAHPI_TIMEOUT_IMMEDIATE, &event,
> @@ -114,8 +120,24 @@
> if (prt_flag == 1) {
> if (show_event_short)
> show_short_event(&event, ui_print);
> - else
> - oh_print_event(&event, NULL, 1);
> + else if (rdr.RdrType != SAHPI_NO_RECORD)
> + oh_print_event(&event,
> &rdr.Entity, 4);
> + else if (rptentry.ResourceId != 0)
> + oh_print_event(&event,
> &rptentry.ResourceEntity, 4);
> + else {
> + rptentryid = event.Source;
> + rv =
> saHpiRptEntryGet(Domain->sessionId,
> + rptentryid,
> +
> &nextrptentryid, &rptentry);
> + if(rv == SA_OK)
> +
> oh_print_event(&event, &rptentry.ResourceEntity, 4);
> + else {
> +
> printf("saHpiRptEntryGet failed for resource Id <%d> with error <%d>",
> + event.Source,
rv);
> + printf("Wrong
> resource Id <%d> detected", event.Source);
> +
> oh_print_event(&event, NULL, 4);
> + }
> + }
> }
> }/*the loop for retrieving event*/
> sleep(1);
> =================================Cut Here============================
>
> Regards,
> Raghavendra
>
> From: [EMAIL PROTECTED] [mailto:openhpi-
> [EMAIL PROTECTED] On Behalf Of Renier Morales
> Sent: Monday, November 19, 2007 9:41 PM
> To: [email protected]
> Subject: Re: [Openhpi-devel] hpievents and hpi_shell does not prints
> theentity path
>
> [EMAIL PROTECTED] wrote on 11/07/2007 12:21:26
AM:
>
> > hpievents client program does not prints the entity path for the
events
> > which does not have the RDRs. The hpievents reads the entity path from
> > the RDR structure.
> > For example: For hot swap events, RDRs are NOT pushed as part of the
> > events.
> > Since all the events will push the rptentry, the entity path can be
> > obtained from the rptentry instead of rdr.
>
> Events will not always come with an rptentry. The fix should really
> first check the RDR's entity path, since it can be different from
> the rptentry. If there is not RDR, then use the RPTEntry's entity
> path. If there is no RPTEntry, then try to lookup using
SaHpiEventT.Source.
>
> --Renier
>
> >
> > Also, the hpi_cmd (hpi_shell) does not prints the entity path for the
> > events (when event is enabled).
> >
> > Entity path will help the user/tester to easily determine the
resources
> > on which the event got generated.
> >
> > The fix for these problems is given as patch for openhpi-2.10.0 below:
> >
> > =================================Cut Here============================
> > --- openhpi-2.10.0/clients/hpievents.c
> > +++ openhpi-2.10.0/clients/hpievents.c
> > @@ -170,7 +170,6 @@
> >
> > printf( "Go and get the event\n");
> > while (1) {
> > - rdr.RdrType = SAHPI_NO_RECORD;
> >
> > rv = saHpiEventGet( sessionid, timeout, &event, &rdr,
> > &rptentry, NULL);
> > if (rv != SA_OK) {
> > @@ -189,10 +188,7 @@
> > }
> > break;
> > } else {
> > - if (rdr.RdrType == SAHPI_NO_RECORD)
> > - oh_print_event(&event, NULL, 4);
> > - else
> > - oh_print_event(&event, &rdr.Entity,
4);
> > + oh_print_event(&event,
> > &rptentry.ResourceEntity, 6);
> > }
> > }
> >
> > --- openhpi-2.10.0/hpi_shell/session.c
> > +++ openhpi-2.10.0/hpi_shell/session.c
> > @@ -93,6 +93,7 @@
> >
> > static void* get_event(void *unused)
> > {
> > + SaHpiRptEntryT rptentry;
> > SaHpiEventT event;
> > SaErrorT rv;
> >
> > @@ -107,7 +108,7 @@
> > memset(&event, 0xF, sizeof(event));
> > rv = saHpiEventGet(Domain->sessionId,
> > SAHPI_TIMEOUT_IMMEDIATE, &event,
> > - NULL, NULL, NULL);
> > + NULL, &rptentry, NULL);
> > if (rv != SA_OK ) {
> > break;
> > }
> > @@ -115,7 +116,7 @@
> > if (show_event_short)
> > show_short_event(&event,
> > ui_print);
> > else
> > - oh_print_event(&event, NULL,
1);
> > + oh_print_event(&event,
> > &rptentry.ResourceEntity, 1);
> > }
> > }/*the loop for retrieving event*/
> > sleep(1);
> > =================================Cut Here============================
> >
> > Regards,
> > Raghavendra.
> >
> >
-------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems? Stop.
> > Now Search log events and configuration files using AJAX and a
browser.
> > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > _______________________________________________
> > Openhpi-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/openhpi-devel
>
-------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell. From the desktop to the data center, Linux is going
> mainstream. Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________
> Openhpi-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openhpi-devel
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel