From 6012f9261f8658c1c932e0b8a4e597ffa2e33e2c Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 12 Feb 2013 17:58:31 -0500 Subject: [PATCH] Android: Remove debug code for Android, the required functions are called and function. Android: Remove separate copy_asset.sh script and make that the last part of the build_boinc.sh script. --- android/build_boinc.sh | 6 ++++++ android/copy_assets.sh | 18 ---------------- client/hostinfo_unix.cpp | 46 +++++----------------------------------- 3 files changed, 11 insertions(+), 59 deletions(-) delete mode 100755 android/copy_assets.sh diff --git a/android/build_boinc.sh b/android/build_boinc.sh index c11ac7b056..20be7735bd 100755 --- a/android/build_boinc.sh +++ b/android/build_boinc.sh @@ -50,6 +50,12 @@ cd stage/usr/local/bin arm-linux-androideabi-strip * cd ../../../.. +echo "Copy Assets" +mkdir "BOINC/assets" +cp "$BOINC/stage/usr/local/bin/boinc" "BOINC/assets/boinc" +cp "$BOINC/win_build/installerv2/redist/all_projects_list.xml" "BOINC/assets/all_projects_list.xml" +cp "$CURL_DIR/ca-bundle.crt" "BOINC/assets/ca-bundle.crt" + echo "=============================BOINC done=============================" fi diff --git a/android/copy_assets.sh b/android/copy_assets.sh deleted file mode 100755 index f6f5603be5..0000000000 --- a/android/copy_assets.sh +++ /dev/null @@ -1,18 +0,0 @@ -#/bin/sh -#script to compile BOINC for Android - -#++++++++++++++++++++++++CONFIGURATION++++++++++++++++++++++++++++ - -export BOINC=".." #BOINC source code -export OPENSSL_DIR=$BOINC/../boinc_depends_android_eclipse/openssl -export CURL_DIR=$BOINC/../boinc_depends_android_eclipse/curl - -#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - -echo "===================copy binary to assets direcotry of APK at $TARGETAPK=========================" - -mkdir "BOINC/assets" -cp "$BOINC/stage/usr/local/bin/boinc" "BOINC/assets/boinc" -cp "$CURL_DIR/ca-bundle.crt" "BOINC/assets/ca-bundle.crt" - -echo "============================script done==========================" diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index c51c3b2225..b9f2bbd74a 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -227,14 +227,15 @@ bool HOST_INFO::host_is_running_on_batteries() { // static bool first = true; FILE *fsysac, *fsysusb; + int aconline = 0; + int usbonline = 0; + bool power_supply_online = false; + if (first) { first = false; fsysac = fopen("/sys/class/power_supply/ac/online", "r"); fsysusb = fopen("/sys/class/power_supply/usb/online", "r"); } - int aconline = 0; - int usbonline = 0; - bool power_supply_online = false; if (fsysac) { rewind(fsysac); @@ -246,19 +247,8 @@ bool HOST_INFO::host_is_running_on_batteries() { (void) fscanf(fsysusb, "%d", &usbonline); } - if ((aconline == 1) || (usbonline == 1)){ + if ((aconline == 1) || (usbonline == 1)) { power_supply_online = true; - msg_printf(0, MSG_INFO, - "HOST_INFO::host_is_running_on_batteries(): power supply online! status for usb: %d and ac: %d\n", - usbonline, - aconline - ); - } else { - msg_printf(0, MSG_INFO, - "HOST_INFO::host_is_running_on_batteries(): running on batteries\n", - usbonline, - aconline - ); } return !power_supply_online; @@ -456,8 +446,6 @@ void HOST_INFO::get_battery_status() { strcpy(health, ""); strcpy(status, ""); - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): Updating battery status\n"); - if (first) { first = false; @@ -468,52 +456,31 @@ void HOST_INFO::get_battery_status() { if (!ftemp) { ftemp = fopen("/sys/class/power_supply/battery/temp", "r"); } - - msg_printf(0, MSG_INFO, - "HOST_INFO::get_battery_status(): fcap = '%p', fhealth = '%p', fstatus = '%p', ftemp = '%p'\n", - fcap, fhealth, fstatus, ftemp - ); } if (fcap) { rewind(fcap); fscanf(fcap, "%d", &battery_charge_pct); - msg_printf(0, MSG_INFO, - "HOST_INFO::get_battery_status(): battery capacity at: %d%% charge\n", - battery_charge_pct - ); } if (fhealth) { rewind(fhealth); fgets(health, sizeof(health), fhealth); - msg_printf(0, MSG_INFO, - "HOST_INFO::get_battery_status(): battery health: '%s'\n", - health - ); } if (fstatus) { rewind(fstatus); fgets(status, sizeof(status), fstatus); - msg_printf(0, MSG_INFO, - "HOST_INFO::get_battery_status(): battery status: '%s'\n", - status - ); } battery_state = BATTERY_STATE_UNKNOWN; if (strstr(health, "Overheat")) { - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): battery is overheating\n"); battery_state = BATTERY_STATE_OVERHEATED; } else if (strstr(status, "Not charging")) { - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): battery is discharging\n"); battery_state = BATTERY_STATE_DISCHARGING; } else if (strstr(status, "Charging")) { - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): battery is charging\n"); battery_state = BATTERY_STATE_CHARGING; } else if (strstr(status, "Full")) { - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): battery is full\n"); battery_state = BATTERY_STATE_FULL; } @@ -523,9 +490,6 @@ void HOST_INFO::get_battery_status() { rewind(ftemp); if (fscanf(ftemp, "%d", &x) == 1) { battery_temperature_celsius = x/10.; - msg_printf(0, MSG_INFO, "HOST_INFO::get_battery_status(): battery is %fC\n", - battery_temperature_celsius - ); } } }