FreeBSD Bugzilla – Attachment 55347 Details for
Bug 83672
acpiconf with remaining battery life and time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.28 KB, created by
Rudolf Čejka
on 2005-07-18 15:40:33 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Rudolf Čejka
Created:
2005-07-18 15:40:33 UTC
Size:
1.28 KB
patch
obsolete
>--- usr.sbin/acpi/acpiconf/acpiconf.c.orig Sun Jul 17 16:13:52 2005 >+++ usr.sbin/acpi/acpiconf/acpiconf.c Sun Jul 17 16:32:49 2005 >@@ -91,6 +91,8 @@ > { > union acpi_battery_ioctl_arg battio; > const char *pwr_units; >+ u_int32_t dcap; >+ int h, m, s; > > if (num < 0 || num > 64) > err(EX_USAGE, "invalid battery %d", num); >@@ -108,6 +110,7 @@ > printf("Design capacity:\tUnknown\n"); > else > printf("Design capacity:\t%d %s\n", battio.bif.dcap, pwr_units); >+ dcap = battio.bif.dcap; > if (battio.bif.lfcap == UNKNOWN_CAP) > printf("Last full capacity:\tUnknown\n"); > else >@@ -151,6 +154,22 @@ > else > printf("Remaining capacity:\t%d %s\n", battio.bst.cap, > pwr_units); >+ if (battio.bst.cap == UNKNOWN_CAP || >+ dcap == UNKNOWN_CAP || dcap == 0) >+ printf("Remaining life:\t\tUnknown\n"); >+ else >+ printf("Remaining life:\t\t%.1f %%\n", >+ 100.0 * battio.bst.cap / dcap); >+ h = (battio.bst.state & ACPI_BATT_STAT_DISCHARG && >+ battio.bst.cap != UNKNOWN_CAP && >+ battio.bst.rate != UNKNOWN_CAP && >+ battio.bst.rate != 0) ? >+ 3600 * battio.bst.cap / battio.bst.rate : 0; >+ s = h % 60; >+ h /= 60; >+ m = h % 60; >+ h /= 60; >+ printf("Remaining time:\t\t%d:%02d:%02d\n", h, m, s); > if (battio.bst.volt == UNKNOWN_CAP) > printf("Volt:\t\t\tUnknown\n"); > else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 83672
:
55345
|
55346
| 55347 |
55348