FreeBSD Bugzilla – Attachment 155290 Details for
Bug 193671
[acpiconf] Extra whitespace at the end of the State: line
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch to test
acpiconf.diff (text/plain), 1.46 KB, created by
Jung-uk Kim
on 2015-04-06 20:14:20 UTC
(
hide
)
Description:
A patch to test
Filename:
MIME Type:
Creator:
Jung-uk Kim
Created:
2015-04-06 20:14:20 UTC
Size:
1.46 KB
patch
obsolete
>Index: usr.sbin/acpi/acpiconf/acpiconf.c >=================================================================== >--- usr.sbin/acpi/acpiconf/acpiconf.c (revision 281158) >+++ usr.sbin/acpi/acpiconf/acpiconf.c (working copy) >@@ -136,16 +136,30 @@ acpi_battinfo(int num) > if (ioctl(acpifd, ACPIIO_BATT_GET_BATTINFO, &battio) == -1) > err(EX_IOERR, "get battery user info (%d) failed", num); > if (battio.battinfo.state != ACPI_BATT_STAT_NOT_PRESENT) { >- printf("State:\t\t\t"); >- if (battio.battinfo.state == 0) >- printf("high "); >- if (battio.battinfo.state & ACPI_BATT_STAT_CRITICAL) >- printf("critical "); >- if (battio.battinfo.state & ACPI_BATT_STAT_DISCHARG) >- printf("discharging "); >- if (battio.battinfo.state & ACPI_BATT_STAT_CHARGING) >- printf("charging "); >- printf("\n"); >+ const char *state; >+ switch (battio.battinfo.state & ACPI_BATT_STAT_BST_MASK) { >+ case 0: >+ state = "high"; >+ break; >+ case ACPI_BATT_STAT_DISCHARG: >+ state = "discharging"; >+ break; >+ case ACPI_BATT_STAT_CHARGING: >+ state = "charging"; >+ break; >+ case ACPI_BATT_STAT_CRITICAL: >+ state = "critical"; >+ break; >+ case ACPI_BATT_STAT_DISCHARG | ACPI_BATT_STAT_CRITICAL: >+ state = "critical discharging"; >+ break; >+ case ACPI_BATT_STAT_CHARGING | ACPI_BATT_STAT_CRITICAL: >+ state = "critical charging"; >+ break; >+ default: >+ state = "invalid"; >+ } >+ printf("State:\t\t\t%s\n", state); > if (battio.battinfo.cap == -1) > printf("Remaining capacity:\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 193671
: 155290