mirror of https://github.com/BOINC/boinc.git
client (Android): remove unused code
This commit is contained in:
parent
66589cbc5a
commit
e0871c380f
|
@ -418,121 +418,6 @@ bool HOST_INFO::host_is_running_on_batteries() {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
// Get battery state, charge percentage, and temperature
|
||||
//
|
||||
|
||||
static const char* battery_dirs[] = {
|
||||
"battery",
|
||||
"BAT0",
|
||||
"bq27520",
|
||||
"bq27200-0",
|
||||
"max17042-0",
|
||||
"ds2760-battery.0",
|
||||
NULL
|
||||
};
|
||||
|
||||
void HOST_INFO::get_battery_status() {
|
||||
static bool first = true;
|
||||
static FILE *fcap, *fhealth, *fstatus, *ftemp;
|
||||
FILE *f;
|
||||
battery_charge_pct = -1;
|
||||
battery_temperature_celsius = 0;
|
||||
char buf[256];
|
||||
char health[256];
|
||||
char status[256];
|
||||
|
||||
strcpy(health, "");
|
||||
strcpy(status, "");
|
||||
|
||||
if (first) {
|
||||
first = false;
|
||||
int i = 0;
|
||||
|
||||
// Find the battery location for this device.
|
||||
// matszpk has already collected a bunch of battery locations.
|
||||
//
|
||||
for (i = 0; battery_dirs[i] != NULL; i++) {
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/present",
|
||||
battery_dirs[i]
|
||||
);
|
||||
f = fopen(buf, "r");
|
||||
if (f != NULL) {
|
||||
fclose(f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/capacity",
|
||||
battery_dirs[i]
|
||||
);
|
||||
fcap = fopen(buf, "r");
|
||||
if (fcap) setbuf(fcap, NULL);
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/health",
|
||||
battery_dirs[i]
|
||||
);
|
||||
fhealth = fopen(buf, "r");
|
||||
if (fhealth) setbuf(fhealth, NULL);
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/status",
|
||||
battery_dirs[i]
|
||||
);
|
||||
fstatus = fopen(buf, "r");
|
||||
if (fstatus) setbuf(fstatus, NULL);
|
||||
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/temp",
|
||||
battery_dirs[i]
|
||||
);
|
||||
ftemp = fopen(buf, "r");
|
||||
if (ftemp) {
|
||||
setbuf(ftemp, NULL);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/batt_temp",
|
||||
battery_dirs[i]
|
||||
);
|
||||
ftemp = fopen(buf, "r");
|
||||
if (ftemp) setbuf(ftemp, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (fcap) {
|
||||
rewind(fcap);
|
||||
fscanf(fcap, "%d", &battery_charge_pct);
|
||||
}
|
||||
|
||||
if (fhealth) {
|
||||
rewind(fhealth);
|
||||
fgets(health, sizeof(health), fhealth);
|
||||
}
|
||||
|
||||
if (fstatus) {
|
||||
rewind(fstatus);
|
||||
fgets(status, sizeof(status), fstatus);
|
||||
}
|
||||
|
||||
battery_state = BATTERY_STATE_UNKNOWN;
|
||||
if (strstr(health, "Overheat")) {
|
||||
battery_state = BATTERY_STATE_OVERHEATED;
|
||||
} else if (strstr(status, "Not charging")) {
|
||||
battery_state = BATTERY_STATE_DISCHARGING;
|
||||
} else if (strstr(status, "Charging")) {
|
||||
battery_state = BATTERY_STATE_CHARGING;
|
||||
} else if (strstr(status, "Full")) {
|
||||
battery_state = BATTERY_STATE_FULL;
|
||||
}
|
||||
|
||||
if (ftemp) {
|
||||
int x;
|
||||
rewind(ftemp);
|
||||
if (fscanf(ftemp, "%d", &x) == 1) {
|
||||
battery_temperature_celsius = x/10.;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_LIKE_SYSTEM
|
||||
static void parse_meminfo_linux(HOST_INFO& host) {
|
||||
char buf[256];
|
||||
|
|
Loading…
Reference in New Issue