Index: usr.sbin/mfiutil/mfi_show.c =================================================================== --- usr.sbin/mfiutil/mfi_show.c (revision 225511) +++ usr.sbin/mfiutil/mfi_show.c (working copy) @@ -134,6 +134,7 @@ } MFI_COMMAND(show, adapter, show_adapter); +#define MFI_STAT_BBU_NO_CAPACITY_INFO 0x3d /* to mfireg.h */ static int show_battery(int ac, char **av) { @@ -141,7 +142,7 @@ struct mfi_bbu_design_info design; struct mfi_bbu_status stat; uint8_t status; - int comma, error, fd; + int comma, error, fd, show_capacity = 1; if (ac != 1) { warnx("show battery: extra arguments"); @@ -157,16 +158,17 @@ if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_CAPACITY_INFO, &cap, sizeof(cap), NULL, 0, &status) < 0) { - if (status == MFI_STAT_NO_HW_PRESENT) { - printf("mfi%d: No battery present\n", mfi_unit); - close(fd); - return (0); - } error = errno; warn("Failed to get capacity info"); close(fd); return (error); } + if (status == MFI_STAT_NO_HW_PRESENT) { + printf("mfi%d: No battery present\n", mfi_unit); + close(fd); + return (0); + } else if (status == MFI_STAT_BBU_NO_CAPACITY_INFO) + show_capacity = 0; if (mfi_dcmd_command(fd, MFI_DCMD_BBU_GET_DESIGN_INFO, &design, sizeof(design), NULL, 0, NULL) < 0) { @@ -192,10 +194,14 @@ printf(" Model: %s\n", design.device_name); printf(" Chemistry: %s\n", design.device_chemistry); printf(" Design Capacity: %d mAh\n", design.design_capacity); - printf(" Full Charge Capacity: %d mAh\n", cap.full_charge_capacity); - printf(" Current Capacity: %d mAh\n", cap.remaining_capacity); - printf(" Charge Cycles: %d\n", cap.cycle_count); - printf(" Current Charge: %d%%\n", cap.relative_charge); + if (show_capacity) { + printf(" Full Charge Capacity: %d mAh\n", + cap.full_charge_capacity); + printf(" Current Capacity: %d mAh\n", + cap.remaining_capacity); + printf(" Charge Cycles: %d\n", cap.cycle_count); + printf(" Current Charge: %d%%\n", cap.relative_charge); + } printf(" Design Voltage: %d mV\n", design.design_voltage); printf(" Current Voltage: %d mV\n", stat.voltage); printf(" Temperature: %d C\n", stat.temperature);