Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mt2: Provide global Huawei symbols via libc
Huawei included some non-standard functions in libcutils and liblog. Make these functions globally available by including them in libc. Parts of this commit originated from: libcutils/liblog: Add functions required by Huawei g620_a2 binaries Thomas Wendt I58604686008340ef4e10f3f67dc329fe7bd864cc Change-Id: Ie3a84ce5b6b969ef4cc17b2028cc03298a43a79b
- Loading branch information
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (C) 2015 The CyanogenMod Project | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
|
||
LOCAL_SRC_FILES := \ | ||
hw_cutils.c \ | ||
hw_log.c | ||
|
||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) | ||
LOCAL_MODULE := libc_huawei_symbols | ||
LOCAL_MODULE_TAGS := optional | ||
|
||
# Debugging (uncomment to enable) | ||
# LOCAL_CFLAGS += -DHW_LIBC_DEBUG | ||
# LOCAL_WHOLE_STATIC_LIBRARIES := liblog | ||
|
||
include $(BUILD_STATIC_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (C) 2015 The CyanogenMod Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifdef HW_LIBC_DEBUG | ||
#define LOG_TAG "HWAppInfo" | ||
#include <log/log.h> | ||
#endif | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <errno.h> | ||
|
||
/* | ||
* References in kernel: | ||
* fs/proc/app_info.c | ||
* include/misc/app_info.h | ||
*/ | ||
|
||
#define APP_INFO_PATH "/proc/app_info" | ||
#define APP_INFO_VALUE_LENGTH 32 | ||
|
||
int get_app_info(char* key, char* value) { | ||
char buf[128] = { 0 }; | ||
char* tok; | ||
FILE* f; | ||
|
||
#ifdef HW_LIBC_DEBUG | ||
ALOGI("Getting App Info for %s", key); | ||
#endif | ||
|
||
if(key == NULL) { | ||
#ifdef HW_LIBC_DEBUG | ||
ALOGE("Key is null"); | ||
#endif | ||
return -1; | ||
} | ||
|
||
f = fopen(APP_INFO_PATH, "rb"); | ||
if(f == NULL) { | ||
#ifdef HW_LIBC_DEBUG | ||
ALOGE("Failed to open %s: %s", APP_INFO_PATH, strerror(errno)); | ||
#endif | ||
return -2; | ||
} | ||
|
||
while (!feof(f)) { | ||
if (fgets(buf, 128, f) != NULL && | ||
strstr(buf, key) != NULL) { | ||
tok = strchr(buf, ':'); | ||
if (tok != NULL) | ||
tok = strtok(tok, ": "); | ||
if (tok != NULL) { | ||
snprintf(value, APP_INFO_VALUE_LENGTH, "%s", tok); | ||
strtok(value, "\n"); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
fclose(f); | ||
|
||
#ifdef HW_LIBC_DEBUG | ||
ALOGI("%s=%s", key, value); | ||
#endif | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (C) 2015 The CyanogenMod Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
void __android_logPower_print(void) { | ||
} | ||
|
||
int isLogEnabled(void) { | ||
return 0; | ||
} |