Index: atactl.c =================================================================== RCS file: /cvs/src/sbin/atactl/atactl.c,v retrieving revision 1.46 diff -u -p -r1.46 atactl.c --- atactl.c 20 Aug 2015 22:02:20 -0000 1.46 +++ atactl.c 3 Dec 2015 23:18:27 -0000 @@ -1604,6 +1604,7 @@ device_attr(int argc, char *argv[]) static const char hex[]="0123456789abcdef"; char raw[13], *format; int i, k, threshold_exceeded = 0; + uint64_t status; if (argc != 1) goto usage; @@ -1637,35 +1638,30 @@ device_attr(int argc, char *argv[]) } attr = attr_val.attribute; - thr = attr_thr.threshold; - - printf("Attributes table revision: %d\n", attr_val.revision); - printf("ID\tAttribute name\t\t\tThreshold\tValue\tRaw\n"); for (i = 0; i < 30; i++) { - if (thr[i].id != 0 && thr[i].id == attr[i].id) { - attr_name = valtostr(thr[i].id, ibm_attr_names); - if (attr_name == NULL) - attr_name = "Unknown"; - - for (k = 0; k < 6; k++) { - u_int8_t b; - b = attr[i].raw[6 - k]; - raw[k + k] = hex[b >> 4]; - raw[k + k + 1] = hex[b & 0x0f]; - } - raw[k + k] = '\0'; - if (thr[i].value >= attr[i].value) { - ++threshold_exceeded; - format = "%3d *%-32.32s %3d\t\t%3d\t0x%s\n"; - } else { - format = "%3d\t%-32.32s %3d\t\t%3d\t0x%s\n"; - } - printf(format, thr[i].id, attr_name, - thr[i].value, attr[i].value, raw); + if (attr[i].id == 0) + continue; + + memcpy(&status, &attr[i].id, sizeof(status)); + + for (k = 0; k < 6; k++) { + u_int8_t b; + b = attr[i].raw[6 - k]; + raw[k + k] = hex[b >> 4]; + raw[k + k + 1] = hex[b & 0x0f]; } + raw[k + k] = '\0'; + + printf("at 0x%02x 0x%04x 0x%02x 0x%s\n", attr[i].id, + letoh16(status), attr[i].value, raw); + } + thr = attr_thr.threshold; + for (i = 0; i < 30; i++) { + if (thr[i].id == 0) + continue; + + printf("th 0x%02x 0x%02x\n", thr[i].id, thr[i].value); } - if (threshold_exceeded) - fprintf(stderr, "One or more threshold values exceeded!\n"); return;