summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkeewook.lee <keeewook.lee@samsung.com>2012-09-05 19:57:22 +0900
committerkeewook.lee <keeewook.lee@samsung.com>2012-09-05 19:57:22 +0900
commit67c1a80ceefa37094e67871262bbed2bd5a81d10 (patch)
tree046b9e5dee509f639f5d1e890065fbc588922393 /src
parent06c1a493800745ba16812f25683ccb3743464da9 (diff)
downloaddevice-manager-plugin-exynos-67c1a80ceefa37094e67871262bbed2bd5a81d10.tar.gz
device-manager-plugin-exynos-67c1a80ceefa37094e67871262bbed2bd5a81d10.tar.bz2
device-manager-plugin-exynos-67c1a80ceefa37094e67871262bbed2bd5a81d10.zip
change the function. Change-Id: I3988b541e3fe02e462f4bf39bdf5719516fee6a0 Signed-off-by: keewook.lee <keeewook.lee@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/device_manager_io.c12
-rw-r--r--src/device_manager_plugin_exynos.c26
2 files changed, 21 insertions, 17 deletions
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;