beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 54

background image

40

Netra CP2500 Board Programming Guide • March 2007

return (1);

}

if (get_child_by_name(platformh, sensor, &childh) != PICL_SUCCESS) {

fprintf(stderr, "Failed to get %s sensor.", sensor);

picl_shutdown();

return (1);

}

get_sensor_thresholds(childh);

/* Read current sensor temperature */

if (picl_get_propval_by_name(childh, CURRENT_TEMPERATURE,

&temp, sizeof (temp)) != PICL_SUCCESS) {

fprintf(stderr, "Failed to read current temperature\n");

} else

fprintf(stdout, "Current temperature = %d\n", temp);

set_sensor_threshold(childh, HI_WARNING_THRESHOLD, temp+5);

picl_shutdown();

return (0);

}

CODE EXAMPLE 2-1

Sample envmond Application Program (Continued)