|
Lines 90-96
Link Here
|
| 90 |
acpi_battinfo(int num) |
90 |
acpi_battinfo(int num) |
| 91 |
{ |
91 |
{ |
| 92 |
union acpi_battery_ioctl_arg battio; |
92 |
union acpi_battery_ioctl_arg battio; |
| 93 |
const char *pwr_units; |
93 |
const char *pwr_units, *pwr_units2; |
| 94 |
u_int32_t dcap; |
94 |
u_int32_t dcap; |
| 95 |
int h, m, s; |
95 |
int h, m, s; |
| 96 |
|
96 |
|
|
Lines 101-110
Link Here
|
| 101 |
if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) == -1) |
101 |
if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) == -1) |
| 102 |
err(EX_IOERR, "get battery info (%d) failed", num); |
102 |
err(EX_IOERR, "get battery info (%d) failed", num); |
| 103 |
printf("Battery %d information\n", num); |
103 |
printf("Battery %d information\n", num); |
| 104 |
if (battio.bif.units == 0) |
104 |
if (battio.bif.units == 0) { |
| 105 |
pwr_units = "mWh"; |
105 |
pwr_units = "mWh"; |
| 106 |
else |
106 |
pwr_units2 = "mW"; |
|
|
107 |
} else { |
| 107 |
pwr_units = "mAh"; |
108 |
pwr_units = "mAh"; |
|
|
109 |
pwr_units2 = "mA"; |
| 110 |
} |
| 108 |
|
111 |
|
| 109 |
if (battio.bif.dcap == UNKNOWN_CAP) |
112 |
if (battio.bif.dcap == UNKNOWN_CAP) |
| 110 |
printf("Design capacity:\tUnknown\n"); |
113 |
printf("Design capacity:\tUnknown\n"); |
|
Lines 148-154
Link Here
|
| 148 |
printf("Present rate:\t\tUnknown\n"); |
151 |
printf("Present rate:\t\tUnknown\n"); |
| 149 |
else |
152 |
else |
| 150 |
printf("Present rate:\t\t%d %s\n", battio.bst.rate, |
153 |
printf("Present rate:\t\t%d %s\n", battio.bst.rate, |
| 151 |
pwr_units); |
154 |
pwr_units2); |
| 152 |
if (battio.bst.cap == UNKNOWN_CAP) |
155 |
if (battio.bst.cap == UNKNOWN_CAP) |
| 153 |
printf("Remaining capacity:\tUnknown\n"); |
156 |
printf("Remaining capacity:\tUnknown\n"); |
| 154 |
else |
157 |
else |