mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
added support for built-in sdrs
This commit is contained in:
parent
4d2f9ebdc2
commit
96876bb061
@ -92,6 +92,8 @@ enum {
|
|||||||
#define SDR_SENSOR_STAT_HI_CR (1<<4)
|
#define SDR_SENSOR_STAT_HI_CR (1<<4)
|
||||||
#define SDR_SENSOR_STAT_HI_NR (1<<5)
|
#define SDR_SENSOR_STAT_HI_NR (1<<5)
|
||||||
|
|
||||||
|
#define GET_DEVICE_SDR_INFO 0x20
|
||||||
|
#define GET_DEVICE_SDR 0x21
|
||||||
#define GET_SENSOR_FACTORS 0x23
|
#define GET_SENSOR_FACTORS 0x23
|
||||||
#define GET_SENSOR_FACTORS 0x23
|
#define GET_SENSOR_FACTORS 0x23
|
||||||
#define SET_SENSOR_HYSTERESIS 0x24
|
#define SET_SENSOR_HYSTERESIS 0x24
|
||||||
@ -115,6 +117,13 @@ struct sdr_repo_info_rs {
|
|||||||
uint8_t op_support; /* supported operations */
|
uint8_t op_support; /* supported operations */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* builtin (device) sdrs support */
|
||||||
|
struct sdr_device_info_rs {
|
||||||
|
unsigned char count; /* number of records */
|
||||||
|
unsigned char flags; /* flags */
|
||||||
|
unsigned char popChangeInd[3]; /* free space in SDR */
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
#define GET_SDR_RESERVE_REPO 0x22
|
#define GET_SDR_RESERVE_REPO 0x22
|
||||||
struct sdr_reserve_repo_rs {
|
struct sdr_reserve_repo_rs {
|
||||||
uint16_t reserve_id; /* reservation ID */
|
uint16_t reserve_id; /* reservation ID */
|
||||||
@ -148,7 +157,6 @@ struct sdr_get_rs {
|
|||||||
uint8_t length; /* remaining record bytes */
|
uint8_t length; /* remaining record bytes */
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct sdr_record_mask {
|
struct sdr_record_mask {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
@ -269,7 +277,6 @@ struct sdr_record_mask {
|
|||||||
} type;
|
} type;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
struct sdr_record_compact_sensor {
|
struct sdr_record_compact_sensor {
|
||||||
struct {
|
struct {
|
||||||
uint8_t owner_id;
|
uint8_t owner_id;
|
||||||
@ -680,7 +687,6 @@ struct sdr_record_oem {
|
|||||||
int data_len;
|
int data_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Get SDR Repository Info response structure
|
* The Get SDR Repository Info response structure
|
||||||
* From table 33-3 of the IPMI v2.0 spec
|
* From table 33-3 of the IPMI v2.0 spec
|
||||||
@ -711,11 +717,7 @@ struct get_sdr_repository_info_rsp {
|
|||||||
#endif
|
#endif
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
struct ipmi_sdr_iterator {
|
||||||
|
|
||||||
|
|
||||||
struct ipmi_sdr_iterator
|
|
||||||
{
|
|
||||||
uint16_t reservation;
|
uint16_t reservation;
|
||||||
int total;
|
int total;
|
||||||
int next;
|
int next;
|
||||||
@ -747,78 +749,109 @@ static const char * unit_desc[] __attribute__((unused)) = {
|
|||||||
"lumen", "lux", "Candela",
|
"lumen", "lux", "Candela",
|
||||||
"kPa", "PSI", "Newton",
|
"kPa", "PSI", "Newton",
|
||||||
"CFM", "RPM", "Hz",
|
"CFM", "RPM", "Hz",
|
||||||
"microsecond", "millisecond", "second", "minute", "hour", "day", "week",
|
"microsecond", "millisecond", "second", "minute", "hour",
|
||||||
"mil", "inches", "feet", "cu in", "cu feet", "mm", "cm", "m", "cu cm", "cu m",
|
"day", "week", "mil", "inches", "feet", "cu in", "cu feet",
|
||||||
"liters", "fluid ounce",
|
"mm", "cm", "m", "cu cm", "cu m", "liters", "fluid ounce",
|
||||||
"radians", "steradians", "revolutions", "cycles", "gravities",
|
"radians", "steradians", "revolutions", "cycles",
|
||||||
"ounce", "pound", "ft-lb", "oz-in",
|
"gravities", "ounce", "pound", "ft-lb", "oz-in", "gauss",
|
||||||
"gauss", "gilberts", "henry", "millihenry",
|
"gilberts", "henry", "millihenry", "farad", "microfarad",
|
||||||
"farad", "microfarad", "ohms", "siemens", "mole", "becquerel",
|
"ohms", "siemens", "mole", "becquerel", "PPM", "reserved",
|
||||||
"PPM", "reserved",
|
"Decibels", "DbA", "DbC", "gray", "sievert",
|
||||||
"Decibels", "DbA", "DbC",
|
"color temp deg K", "bit", "kilobit", "megabit", "gigabit",
|
||||||
"gray", "sievert", "color temp deg K",
|
"byte", "kilobyte", "megabyte", "gigabyte", "word", "dword",
|
||||||
"bit", "kilobit", "megabit", "gigabit",
|
"qword", "line", "hit", "miss", "retry", "reset",
|
||||||
"byte", "kilobyte", "megabyte", "gigabyte",
|
"overflow", "underrun", "collision", "packets", "messages",
|
||||||
"word", "dword", "qword", "line",
|
"characters", "error", "correctable error", "uncorrectable error",};
|
||||||
"hit", "miss", "retry", "reset",
|
|
||||||
"overflow", "underrun",
|
|
||||||
"collision", "packets",
|
|
||||||
"messages", "characters",
|
|
||||||
"error", "correctable error", "uncorrectable error",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* sensor type codes (IPMI v1.5 table 36.3) */
|
/* sensor type codes (IPMI v1.5 table 36.3) */
|
||||||
#define SENSOR_TYPE_MAX 0x29
|
#define SENSOR_TYPE_MAX 0x29
|
||||||
static const char *sensor_type_desc[] __attribute__ ((unused)) = {
|
static const char *sensor_type_desc[] __attribute__ ((unused)) = {
|
||||||
"reserved",
|
"reserved",
|
||||||
"Temperature", "Voltage", "Current", "Fan", "Physical Security", "Platform Security",
|
"Temperature", "Voltage", "Current", "Fan",
|
||||||
"Processor", "Power Supply", "Power Unit", "Cooling Device", "Other", "Memory", "Drive Slot / Bay",
|
"Physical Security", "Platform Security", "Processor",
|
||||||
"POST Memory Resize", "System Firmwares", "Event Logging Disabled", "Watchdog", "System Event",
|
"Power Supply", "Power Unit", "Cooling Device", "Other",
|
||||||
"Critical Interrupt", "Button", "Module / Board", "Microcontroller", "Add-in Card",
|
"Memory", "Drive Slot / Bay", "POST Memory Resize",
|
||||||
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect", "Terminator", "System Boot Initiated",
|
"System Firmwares", "Event Logging Disabled", "Watchdog",
|
||||||
"Boot Error", "OS Boot", "OS Critical Stop", "Slot / Connector", "System ACPI Power State", "Watchdog",
|
"System Event", "Critical Interrupt", "Button",
|
||||||
"Platform Alert", "Entity Presence", "Monitor ASIC", "LAN", "Management Subsystem Health", "Battery"
|
"Module / Board", "Microcontroller", "Add-in Card",
|
||||||
};
|
"Chassis", "Chip Set", "Other FRU", "Cable / Interconnect",
|
||||||
|
"Terminator", "System Boot Initiated", "Boot Error",
|
||||||
|
"OS Boot", "OS Critical Stop", "Slot / Connector",
|
||||||
|
"System ACPI Power State", "Watchdog", "Platform Alert",
|
||||||
|
"Entity Presence", "Monitor ASIC", "LAN",
|
||||||
|
"Management Subsystem Health", "Battery"};
|
||||||
|
|
||||||
struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf);
|
struct ipmi_sdr_iterator *ipmi_sdr_start(struct ipmi_intf *intf);
|
||||||
struct sdr_get_rs * ipmi_sdr_get_next_header(struct ipmi_intf * intf, struct ipmi_sdr_iterator * i);
|
struct sdr_get_rs *ipmi_sdr_get_next_header(struct ipmi_intf *intf,
|
||||||
uint8_t * ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header, struct ipmi_sdr_iterator * i);
|
struct ipmi_sdr_iterator *i);
|
||||||
|
uint8_t *ipmi_sdr_get_record(struct ipmi_intf *intf, struct sdr_get_rs *header,
|
||||||
|
struct ipmi_sdr_iterator *i);
|
||||||
void ipmi_sdr_end(struct ipmi_intf *intf, struct ipmi_sdr_iterator *i);
|
void ipmi_sdr_end(struct ipmi_intf *intf, struct ipmi_sdr_iterator *i);
|
||||||
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
|
int ipmi_sdr_print_sdr(struct ipmi_intf *intf, uint8_t type);
|
||||||
int ipmi_sdr_print_rawentry(struct ipmi_intf * intf, uint8_t type, uint8_t * raw, int len);
|
int ipmi_sdr_print_rawentry(struct ipmi_intf *intf, uint8_t type, uint8_t * raw,
|
||||||
int ipmi_sdr_print_listentry(struct ipmi_intf * intf, struct sdr_record_list * entry);
|
int len);
|
||||||
|
int ipmi_sdr_print_listentry(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_list *entry);
|
||||||
char *ipmi_sdr_get_unit_string(uint8_t type, uint8_t base, uint8_t modifier);
|
char *ipmi_sdr_get_unit_string(uint8_t type, uint8_t base, uint8_t modifier);
|
||||||
const char * ipmi_sdr_get_status(struct sdr_record_full_sensor * sensor, uint8_t stat);
|
const char *ipmi_sdr_get_status(struct sdr_record_full_sensor *sensor,
|
||||||
double sdr_convert_sensor_reading(struct sdr_record_full_sensor * sensor, uint8_t val);
|
uint8_t stat);
|
||||||
uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor * sensor, double val);
|
double sdr_convert_sensor_reading(struct sdr_record_full_sensor *sensor,
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading(struct ipmi_intf * intf, uint8_t sensor);
|
uint8_t val);
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf * intf, uint8_t sensor, uint8_t target);
|
uint8_t sdr_convert_sensor_value_to_raw(struct sdr_record_full_sensor *sensor,
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_thresholds(struct ipmi_intf * intf, uint8_t sensor);
|
double val);
|
||||||
struct ipmi_rs * ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf * intf, uint8_t sensor);
|
struct ipmi_rs *ipmi_sdr_get_sensor_reading(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor,
|
||||||
|
uint8_t target);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
|
struct ipmi_rs *ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor);
|
||||||
const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
const char *ipmi_sdr_get_sensor_type_desc(const uint8_t type);
|
||||||
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, uint16_t * reserve_id);
|
int ipmi_sdr_get_reservation(struct ipmi_intf *intf, uint16_t * reserve_id);
|
||||||
|
|
||||||
|
int ipmi_sdr_print_sensor_full(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_full_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_compact(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_compact_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_eventonly_sensor *sensor);
|
||||||
|
int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_generic_locator
|
||||||
|
*fru);
|
||||||
|
int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_fru_locator *fru);
|
||||||
|
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_mc_locator *mc);
|
||||||
|
int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf *intf,
|
||||||
|
struct sdr_record_entity_assoc *assoc);
|
||||||
|
|
||||||
int ipmi_sdr_print_sensor_full(struct ipmi_intf * intf, struct sdr_record_full_sensor * sensor);
|
struct sdr_record_list *ipmi_sdr_find_sdr_byentity(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_compact(struct ipmi_intf * intf, struct sdr_record_compact_sensor * sensor);
|
struct entity_id *entity);
|
||||||
int ipmi_sdr_print_sensor_eventonly(struct ipmi_intf * intf, struct sdr_record_eventonly_sensor * sensor);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_generic_locator(struct ipmi_intf * intf, struct sdr_record_generic_locator * fru);
|
uint8_t num, uint8_t type);
|
||||||
int ipmi_sdr_print_sensor_fru_locator(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf *intf,
|
||||||
int ipmi_sdr_print_sensor_mc_locator(struct ipmi_intf * intf, struct sdr_record_mc_locator * mc);
|
uint8_t type);
|
||||||
int ipmi_sdr_print_sensor_entity_assoc(struct ipmi_intf * intf, struct sdr_record_entity_assoc * assoc);
|
struct sdr_record_list *ipmi_sdr_find_sdr_byid(struct ipmi_intf *intf,
|
||||||
|
char *id);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_byentity(struct ipmi_intf * intf, struct entity_id * entity);
|
struct sdr_record_list *ipmi_sdr_find_sdr_bytype(struct ipmi_intf *intf,
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bynumtype(struct ipmi_intf * intf, uint8_t num, uint8_t type);
|
uint8_t type);
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bysensortype(struct ipmi_intf * intf, uint8_t type);
|
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_byid(struct ipmi_intf * intf, char * id);
|
|
||||||
struct sdr_record_list * ipmi_sdr_find_sdr_bytype(struct ipmi_intf * intf, uint8_t type);
|
|
||||||
int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
int ipmi_sdr_list_cache(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
int ipmi_sdr_list_cache_fromfile(struct ipmi_intf *intf, const char *ifile);
|
||||||
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
void ipmi_sdr_list_empty(struct ipmi_intf *intf);
|
||||||
int ipmi_sdr_print_info(struct ipmi_intf *intf);
|
int ipmi_sdr_print_info(struct ipmi_intf *intf);
|
||||||
void ipmi_sdr_print_discrete_state(const char * desc, uint8_t sensor_type, uint8_t event_type, uint8_t state1, uint8_t state2);
|
void ipmi_sdr_print_discrete_state(const char *desc, uint8_t sensor_type,
|
||||||
void ipmi_sdr_print_discrete_state_mini(const char * separator, uint8_t sensor_type, uint8_t event_type, uint8_t state1, uint8_t state2);
|
uint8_t event_type, uint8_t state1,
|
||||||
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf * intf, uint8_t sensor_num, uint8_t sensor_type, uint8_t event_type, int numeric_fmt);
|
uint8_t state2);
|
||||||
int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf * intf, uint8_t sensor_num, uint8_t sensor_type, uint8_t event_type, int numeric_fmt);
|
void ipmi_sdr_print_discrete_state_mini(const char *separator,
|
||||||
|
uint8_t sensor_type, uint8_t event_type,
|
||||||
|
uint8_t state1, uint8_t state2);
|
||||||
|
int ipmi_sdr_print_sensor_event_status(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor_num, uint8_t sensor_type,
|
||||||
|
uint8_t event_type, int numeric_fmt);
|
||||||
|
int ipmi_sdr_print_sensor_event_enable(struct ipmi_intf *intf,
|
||||||
|
uint8_t sensor_num, uint8_t sensor_type,
|
||||||
|
uint8_t event_type, int numeric_fmt);
|
||||||
|
|
||||||
#endif /* IPMI_SDR_H */
|
#endif /* IPMI_SDR_H */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -53,8 +53,7 @@ static
|
|||||||
struct ipmi_rs *
|
struct ipmi_rs *
|
||||||
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
||||||
uint8_t sensor,
|
uint8_t sensor,
|
||||||
uint8_t threshold,
|
uint8_t threshold, uint8_t setting)
|
||||||
uint8_t setting)
|
|
||||||
{
|
{
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
static struct sensor_set_thresh_rq set_thresh_rq;
|
static struct sensor_set_thresh_rq set_thresh_rq;
|
||||||
@ -119,12 +118,9 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
val = rsp->data[0];
|
val = rsp->data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IMPLEMENTED */
|
/* NOT IMPLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (verbose == 0) {
|
if (verbose == 0) {
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
@ -133,14 +129,10 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
if (validread) {
|
if (validread) {
|
||||||
printf("| 0x%-8x | %-10s | 0x%02x%02x",
|
printf("| 0x%-8x | %-10s | 0x%02x%02x",
|
||||||
val,
|
val,
|
||||||
unitstr,
|
unitstr, rsp->data[2], rsp->data[3]);
|
||||||
rsp->data[2],
|
|
||||||
rsp->data[3]);
|
|
||||||
} else {
|
} else {
|
||||||
printf("| %-10s | %-10s | %-6s",
|
printf("| %-10s | %-10s | %-6s",
|
||||||
"na",
|
"na", unitstr, "na");
|
||||||
unitstr,
|
|
||||||
"na");
|
|
||||||
}
|
}
|
||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
@ -152,7 +144,8 @@ ipmi_sensor_print_full_discrete(struct ipmi_intf * intf,
|
|||||||
printf(" Entity ID : %d.%d\n",
|
printf(" Entity ID : %d.%d\n",
|
||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
printf(" Sensor Type (Discrete): %s\n",
|
printf(" Sensor Type (Discrete): %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
|
type));
|
||||||
ipmi_sdr_print_discrete_state("States Asserted",
|
ipmi_sdr_print_discrete_state("States Asserted",
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
@ -211,8 +204,7 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
* Figure out units
|
* Figure out units
|
||||||
*/
|
*/
|
||||||
memset(unitstr, 0, sizeof (unitstr));
|
memset(unitstr, 0, sizeof (unitstr));
|
||||||
switch (sensor->unit.modifier)
|
switch (sensor->unit.modifier) {
|
||||||
{
|
|
||||||
case 2:
|
case 2:
|
||||||
i += snprintf(unitstr, sizeof (unitstr), "%s * %s",
|
i += snprintf(unitstr, sizeof (unitstr), "%s * %s",
|
||||||
unit_desc[sensor->unit.type.base],
|
unit_desc[sensor->unit.type.base],
|
||||||
@ -237,14 +229,10 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
if (rsp == NULL)
|
if (rsp == NULL)
|
||||||
thresh_available = 0;
|
thresh_available = 0;
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IPMLEMENTED */
|
/* NOT IPMLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
if (verbose == 0) {
|
||||||
{
|
|
||||||
if (verbose == 0)
|
|
||||||
{
|
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
*/
|
*/
|
||||||
@ -256,43 +244,51 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
printf("| %-10s | %-10s | %-6s",
|
printf("| %-10s | %-10s | %-6s",
|
||||||
"na", unitstr, "na");
|
"na", unitstr, "na");
|
||||||
}
|
}
|
||||||
if (thresh_available)
|
if (thresh_available) {
|
||||||
{
|
|
||||||
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[3]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[3]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[2]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[2]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[1]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[1]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[4]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[4]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[5]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[5]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
||||||
printf("| %-10.3f", sdr_convert_sensor_reading(sensor, rsp->data[6]));
|
printf("| %-10.3f",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[6]));
|
||||||
else
|
else
|
||||||
printf("| %-10s", "na");
|
printf("| %-10s", "na");
|
||||||
}
|
} else {
|
||||||
else
|
printf
|
||||||
{
|
("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Sensor ID : %s (0x%x)\n",
|
printf("Sensor ID : %s (0x%x)\n",
|
||||||
id, sensor->keys.sensor_num);
|
id, sensor->keys.sensor_num);
|
||||||
|
|
||||||
@ -300,66 +296,89 @@ ipmi_sensor_print_full_analog(struct ipmi_intf * intf,
|
|||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
|
|
||||||
printf(" Sensor Type (Analog) : %s\n",
|
printf(" Sensor Type (Analog) : %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
|
type));
|
||||||
|
|
||||||
printf(" Sensor Reading : ");
|
printf(" Sensor Reading : ");
|
||||||
if (validread) {
|
if (validread) {
|
||||||
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
uint16_t raw_tol = __TO_TOL(sensor->mtol);
|
||||||
double tol = sdr_convert_sensor_reading(sensor, raw_tol * 2);
|
double tol =
|
||||||
|
sdr_convert_sensor_reading(sensor,
|
||||||
|
raw_tol * 2);
|
||||||
printf("%.*f (+/- %.*f) %s\n",
|
printf("%.*f (+/- %.*f) %s\n",
|
||||||
(val==(int)val) ? 0 : 3,
|
(val == (int) val) ? 0 : 3, val,
|
||||||
val,
|
(tol == (int) tol) ? 0 : 3, tol,
|
||||||
(tol==(int)tol) ? 0 : 3,
|
|
||||||
tol,
|
|
||||||
unitstr);
|
unitstr);
|
||||||
printf(" Status : %s\n", status ? : "");
|
printf(" Status : %s\n",
|
||||||
|
status ? : "");
|
||||||
|
|
||||||
if (thresh_available)
|
if (thresh_available) {
|
||||||
{
|
if (rsp->
|
||||||
if (rsp->data[0] & LOWER_NON_RECOV_SPECIFIED)
|
data[0] & LOWER_NON_RECOV_SPECIFIED)
|
||||||
printf(" Lower Non-Recoverable : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[3]));
|
(" Lower Non-Recoverable : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[3]));
|
||||||
else
|
else
|
||||||
printf(" Lower Non-Recoverable : na\n");
|
printf
|
||||||
|
(" Lower Non-Recoverable : na\n");
|
||||||
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
if (rsp->data[0] & LOWER_CRIT_SPECIFIED)
|
||||||
printf(" Lower Critical : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[2]));
|
(" Lower Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[2]));
|
||||||
else
|
else
|
||||||
printf(" Lower Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & LOWER_NON_CRIT_SPECIFIED)
|
(" Lower Critical : na\n");
|
||||||
printf(" Lower Non-Critical : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[1]));
|
data[0] & LOWER_NON_CRIT_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Lower Non-Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[1]));
|
||||||
else
|
else
|
||||||
printf(" Lower Non-Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & UPPER_NON_CRIT_SPECIFIED)
|
(" Lower Non-Critical : na\n");
|
||||||
printf(" Upper Non-Critical : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[4]));
|
data[0] & UPPER_NON_CRIT_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Upper Non-Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[4]));
|
||||||
else
|
else
|
||||||
printf(" Upper Non-Critical : na\n");
|
printf
|
||||||
|
(" Upper Non-Critical : na\n");
|
||||||
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
if (rsp->data[0] & UPPER_CRIT_SPECIFIED)
|
||||||
printf(" Upper Critical : %.3f\n",
|
printf
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[5]));
|
(" Upper Critical : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[5]));
|
||||||
else
|
else
|
||||||
printf(" Upper Critical : na\n");
|
printf
|
||||||
if (rsp->data[0] & UPPER_NON_RECOV_SPECIFIED)
|
(" Upper Critical : na\n");
|
||||||
printf(" Upper Non-Recoverable : %.3f\n",
|
if (rsp->
|
||||||
sdr_convert_sensor_reading(sensor, rsp->data[6]));
|
data[0] & UPPER_NON_RECOV_SPECIFIED)
|
||||||
|
printf
|
||||||
|
(" Upper Non-Recoverable : %.3f\n",
|
||||||
|
sdr_convert_sensor_reading
|
||||||
|
(sensor, rsp->data[6]));
|
||||||
else
|
else
|
||||||
printf(" Upper Non-Recoverable : na\n");
|
printf
|
||||||
|
(" Upper Non-Recoverable : na\n");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Not Present\n");
|
printf("Not Present\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ipmi_sdr_print_sensor_event_status(intf,
|
ipmi_sdr_print_sensor_event_status(intf,
|
||||||
sensor->keys.sensor_num,
|
sensor->keys.
|
||||||
|
sensor_num,
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
ANALOG_SENSOR);
|
ANALOG_SENSOR);
|
||||||
ipmi_sdr_print_sensor_event_enable(intf,
|
ipmi_sdr_print_sensor_event_enable(intf,
|
||||||
sensor->keys.sensor_num,
|
sensor->keys.
|
||||||
|
sensor_num,
|
||||||
sensor->sensor.type,
|
sensor->sensor.type,
|
||||||
sensor->event_type,
|
sensor->event_type,
|
||||||
ANALOG_SENSOR);
|
ANALOG_SENSOR);
|
||||||
@ -414,14 +433,10 @@ ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
|||||||
val = rsp->data[0];
|
val = rsp->data[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csv_output)
|
if (csv_output) {
|
||||||
{
|
|
||||||
/* NOT IMPLEMENTED */
|
/* NOT IMPLEMENTED */
|
||||||
}
|
} else {
|
||||||
else
|
if (!verbose) {
|
||||||
{
|
|
||||||
if (!verbose)
|
|
||||||
{
|
|
||||||
/* output format
|
/* output format
|
||||||
* id value units status thresholds....
|
* id value units status thresholds....
|
||||||
*/
|
*/
|
||||||
@ -439,17 +454,19 @@ ipmi_sensor_print_compact(struct ipmi_intf * intf,
|
|||||||
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
printf("| %-10s| %-10s| %-10s| %-10s| %-10s| %-10s",
|
||||||
"na", "na", "na", "na", "na", "na");
|
"na", "na", "na", "na", "na", "na");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Sensor ID : %s (0x%x)\n",
|
printf("Sensor ID : %s (0x%x)\n",
|
||||||
id, sensor->keys.sensor_num);
|
id, sensor->keys.sensor_num);
|
||||||
printf(" Entity ID : %d.%d\n",
|
printf(" Entity ID : %d.%d\n",
|
||||||
sensor->entity.id, sensor->entity.instance);
|
sensor->entity.id, sensor->entity.instance);
|
||||||
printf(" Sensor Type (Discrete): %s\n",
|
printf(" Sensor Type (Discrete): %s\n",
|
||||||
ipmi_sdr_get_sensor_type_desc(sensor->sensor.type));
|
ipmi_sdr_get_sensor_type_desc(sensor->sensor.
|
||||||
ipmi_sdr_print_discrete_state("States Asserted", sensor->sensor.type,
|
type));
|
||||||
sensor->event_type, rsp->data[2], rsp->data[3]);
|
ipmi_sdr_print_discrete_state("States Asserted",
|
||||||
|
sensor->sensor.type,
|
||||||
|
sensor->event_type,
|
||||||
|
rsp->data[2],
|
||||||
|
rsp->data[3]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -472,24 +489,28 @@ ipmi_sensor_list(struct ipmi_intf * intf)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL)
|
while ((header = ipmi_sdr_get_next_header(intf, itr)) != NULL) {
|
||||||
{
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
uint8_t *rec;
|
uint8_t *rec;
|
||||||
|
|
||||||
rec = ipmi_sdr_get_record(intf, header, itr);
|
rec = ipmi_sdr_get_record(intf, header, itr);
|
||||||
if (rec == NULL)
|
if (rec == NULL) {
|
||||||
|
lprintf(LOG_DEBUG, "rec == NULL");
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
switch(header->type)
|
switch (header->type) {
|
||||||
{
|
|
||||||
case SDR_RECORD_TYPE_FULL_SENSOR:
|
case SDR_RECORD_TYPE_FULL_SENSOR:
|
||||||
r = ipmi_sensor_print_full(intf,
|
r = ipmi_sensor_print_full(intf,
|
||||||
(struct sdr_record_full_sensor *)rec);
|
(struct
|
||||||
|
sdr_record_full_sensor *)
|
||||||
|
rec);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||||
r = ipmi_sensor_print_compact(intf,
|
r = ipmi_sensor_print_compact(intf,
|
||||||
(struct sdr_record_compact_sensor *)rec);
|
(struct
|
||||||
|
sdr_record_compact_sensor
|
||||||
|
*) rec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(rec);
|
free(rec);
|
||||||
@ -513,7 +534,6 @@ static const struct valstr threshold_vals[] = {
|
|||||||
{0x00, NULL},
|
{0x00, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__ipmi_sensor_set_threshold(struct ipmi_intf *intf,
|
__ipmi_sensor_set_threshold(struct ipmi_intf *intf,
|
||||||
uint8_t num, uint8_t mask, uint8_t setting)
|
uint8_t num, uint8_t mask, uint8_t setting)
|
||||||
@ -535,7 +555,6 @@ __ipmi_sensor_set_threshold(struct ipmi_intf * intf,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
ipmi_sensor_set_threshold(struct ipmi_intf *intf, int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -547,24 +566,33 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
struct sdr_record_list *sdr;
|
struct sdr_record_list *sdr;
|
||||||
|
|
||||||
if (argc < 3 || strncmp(argv[0], "help", 4) == 0)
|
if (argc < 3 || strncmp(argv[0], "help", 4) == 0) {
|
||||||
{
|
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> <threshold> <setting>");
|
lprintf(LOG_NOTICE, "sensor thresh <id> <threshold> <setting>");
|
||||||
lprintf(LOG_NOTICE, " id : name of the sensor for which threshold is to be set");
|
lprintf(LOG_NOTICE,
|
||||||
|
" id : name of the sensor for which threshold is to be set");
|
||||||
lprintf(LOG_NOTICE, " threshold : which threshold to set");
|
lprintf(LOG_NOTICE, " threshold : which threshold to set");
|
||||||
lprintf(LOG_NOTICE, " unr = upper non-recoverable");
|
lprintf(LOG_NOTICE,
|
||||||
|
" unr = upper non-recoverable");
|
||||||
lprintf(LOG_NOTICE, " ucr = upper critical");
|
lprintf(LOG_NOTICE, " ucr = upper critical");
|
||||||
lprintf(LOG_NOTICE, " unc = upper non-critical");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " lnc = lower non-critical");
|
" unc = upper non-critical");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" lnc = lower non-critical");
|
||||||
lprintf(LOG_NOTICE, " lcr = lower critical");
|
lprintf(LOG_NOTICE, " lcr = lower critical");
|
||||||
lprintf(LOG_NOTICE, " lnr = lower non-recoverable");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " setting : the value to set the threshold to");
|
" lnr = lower non-recoverable");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" setting : the value to set the threshold to");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " Set all lower thresholds at the same time");
|
"sensor thresh <id> lower <lnr> <lcr> <lnc>");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" Set all lower thresholds at the same time");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
lprintf(LOG_NOTICE, "sensor thresh <id> upper <unc> <ucr> <unr>");
|
lprintf(LOG_NOTICE,
|
||||||
lprintf(LOG_NOTICE, " Set all upper thresholds at the same time");
|
"sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
" Set all upper thresholds at the same time");
|
||||||
lprintf(LOG_NOTICE, "");
|
lprintf(LOG_NOTICE, "");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -574,25 +602,25 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
if (strncmp(thresh, "upper", 5) == 0) {
|
if (strncmp(thresh, "upper", 5) == 0) {
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR, "usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
lprintf(LOG_ERR,
|
||||||
|
"usage: sensor thresh <id> upper <unc> <ucr> <unr>");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
allUpper = 1;
|
allUpper = 1;
|
||||||
setting1 = (double) strtod(argv[2], NULL);
|
setting1 = (double) strtod(argv[2], NULL);
|
||||||
setting2 = (double) strtod(argv[3], NULL);
|
setting2 = (double) strtod(argv[3], NULL);
|
||||||
setting3 = (double) strtod(argv[4], NULL);
|
setting3 = (double) strtod(argv[4], NULL);
|
||||||
}
|
} else if (strncmp(thresh, "lower", 5) == 0) {
|
||||||
else if (strncmp(thresh, "lower", 5) == 0) {
|
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
lprintf(LOG_ERR, "usage: sensor thresh <id> lower <unc> <ucr> <unr>");
|
lprintf(LOG_ERR,
|
||||||
|
"usage: sensor thresh <id> lower <unc> <ucr> <unr>");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
allLower = 1;
|
allLower = 1;
|
||||||
setting1 = (double) strtod(argv[2], NULL);
|
setting1 = (double) strtod(argv[2], NULL);
|
||||||
setting2 = (double) strtod(argv[3], NULL);
|
setting2 = (double) strtod(argv[3], NULL);
|
||||||
setting3 = (double) strtod(argv[4], NULL);
|
setting3 = (double) strtod(argv[4], NULL);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setting1 = (double) atof(argv[2]);
|
setting1 = (double) atof(argv[2]);
|
||||||
if (strncmp(thresh, "unr", 3) == 0)
|
if (strncmp(thresh, "unr", 3) == 0)
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
@ -607,7 +635,9 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
else if (strncmp(thresh, "lnr", 3) == 0)
|
else if (strncmp(thresh, "lnr", 3) == 0)
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
else {
|
else {
|
||||||
lprintf(LOG_ERR, "Valid threshold '%s' for sensor '%s' not specified!", thresh, id);
|
lprintf(LOG_ERR,
|
||||||
|
"Valid threshold '%s' for sensor '%s' not specified!",
|
||||||
|
thresh, id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,58 +662,70 @@ ipmi_sensor_set_threshold(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
|
|
||||||
settingMask = UPPER_CRIT_SPECIFIED;
|
settingMask = UPPER_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting2);
|
val2str(settingMask, threshold_vals), setting2);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting2));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting2));
|
||||||
|
|
||||||
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
settingMask = UPPER_NON_RECOV_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting3);
|
val2str(settingMask, threshold_vals), setting3);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting3));
|
sensor_num, settingMask,
|
||||||
}
|
sdr_convert_sensor_value_to_raw
|
||||||
else if (allLower) {
|
(sdr->record.full, setting3));
|
||||||
|
} else if (allLower) {
|
||||||
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
settingMask = LOWER_NON_RECOV_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
|
|
||||||
settingMask = LOWER_CRIT_SPECIFIED;
|
settingMask = LOWER_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting2);
|
val2str(settingMask, threshold_vals), setting2);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting2));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting2));
|
||||||
|
|
||||||
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
settingMask = LOWER_NON_CRIT_SPECIFIED;
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting3);
|
val2str(settingMask, threshold_vals), setting3);
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting3));
|
sensor_num, settingMask,
|
||||||
}
|
sdr_convert_sensor_value_to_raw
|
||||||
else {
|
(sdr->record.full, setting3));
|
||||||
|
} else {
|
||||||
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
printf("Setting sensor \"%s\" %s threshold to %.3f\n",
|
||||||
sdr->record.full->id_string,
|
sdr->record.full->id_string,
|
||||||
val2str(settingMask, threshold_vals), setting1);
|
val2str(settingMask, threshold_vals), setting1);
|
||||||
|
|
||||||
ret = __ipmi_sensor_set_threshold(intf,
|
ret = __ipmi_sensor_set_threshold(intf,
|
||||||
sdr->record.full->keys.sensor_num, settingMask,
|
sdr->record.full->keys.
|
||||||
sdr_convert_sensor_value_to_raw(sdr->record.full, setting1));
|
sensor_num, settingMask,
|
||||||
|
sdr_convert_sensor_value_to_raw
|
||||||
|
(sdr->record.full, setting1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -723,16 +765,22 @@ ipmi_sensor_get(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
r = ipmi_sensor_print_full(intf, sdr->record.full);
|
r = ipmi_sensor_print_full(intf, sdr->record.full);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
case SDR_RECORD_TYPE_COMPACT_SENSOR:
|
||||||
r = ipmi_sensor_print_compact(intf, sdr->record.compact);
|
r = ipmi_sensor_print_compact(intf,
|
||||||
|
sdr->record.compact);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
case SDR_RECORD_TYPE_EVENTONLY_SENSOR:
|
||||||
r = ipmi_sdr_print_sensor_eventonly(intf, sdr->record.eventonly);
|
r = ipmi_sdr_print_sensor_eventonly(intf,
|
||||||
|
sdr->record.
|
||||||
|
eventonly);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
case SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR:
|
||||||
r = ipmi_sdr_print_sensor_fru_locator(intf, sdr->record.fruloc);
|
r = ipmi_sdr_print_sensor_fru_locator(intf,
|
||||||
|
sdr->record.
|
||||||
|
fruloc);
|
||||||
break;
|
break;
|
||||||
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
case SDR_RECORD_TYPE_MC_DEVICE_LOCATOR:
|
||||||
r = ipmi_sdr_print_sensor_mc_locator(intf, sdr->record.mcloc);
|
r = ipmi_sdr_print_sensor_mc_locator(intf,
|
||||||
|
sdr->record.mcloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
verbose = v;
|
verbose = v;
|
||||||
@ -751,22 +799,16 @@ ipmi_sensor_main(struct ipmi_intf * intf, int argc, char ** argv)
|
|||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
}
|
} else if (strncmp(argv[0], "help", 4) == 0) {
|
||||||
else if (strncmp(argv[0], "help", 4) == 0) {
|
|
||||||
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get");
|
lprintf(LOG_NOTICE, "Sensor Commands: list thresh get");
|
||||||
}
|
} else if (strncmp(argv[0], "list", 4) == 0) {
|
||||||
else if (strncmp(argv[0], "list", 4) == 0) {
|
|
||||||
rc = ipmi_sensor_list(intf);
|
rc = ipmi_sensor_list(intf);
|
||||||
}
|
} else if (strncmp(argv[0], "thresh", 5) == 0) {
|
||||||
else if (strncmp(argv[0], "thresh", 5) == 0) {
|
|
||||||
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_set_threshold(intf, argc - 1, &argv[1]);
|
||||||
}
|
} else if (strncmp(argv[0], "get", 3) == 0) {
|
||||||
else if (strncmp(argv[0], "get", 3) == 0) {
|
|
||||||
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
rc = ipmi_sensor_get(intf, argc - 1, &argv[1]);
|
||||||
}
|
} else {
|
||||||
else {
|
lprintf(LOG_ERR, "Invalid sensor command: %s", argv[0]);
|
||||||
lprintf(LOG_ERR, "Invalid sensor command: %s",
|
|
||||||
argv[0]);
|
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user