CODE EXAMPLE 2-1Sample envmond Application Program (Continued)

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);

}

40 Netra CP2500 Board Programming Guide • March 2007

Page 54
Image 54
Sun Microsystems CP2500 manual Code Example 2-1Sample envmond Application Program