diff options
Diffstat (limited to 'healthd')
-rwxr-xr-x | healthd/Android.mk | 8 | ||||
-rwxr-xr-x | healthd/healthd_board_msm.cpp | 140 |
2 files changed, 0 insertions, 148 deletions
diff --git a/healthd/Android.mk b/healthd/Android.mk deleted file mode 100755 index b162bb4..0000000 --- a/healthd/Android.mk +++ /dev/null @@ -1,8 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := healthd_board_msm.cpp -LOCAL_MODULE := libhealthd.zuk -LOCAL_CFLAGS := -Werror -LOCAL_C_INCLUDES := system/core/healthd bootable/recovery -include $(BUILD_STATIC_LIBRARY) diff --git a/healthd/healthd_board_msm.cpp b/healthd/healthd_board_msm.cpp deleted file mode 100755 index d035d0f..0000000 --- a/healthd/healthd_board_msm.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - *Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - *Redistribution and use in source and binary forms, with or without - *modification, are permitted provided that the following conditions are - *met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - *ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - *BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <dirent.h> -#include <errno.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <cutils/klog.h> -#include <cutils/android_reboot.h> -#include <healthd.h> -#include "minui/minui.h" - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - -#define BACKLIGHT_PATH "/sys/class/leds/lcd-backlight/brightness" - -#define CHARGING_ENABLED_PATH "/sys/class/power_supply/battery/charging_enabled" - -#define LOGE(x...) do { KLOG_ERROR("charger", x); } while (0) -#define LOGW(x...) do { KLOG_WARNING("charger", x); } while (0) -#define LOGV(x...) do { KLOG_DEBUG("charger", x); } while (0) - -#define STR_LEN 8 -void healthd_board_mode_charger_draw_battery( - struct android::BatteryProperties *batt_prop) -{ - char cap_str[STR_LEN]; - int x, y; - int str_len_px; - static int char_height = -1, char_width = -1; - - if (char_height == -1 && char_width == -1) - gr_font_size(&char_width, &char_height); - snprintf(cap_str, (STR_LEN - 1), "%d%%", batt_prop->batteryLevel); - str_len_px = gr_measure(cap_str); - x = (gr_fb_width() - str_len_px) / 2; - y = (gr_fb_height() + char_height) / 2; - gr_color(0xa4, 0xc6, 0x39, 255); - gr_text(x, y, cap_str, 0); -} - -void healthd_board_mode_charger_battery_update( - struct android::BatteryProperties*) -{ - -} - -#define BACKLIGHT_ON_LEVEL 100 -#define BACKLIGHT_OFF_LEVEL 0 -void healthd_board_mode_charger_set_backlight(bool en) -{ - int fd; - char buffer[10]; - - if (access(BACKLIGHT_PATH, R_OK | W_OK) != 0) - { - LOGW("Backlight control not support\n"); - return; - } - - memset(buffer, '\0', sizeof(buffer)); - fd = open(BACKLIGHT_PATH, O_RDWR); - if (fd < 0) { - LOGE("Could not open backlight node : %s\n", strerror(errno)); - goto cleanup; - } - LOGV("set backlight status to %d\n", en); - if (en) - snprintf(buffer, sizeof(buffer), "%d\n", BACKLIGHT_ON_LEVEL); - else - snprintf(buffer, sizeof(buffer), "%d\n", BACKLIGHT_OFF_LEVEL); - - if (write(fd, buffer,strlen(buffer)) < 0) { - LOGE("Could not write to backlight node : %s\n", strerror(errno)); - goto cleanup; - } -cleanup: - if (fd >= 0) - close(fd); -} - -void healthd_board_mode_charger_init() -{ - int ret; - char buff[8] = "\0"; - int charging_enabled = 0; - int fd; - - /* check the charging is enabled or not */ - fd = open(CHARGING_ENABLED_PATH, O_RDONLY); - if (fd < 0) - return; - ret = read(fd, buff, sizeof(buff)); - close(fd); - if (ret > 0 && sscanf(buff, "%d\n", &charging_enabled)) { - /* if charging is disabled, reboot and exit power off charging */ - if (charging_enabled) - return; - LOGW("android charging is disabled, exit!\n"); - android_reboot(ANDROID_RB_RESTART, 0, 0); - } -} - -void healthd_board_init(struct healthd_config*) -{ - // use defaults -} - -int healthd_board_battery_update(struct android::BatteryProperties*) -{ - // return 0 to log periodic polled battery status to kernel log - return 1; -} |