Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 89285 Details for
Bug 136958
kismet battery status on mac
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for show battery status on pmu based machines
kismet_pmu2.patch (text/plain), 3.98 KB, created by
Pierluigi Petrelli
on 2006-06-16 00:59:09 UTC
(
hide
)
Description:
patch for show battery status on pmu based machines
Filename:
MIME Type:
Creator:
Pierluigi Petrelli
Created:
2006-06-16 00:59:09 UTC
Size:
3.98 KB
patch
obsolete
>diff -Naur kismet-2006-04-R1/panelfront.cc kismet-2006-04-R1_pmu/panelfront.cc >--- kismet-2006-04-R1/panelfront.cc 2005-06-29 20:04:43.000000000 +0200 >+++ kismet-2006-04-R1_pmu/panelfront.cc 2006-06-16 09:40:20.000000000 +0200 >@@ -457,6 +457,14 @@ > use_acpi = 1; > fclose(acpinfo); > } >+ // Do we have an pmu file? >+ FILE *pmuinfo = fopen("/proc/pmu/battery_0", "r"); >+ if (pmuinfo == NULL) { >+ use_pmu = 0; >+ } else { >+ use_pmu = 1; >+ fclose(pmuinfo); >+ } > > probe_group = NULL; > data_group = NULL; >@@ -1390,9 +1398,10 @@ > // Now fetch the APM data (if so desired) > if (monitor_bat) { > #ifdef SYS_LINUX >- char buf[128]; >+ char buf[128]; > >- if (use_acpi == 0) { >+ if (use_acpi == 0) { >+ if (use_pmu == 0) { > // Lifted from gkrellm's battery monitor, fetch the APM info > FILE *apm; > int ac_line_status, battery_status, flag, percentage, apm_time; >@@ -1435,7 +1444,83 @@ > > if (!strncmp(units, "min", 32)) > bat_time *= 60; >- } >+ >+ } >+ }else{ //code for pmu >+ >+ FILE *infopmu; >+ FILE *batpmu; >+ char input[BUFSIZ]; >+ int i = 0; >+ int total_remain = 0; >+ int total_cap = 0; >+ >+ >+ if ((infopmu = fopen("/proc/pmu/info", "r")) == NULL) { >+ bat_available = 0 ; >+ }else { >+ >+ bat_available = 1 ; >+ fgets( input, BUFSIZ, infopmu); >+ fgets( input, BUFSIZ, infopmu); >+ fgets( input, BUFSIZ, infopmu); >+ >+ if (input[25] == '1') >+ bat_ac = 1; >+ else >+ bat_ac = 0; >+ >+ fclose(infopmu); >+ >+ if ((batpmu = fopen("/proc/pmu/battery_0", "r")) != NULL) { >+ >+ fgets( input, BUFSIZ, batpmu); >+ fgets( input, BUFSIZ, batpmu); >+ fgets( input, BUFSIZ, batpmu); >+ i=13; >+ while (input[i] != '\0') { >+ input[i-13] = input[i]; >+ i++; >+ } >+ input[i-13] = '\0'; >+ total_remain=atoi(input); >+ >+ fgets( input, BUFSIZ, batpmu); >+ i=13; >+ while (input[i] != '\0') { >+ input[i-13] = input[i]; >+ i++; >+ } >+ total_cap=atoi(input); >+ >+ fgets( input, BUFSIZ, batpmu); >+ fgets( input, BUFSIZ, batpmu); >+ fgets( input, BUFSIZ, batpmu); >+ i=13; >+ while (input[i] != '\0') { >+ input[i-13] = input[i]; >+ i++; >+ } >+ input[i-13] = '\0'; >+ bat_time=atoi(input); >+ >+ bat_percentage = int((float(total_remain) / total_cap) * 100); >+ >+ if ((bat_ac) && (bat_time)) >+ bat_charging=1; >+ else >+ bat_charging=0; >+ >+ fclose(batpmu); >+ } >+ >+ } >+ >+ >+ >+ >+ } // end pmu code >+ > } else { > DIR *batteries, *ac_adapters; > struct dirent *this_battery, *this_adapter; >diff -Naur kismet-2006-04-R1/panelfront.h kismet-2006-04-R1_pmu/panelfront.h >--- kismet-2006-04-R1/panelfront.h 2005-06-29 14:50:09.000000000 +0200 >+++ kismet-2006-04-R1_pmu/panelfront.h 2006-06-16 02:34:39.000000000 +0200 >@@ -402,6 +402,7 @@ > > // Battery monitoring states > unsigned int use_acpi; >+ unsigned int use_pmu; > unsigned int monitor_bat; > unsigned int bat_percentage; > unsigned int bat_time;
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 136958
: 89285