X hits on this document

PDF document

February 10, 2006 - page 143 / 238

555 views

0 shares

0 downloads

0 comments

143 / 238

8.6. USING SENSORS IN OPENIPMI

131

It is an opaque data structure, so you cannot directly access the contents or directly declare one. To create or keep your own copy of an event state data structure, you may allocate and copy one using the following functions:

unsigned int ipmi_event_state_size(void); void ipmi_copy_event_state(ipmi_event_state_t *dest, ipmi_event_state_t *src);

This allows you to find the size and copy the information in one of these structures. For example, to make your own copy, do something like:

m y _ s t a t e s = m a l l o c ( i p m i _ e v e n t _ s t a t e _ s i z e ( ) if (!my_states) ) ;

handle_error() else

ipmi_copy_event_state(my_states, states);

If you want to create one, allocate it as above and initialize it with void ipmi_event_state_init(ipmi_event_state_t *events);

This clears all settings. The following functions are then available to set and get global items in the event state:

void ipmi_event_state_set_events_enabled(ipmi_event_state_t *events, int val); int ipmi_event_state_get_events_enabled(ipmi_event_state_t *events); void ipmi_event_state_set_scanning_enabled(ipmi_event_state_t *events,int val); int ipmi_event_state_get_scanning_enabled(ipmi_event_state_t *events); void ipmi_event_state_set_busy(ipmi_event_state_t *events, int val); int ipmi_event_state_get_busy(ipmi_event_state_t *events);

If events are enabled, then the sensor can generate events. This acts as an off switch for the whole sensor. If events are enabled, and if per-state event enables are supported, then the individual state settings control which events are generated. Scanning means watching for events; if scanning is off then the sensor, in effect, is turned off and will not report valid reading or generate events. If busy is true on a return from a query, then the sensor is currently in busy with some operation and cannot be read.

See section 8.6.3 for discrete sensors and section 8.6.2 on page 134 for threshold events for the details on setting the individual event enables.

Note that once you have created an event state, you have to send it to the sensor. Just creating and setting the values doesn’t do anything directly to the sensor; it must be sent. To send them, use one of the following:

_ _ ipmi event_state t

*states,

_ _ ipmi sensor_done cb

done,

void

*cb_data);

_ _ ipmi event_state t

*states,

_ _ ipmi sensor_done cb

done,

void

*cb_data);

*sensor,

*sensor,

i n t i p m i _ s e n s o r _ s e t _ e v e n t _ e n a b l e s ( i p m i _ s e n s o r _ t

i n t i p m i _ s e n s o r _ e n a b l e _ e v e n t s ( i p m i _ s e n s o r _ t

Document info
Document views555
Page views555
Page last viewedSun Dec 04 19:02:39 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments