Renier Morales wrote :
> > For that, i have modified the oh_get_sensor_reading() equivalent
> > function to change the value previously hard-coded (in fact, i read a
> > file which contains the value i want to display). But when the sensor
> > value exceed the up critical threshold, nothing happen (i modified the
> > sim_fan_sensors structure).
>
> You need to add code in the simulator plugin instead, to check the
> sensor value whenever get_event is called, and generate the sensor
> event if it detected a change.

Hello,

Thanks for your last response (sorry for the delay but i was awfully
busy). If i refer to the online documentation (html), it seems that this
feature should be available when i update the RPT, at least for the
sensor events (ยง3.2.1.1) : "Sensor Events are easily quantifiable. Event
generation for a sensor is specified via saHpiSensorEventEnablesSet.
This may include both assertion (crossing a threshold), and deassertion
(returning to a "safe" value from the threshold). For all sensors that
have events enabled, on any RPT update those sensor value will be
compared to the set threshold, and events will be generated if appropriate."

So, i modified the simulator example to change a specific sensor value
from the sim_get_sensor_reading() function and tried to generate an
event. But, unfortunatly, it does'nt work. Even the fact to change the
ResourceFailed attribute is no effect.

Could someone could tell me where i am wrong ?

switch( data->Type ) {
    case SAHPI_SENSOR_READING_TYPE_FLOAT64:
        printf("** value=%lf\n", data->Value.SensorFloat64 );
        sinfo->reading.Value.SensorFloat64 += 10;

        if (rpt && sinfo->reading.Value.SensorFloat64>200) {
          /* Only notify if change in status */
          if (rpt->ResourceFailed == SAHPI_FALSE) {
            printf("** ResourceFailed **\n");
            rpt->ResourceFailed = SAHPI_TRUE;
            /* Add changed resource to event queue */
            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 = *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);
            /* add event to our event queue */
            oh_evt_queue_push(handle->eventq, e);
            printf("** evenement envoye ....\n");
          }
        }
        break;
    default:
        printf("** Format unsupported\n");
        break;
}

To receive events, i use the command below :
# hpievents -t 120

Even the ResourceFailed attribute doesn't seems to change outside
openhpi (i expected that it will change to TRUE) :
# hpitree | grep ResourceFailed
      ResourceFailed: FALSE

Thanks in advance,
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

Reply via email to