summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/device-manager-plugin-exynos.spec2
-rw-r--r--src/device_manager_io.c12
-rw-r--r--src/device_manager_plugin_exynos.c26
3 files changed, 22 insertions, 18 deletions
diff --git a/packaging/device-manager-plugin-exynos.spec b/packaging/device-manager-plugin-exynos.spec
index 32e7991..e4679f8 100644
--- a/packaging/device-manager-plugin-exynos.spec
+++ b/packaging/device-manager-plugin-exynos.spec
@@ -1,7 +1,7 @@
#sbs-git:slp/pkgs/d/device-manager-plugin-exynos device-manager-plugin-exynos 0.0.1 5bf2e95e0bb15c43ff928f7375e1978b0accb0f8
Name: device-manager-plugin-exynos
Summary: Device manager plugin exynos
-Version: 0.0.19
+Version: 0.0.21
Release: 0
Group: TO_BE/FILLED_IN
License: TO_BE/FILLED_IN
diff --git a/src/device_manager_io.c b/src/device_manager_io.c
index 0e1ed5e..b3caf8d 100644
--- a/src/device_manager_io.c
+++ b/src/device_manager_io.c
@@ -141,15 +141,17 @@ int sys_get_int(char *fname, int *val)
}
}
-char *sys_get_str(char *fname)
+int sys_get_str(char *fname, char *str)
{
- char buf[BUFF_MAX];
- char *r = NULL;
+ char buf[BUFF_MAX] = {0};
if (sys_read_buf(fname, buf) == 0)
- r = strdup((char *)buf);
+ {
+ strncpy(str, buf, strlen(buf));
+ return 0;
+ }
- return r;
+ return -1;
}
int sys_set_int(char *fname, int val)
diff --git a/src/device_manager_plugin_exynos.c b/src/device_manager_plugin_exynos.c
index d95d31a..4a13376 100644
--- a/src/device_manager_plugin_exynos.c
+++ b/src/device_manager_plugin_exynos.c
@@ -29,6 +29,7 @@
#define BUFF_MAX 255
#define MAX_NAME 255
+#if 0
#define GENERATE_ACCESSORS_CHAR_RW(_suffix, _item) \
char *OEM_sys_get_##_suffix() \
{ \
@@ -51,6 +52,7 @@ int OEM_sys_set_##_suffix(char *str) \
{ \
return sys_set_str(_item, str); \
}
+#endif
/* TODO: Add APIs has (char *) params */
@@ -670,13 +672,13 @@ static char *health_text[] = {
int OEM_sys_get_battery_health(int *value)
{
- char *buf;
+ char buf[BUFF_MAX] = {0};
+ int ret = 0;
int i = 0;
- buf = sys_get_str(BATTERY_HEALTH_PATH);
- if (NULL == buf) {
+ ret = sys_get_str(BATTERY_HEALTH_PATH, buf);
+ if (ret == -1)
return -1;
- }
for (i = 0; i < BATTERY_HEALTH_MAX; i++) {
if (strncmp(buf, health_text[i], strlen(health_text[i])) == 0) {
@@ -731,12 +733,12 @@ static int OEM_sys_muic_node_path_info()
int OEM_sys_get_uart_path(int *value)
{
- char *buf;
+ char buf[BUFF_MAX] = {0};
+ int ret = 0;
- buf = sys_get_str(uart_node_path);
- if (NULL == buf) {
+ ret = sys_get_str(uart_node_path, buf);
+ if (ret == -1)
return -1;
- }
if (strncmp(buf, "CP", 2) == 0) {
*value = PATH_CP;
@@ -764,12 +766,12 @@ int OEM_sys_set_uart_path(int value)
int OEM_sys_get_usb_path(int *value)
{
- char *buf;
+ char buf[BUFF_MAX] = {0};
+ int ret = 0;
- buf = sys_get_str(usb_node_path);
- if (NULL == buf) {
+ ret = sys_get_str(usb_node_path, buf);
+ if (ret == -1)
return -1;
- }
if (strncmp(buf, "PDA", 3) == 0) {
*value = PATH_AP;