FreeBSD Bugzilla – Attachment 169122 Details for
Bug 208651
sysutils/conky: correct battery variables [patch]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Patch
conky-1.9.0-hmo.diff (text/plain), 1.94 KB, created by
Helge Oldach
on 2016-04-09 11:33:18 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Helge Oldach
Created:
2016-04-09 11:33:18 UTC
Size:
1.94 KB
patch
obsolete
>correct battery, battery_short, battery_percent and battery_bar >hmo090416 > >--- src/freebsd.c 2012-05-03 23:08:27.000000000 +0200 >+++ src/freebsd.c 2016-04-08 22:19:30.074556000 +0200 >@@ -468,7 +468,7 @@ > break; > case BATTERY_STATUS: > if (batstate == 1) // Discharging >- snprintf(buf, n, "remaining %d%%", batcapacity); >+ snprintf(buf, n, "remaining (%d%%)", batcapacity); > else > snprintf(buf, n, batstate == 2 ? "charging (%d%%)" : > (batstate == 7 ? "absent/on AC" : "charged (%d%%)"), >@@ -501,26 +501,10 @@ > > int get_battery_perct(const char *bat) > { >- union acpi_battery_ioctl_arg battio; >- int batnum, acpifd; >- int designcap, lastfulcap, batperct; >+ int batcapacity; > >- if ((battio.unit = batnum = check_bat(bat)) < 0) >- return 0; >- if ((acpifd = open("/dev/acpi", O_RDONLY)) < 0) { >- fprintf(stderr, "Can't open ACPI device\n"); >- return 0; >- } >- if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) == -1) { >- fprintf(stderr, "Unable to get info for battery unit %d\n", batnum); >- return 0; >- } >- close(acpifd); >- designcap = battio.bif.dcap; >- lastfulcap = battio.bif.lfcap; >- batperct = (designcap > 0 && lastfulcap > 0) ? >- (int) (((float) lastfulcap / designcap) * 100) : 0; >- return batperct > 100 ? 100 : batperct; >+ get_battery_stats(NULL, &batcapacity, NULL, NULL); >+ return batcapacity; > } > > int get_battery_perct_bar(const char *bar) >@@ -970,11 +974,14 @@ > if (0 == strncmp("charging", buffer, 8)) { > buffer[0] = 'C'; > memmove(buffer + 1, buffer + 8, n - 8); >- } else if (0 == strncmp("discharging", buffer, 11)) { >+ } else if (0 == strncmp("remaining", buffer, 9)) { > buffer[0] = 'D'; >- memmove(buffer + 1, buffer + 11, n - 11); >+ memmove(buffer + 1, buffer + 9, n - 9); >+ } else if (0 == strncmp("charged", buffer, 7)) { >+ buffer[0] = 'F'; >+ memmove(buffer + 1, buffer + 7, n - 7); > } else if (0 == strncmp("absent/on AC", buffer, 12)) { >- buffer[0] = 'A'; >+ buffer[0] = 'N'; > memmove(buffer + 1, buffer + 12, n - 12); > } > }
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 Raw
Actions:
View
Attachments on
bug 208651
: 169122