"Lionel Tricon (Boulot)" <[EMAIL PROTECTED]> wrote on 06/12/2007
08:10:49 AM:
> Renier Morales a écrit :
> > The function's purpose is to give the plugin a chance to generate
> > events. In the simulator's case, it doesn't generate any events except
> > for the ones created during discovery.
> > The reason I told you to put your code (e.g. switch case generating
> > failed resource event) in get_event was to make it easier for you to
> > see it as you would only have had to run hpievents to do that.
> As requested, i put the generation of the failed resource event into
> get_event() but it segfault now ... Since you need to have a pointer on
> the ressource to generate the event, i put it into the global variable
> VG_rpt from get_sensor_reading() and set the VG_EVENT flag to 1 to tell
> get_event() to generate the event.
>
> The example below will explain you how it's coded.
>
> extern int VG_EVENT;
> extern SaHpiRptEntryT *VG_rpt;
>
> SaErrorT sim_get_event(void *hnd, struct oh_event *event, struct timeval
> *timeout )
What OpenHPI version are you using?? sim_get_event only has one parameter,
hnd. Did you modify the prototype??
> {
> struct oh_event *e = NULL;
> if (!hnd) return SA_ERR_HPI_INVALID_PARAMS;
>
> if (VG_EVENT) {
> VG_EVENT = 0;
> e = (struct oh_event *)malloc(sizeof(*e));
> if (!e) {
> dbg("unable to allocate event");
> return SA_ERR_HPI_OUT_OF_SPACE;
> }
> memset(e, '\0', sizeof(struct oh_event));
> e->resource = *VG_rpt;
> e->event.Severity = e->resource.ResourceSeverity;
> e->event.Source = e->resource.ResourceId;
> e->event.EventType = SAHPI_ET_RESOURCE;
> e->event.EventDataUnion.ResourceEvent.ResourceEventType =
> SAHPI_RESE_RESOURCE_FAILURE;
> oh_gettimeofday(&e->event.Timestamp);
> *event = *e;
> //g_free(e);
> printf("** evenement envoye ....\n");
> return 1;
> }
>
> But, in the actual state of art, the simulator plugin cannot generate
> events at all since the get_event function do nothing. The prototype
> function is even not complete.
I already explained why this is. Currently, the simulator just doesn't
have any more events to publish after discovery.
>
> SaErrorT sim_get_event(void *hnd)
> {
> if (!hnd) return SA_ERR_HPI_INVALID_PARAMS;
> return SA_OK;
> }
> > The code you modified had been commented out because eventq is not
> > supposed to be used that way anymore.
> That's how it's describes from the actual documentation ...
The documentation is outdated.
> How openhpi can pull events from plugins if the get_event function
> cannot be used in that way ?
The plugins are the ones who push the events now, by using
oh_evt_queue_push() to put events directly in the infrastructure's queue.
get_event() just gives them an opportunity to wake up and do so if they
have events to publish.
> > Did you try running both hpievents and hpitree in the way I said
> > before? or tried running hpiel?
> Yes, i tried it both without correct results.
You mean you ran hpievents -t BLOCK in one console window, and left it
blocking, and then you ran hpitree in another window, and you didn't see
anything in the hpievents window? Also, you mean you changed
OPENHPI_LOG_ON_SEV in openhpi.conf to something like "OK", and ran hpiel
-d -p -r, after running hpitree?
>
> Lionel Tricon
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel