[Feature] add GA346 baseline version

Change-Id: Ic62933698569507dcf98240cdf5d9931ae34348f
diff --git a/src/apps/atom-base/progs/property/libprop/LICENSE b/src/apps/atom-base/progs/property/libprop/LICENSE
new file mode 100644
index 0000000..77f59ed
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MediaTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+the prior written permission of MediaTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MediaTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MediaTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
diff --git a/src/apps/atom-base/progs/property/libprop/Makefile.am b/src/apps/atom-base/progs/property/libprop/Makefile.am
new file mode 100644
index 0000000..0f20ded
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/Makefile.am
@@ -0,0 +1,14 @@
+AUTOMAKE_OPTIONS=foreign subdir-objects
+
+lib_LTLIBRARIES = libprop.la
+libprop_la_SOURCES = ./prop_api.c \
+	./prop_debug.c \
+	./request.c \
+	./utility.c
+include_HEADERS = ./prop_api.h \
+	./request.h \
+	./utility.h \
+	./cutils/properties.h
+
+libprop_la_LDFLAGS = -weak -shared
+libprop_la_LIBADD = -lm -lrt -lpthread -lc
diff --git a/src/apps/atom-base/progs/property/libprop/configure.ac b/src/apps/atom-base/progs/property/libprop/configure.ac
new file mode 100644
index 0000000..0322a7e
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/configure.ac
@@ -0,0 +1,8 @@
+AC_INIT([gpshal], [1.0])

+AM_INIT_AUTOMAKE([foreign])

+AC_CONFIG_HEADER(defines.h)

+AC_PROG_CC

+AC_DISABLE_STATIC

+LT_INIT

+AC_CONFIG_FILES([Makefile])

+AC_OUTPUT

diff --git a/src/apps/atom-base/progs/property/libprop/cutils/properties.h b/src/apps/atom-base/progs/property/libprop/cutils/properties.h
new file mode 100644
index 0000000..d46e90c
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/cutils/properties.h
@@ -0,0 +1,87 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifndef __CUTILS_PROPERTIES_H

+#define __CUTILS_PROPERTIES_H

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+/* System properties are *small* name value pairs managed by the

+** property service.  If your data doesn't fit in the provided

+** space it is not appropriate for a system property.

+**

+** WARNING: system/bionic/include/sys/system_properties.h also defines

+**          these, but with different names.  (TODO: fix that)

+*/

+#define PROPERTY_KEY_MAX   64

+#define PROPERTY_VALUE_MAX  92

+

+/* property_get: returns the length of the value which will never be

+** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.

+** (the length does not include the terminating zero).

+**

+** If the property read fails or returns an empty value, the default

+** value is used (if nonnull).

+*/

+int property_get(const char *key, char *value, const char *default_value);

+

+/* property_set: returns 0 on success, < 0 on failure

+*/

+int property_set(const char *key, const char *value);

+

+int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);    

+

+

+#ifdef HAVE_SYSTEM_PROPERTY_SERVER

+/*

+ * We have an external property server instead of built-in libc support.

+ * Used by the simulator.

+ */

+#define SYSTEM_PROPERTY_PIPE_NAME       "/tmp/android-sysprop"

+

+enum {

+    kSystemPropertyUnknown = 0,

+    kSystemPropertyGet,

+    kSystemPropertySet,

+    kSystemPropertyList

+};

+#endif /*HAVE_SYSTEM_PROPERTY_SERVER*/

+

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif

diff --git a/src/apps/atom-base/progs/property/libprop/prop_api.c b/src/apps/atom-base/progs/property/libprop/prop_api.c
new file mode 100644
index 0000000..7fa2b08
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/prop_api.c
@@ -0,0 +1,182 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "cutils/properties.h"
+#include "request.h"
+#include "prop_debug.h"
+
+/*******************************************************************************/
+/* LIBSNCFG functions for Android Property Mechanism                           */
+/*******************************************************************************/
+int _property_check(const char *key, const char *value)
+{
+    if (key == 0) {
+		 PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key==0 return directly\n");
+		 return -1;
+	}
+
+    if (strlen(key) >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key=%s size:%zd >= max:%d\n",
+				                            key, strlen(key), PROPERTY_KEY_MAX);
+		 return -1;
+	}
+
+    if (strlen(value) >= PROPERTY_VALUE_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] value=%s size:%zd >= max:%d\n",
+				                            value, strlen(value), PROPERTY_VALUE_MAX);
+		return -1;
+	}
+	
+    return  0;
+}
+
+int property_get(const char *key, char *value, const char *default_value)
+{
+	struct  sncfg_request request;
+    int     ret_len = 1;
+
+    /*check validaty*/
+    if ((key == 0) || (value == 0)) {
+		 PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key==0 return directly\n");
+		 return -1;
+	}
+
+	if (strlen(key) >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key=%s size:%zd >= max:%d\n",
+											key, strlen(key), PROPERTY_KEY_MAX);
+		 return -1;
+	}
+
+    /*send socket to get the value*/
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_GET;
+	request.key = (char *)key;
+	if (request_for_sncfg(&request) < 0) {
+        ret_len = 0;        
+	} else if (NULL == request.value) {
+        ret_len = 0;
+    }
+
+    /*
+    *  1. normal case: use db's value.
+    *  2. other case: use default value.
+    */
+    if (ret_len>0) {
+        ret_len = strlen(request.value);
+        if (ret_len >= PROPERTY_VALUE_MAX)  {
+            ret_len = PROPERTY_VALUE_MAX - 1;
+        }
+        strncpy(value, request.value, ret_len);
+        value[ret_len] = '\0';
+    } else {
+        if (default_value) {
+            ret_len = strlen(default_value);
+            if (ret_len >= PROPERTY_VALUE_MAX) {
+                ret_len = PROPERTY_VALUE_MAX - 1;
+            }
+            memcpy(value, default_value, ret_len);
+            value[ret_len] = '\0';
+        } else {
+            value[0] = '\0';
+        }
+    }
+
+	return  ret_len;	
+}
+
+int property_set(const char *key, const char *in_value)
+{
+	struct 	sncfg_request request;
+	char	*value = "";
+
+	if (in_value != NULL)
+		value = in_value;
+	
+    if (_property_check(key, value) < 0) {
+        return  -1;
+    }
+
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_SET;
+	request.key = (char *)key;
+	request.value = (char *)value;
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+	
+	return 0;
+}
+
+int property_reload(void)
+{
+	struct sncfg_request request;
+	
+	bzero(&request, sizeof(struct sncfg_request));
+	
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_RELOAD;	
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+	
+	return 0;		
+}
+
+int property_debug(char *key, char *in_value)
+{
+	struct sncfg_request request;
+	char	*value = "";
+
+	if (in_value != NULL)
+		value = in_value;
+
+    if (_property_check(key, value) < 0) {
+        return  -1;
+    }
+    
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_DEBUG;
+	request.key = key;
+	request.value = value;
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+
+	return 0;	
+}
diff --git a/src/apps/atom-base/progs/property/libprop/prop_api.h b/src/apps/atom-base/progs/property/libprop/prop_api.h
new file mode 100644
index 0000000..60756f7
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/prop_api.h
@@ -0,0 +1,43 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifdef SNCFG_PROPERTY

+

+#ifndef _PROP_API_H

+#define _PROP_API_H

+

+

+

+#endif

+

+#endif

diff --git a/src/apps/atom-base/progs/property/libprop/prop_debug.c b/src/apps/atom-base/progs/property/libprop/prop_debug.c
new file mode 100644
index 0000000..35bbc68
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/prop_debug.c
@@ -0,0 +1,62 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include "prop_debug.h"
+
+unsigned int prop_debug_level = PROP_DEBUG_ERROR;
+
+char *prop_debug_name[] =
+	{
+		"",
+		"TEST! ",
+		"FAIL! ",
+		"WARN! ",
+		"TRACE! ",
+		"INFO! ",
+		"LOUD! ",
+	};
+
+int prop_debug_set(unsigned int level)
+{
+    if ((level>=PROP_DEBUG_OFF) && (level <=PROP_DEBUG_LOUD)) {
+        prop_debug_level = level;
+    }
+
+    return  0;
+}
+
+int prop_debug_get(void)
+{
+    return  prop_debug_level;
+}
diff --git a/src/apps/atom-base/progs/property/libprop/prop_debug.h b/src/apps/atom-base/progs/property/libprop/prop_debug.h
new file mode 100644
index 0000000..d66d55b
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/prop_debug.h
@@ -0,0 +1,90 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __PROP_DEBUG_H
+#define __PROP_DEBUG_H
+#include <syslog.h>
+
+#define PROP_DEBUG_OFF                  0
+#define PROP_DEBUG_TEST                 1
+#define PROP_DEBUG_ERROR                2
+#define PROP_DEBUG_WARN                 3
+#define PROP_DEBUG_TRACE                4
+#define PROP_DEBUG_INFO                 5
+#define PROP_DEBUG_LOUD                 6
+
+extern unsigned int  prop_debug_level;
+extern char *prop_debug_name[];
+int prop_debug_set(unsigned int level);
+int prop_debug_get(void);
+
+#if 0
+
+#define PROP_DEBUG_PRINT(level, str, args...)               \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			printf("\n\r[SNCFGD-PROP] %s - %s ", __FUNCTION__, prop_debug_name[level]); 		\
+    		printf(str, ##args);                            \
+        }                                                   \
+	} while(0)
+
+#define PROP_DEBUG_LOG(level, str, args...)                 \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			printf("\n\r[SNCFGD-PROP] %s - %s ", __FUNCTION__, prop_debug_name[level]); 		\
+    		printf(str, ##args);                            \
+        }                                                   \
+	} while(0)
+#else
+
+#define PROP_DEBUG_PRINT(level, str, args...)               \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        { 													\
+			syslog(LOG_DEBUG, "[PROP][%s:%d]: " str "\n", __FUNCTION__, __LINE__,  ## args);\
+        }      									            \
+	} while(0)
+
+#define PROP_DEBUG_LOG(level, str, args...)                 \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			syslog(LOG_DEBUG, "[PROP][%s:%d]: " str "\n", __FUNCTION__, __LINE__,  ## args);\
+        }                                                   \
+	} while(0)
+
+#endif
+
+#endif
diff --git a/src/apps/atom-base/progs/property/libprop/request.c b/src/apps/atom-base/progs/property/libprop/request.c
new file mode 100644
index 0000000..d72531d
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/request.c
@@ -0,0 +1,264 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <syslog.h>
+#include "utility.h"
+#include "request.h"
+
+/*******************************************************************************/
+/* REQUEST local definitions                                                   */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local prototypes                                                    */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local variables                                                     */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local functions                                                     */
+/*******************************************************************************/
+static int pack_request_string(char **p, char **next, const char *roof)
+{
+	if (*p == NULL) {
+		return 0;
+	} else {
+		size_t len = strlen(*p) + 1;
+
+		if ((roof - *next) < (ptrdiff_t)len) {
+			return -1;
+		} else {
+			strcpy(*next, *p);
+			*next += len;
+			*p = (char *)0x12345678;
+			return 0;
+		}
+	}	
+}
+
+static int unpack_request_string(char **p, char **next, const char *roof)
+{
+	if (*p == NULL) {
+		return 0;
+	} else if (*p == (char *)0x12345678) {
+		char *end = memchr(*next, '\0', roof - *next);
+		
+		if (end == NULL) {
+			return -1;
+		} else {
+			*p = *next;
+			*next = end + 1;
+			return 0;
+		}
+	}
+	return -1;
+}
+
+/*******************************************************************************/
+/* REQUEST functions                                                           */
+/*******************************************************************************/
+int pack_request(struct sncfg_request *request)
+{
+	int size;
+	char *next, *roof;
+	
+    next = request->string + request->reservedLen;
+    roof = next + sizeof(request->string);
+    
+	if (request->magic != SNCFG_REQUEST_MAGIC) {
+		return -1;
+	}
+
+	if (request->type >= SNCFG_REQUEST_TYPE_RESERVED) {
+		return -1;
+	}
+					
+	if (pack_request_string(&request->key, &next, roof) < 0 ||
+		pack_request_string(&request->value, &next, roof) < 0) {
+		return -1;
+	}
+
+	size = next - (char *)request;
+	return size;
+}
+
+int unpack_request(struct sncfg_request *request, int size)
+{
+	char *next, *roof;
+	
+	next = request->string + request->reservedLen;
+	roof = (char *)request + size;
+
+	if (roof < next) {
+		return -1;
+	}
+	
+	if (request->magic != SNCFG_REQUEST_MAGIC) {
+		return -1;
+	}
+
+	if (request->type >= SNCFG_REQUEST_TYPE_RESERVED) {
+		return -1;
+	}
+
+	if (unpack_request_string(&request->key, &next, roof) < 0 ||
+		unpack_request_string(&request->value, &next, roof) < 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+int connect_request(void)
+{
+	int sock;
+	struct sockaddr_un addr = { AF_UNIX, SNCFG_REQUEST_UNIX_SOCKET };
+
+	if (access(addr.sun_path, R_OK | W_OK) < 0) {
+		return -1;
+	}
+
+	sock = socket(AF_UNIX, SOCK_STREAM, 0);
+	if (sock == -1) {
+		return -1;
+	}
+					
+	struct timeval tm;
+	tm.tv_sec = 8;  /* 8 Secs Timeout */
+	tm.tv_usec = 0;
+		
+	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for connect ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for connect ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for connect ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for connect ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+					
+	if (connect(sock, (struct sockaddr *)&addr, 
+				offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path)) < 0) {
+		close(sock);
+		return -1;
+	}
+			
+	return sock;
+}
+
+int accept_request(int sockfd)
+{
+	int sock;
+	socklen_t addrlen;
+	struct sockaddr_un addr;
+
+	addrlen = sizeof(addr);
+	sock = accept(sockfd, (struct sockaddr *)&addr, &addrlen);
+	if (sock == -1) {
+		return -1;
+	}
+
+	if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) {
+		close(sock);
+		return -1;
+    }	
+
+	struct timeval tm;
+	tm.tv_sec = 8;  /* 8 Secs Timeout */
+	tm.tv_usec = 0;
+		
+	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for accept ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for accept ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for accept ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for accept ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+
+	return sock;
+}
+
+int request_for_sncfg(struct sncfg_request *request)
+{
+	int sock, size;
+
+	size = pack_request(request);
+	if (size < 0) {
+		return -1;
+	}
+	
+	sock = connect_request();
+	if (sock < 0) {
+		return -1;
+	}
+	
+	if (safe_write(sock, request, size) != size) {
+		close(sock);
+		return -1;
+	}
+
+	size = safe_read(sock, request, sizeof(struct sncfg_request));
+
+	if (size < 0 ||
+		unpack_request(request, size) < 0 ||
+		request->status < 0) {
+		/* request processing failed */
+		close(sock);
+		return -1;
+	}
+	
+	close(sock);
+	return 0;
+}
diff --git a/src/apps/atom-base/progs/property/libprop/request.h b/src/apps/atom-base/progs/property/libprop/request.h
new file mode 100644
index 0000000..87eec5c
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/request.h
@@ -0,0 +1,102 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __REQUEST_H__
+#define __REQUEST_H__
+
+
+/*******************************************************************************/
+/* REQUEST definitions                                                         */
+/*******************************************************************************/
+#define SNCFG_REQUEST_MAGIC			0x2287
+#define SNCFG_REQUEST_UNIX_SOCKET	"/var/run/sncfg.socket"
+
+#ifdef __MEM_COSTDOWN__
+#define SNCFG_REQUEST_MAX_SIZE		512
+#else
+#define SNCFG_REQUEST_MAX_SIZE		4096
+#endif
+
+
+/*******************************************************************************/
+/* REQUEST prototypes                                                          */
+/*******************************************************************************/
+enum {
+	SNCFG_REQUEST_TYPE_PROP_SET,
+	SNCFG_REQUEST_TYPE_PROP_GET,
+	SNCFG_REQUEST_TYPE_PROP_RELOAD,
+	SNCFG_REQUEST_TYPE_PROP_DEBUG,
+	SNCFG_REQUEST_TYPE_PROP_CTRLSTOP_SIGNAL,
+	SNCFG_REQUEST_TYPE_PROP_TEST,
+
+	SNCFG_REQUEST_TYPE_RESERVED
+};
+	
+
+struct sncfg_request {
+	unsigned short magic;
+	unsigned short type;
+	int status;
+	int reservedLen;
+	char *key;
+	char *value;
+	char string[SNCFG_REQUEST_MAX_SIZE];	/* enough ?? */
+};
+
+struct request_list {
+	struct request_list *prev, *next;
+};
+
+struct req {
+	struct request_list	next;
+	int	sock;
+    int child_pid;
+	struct sncfg_request request;
+};
+
+
+/*******************************************************************************/
+/* REQUEST variables                                                           */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* REQUEST functions                                                           */
+/*******************************************************************************/
+extern int pack_request(struct sncfg_request *request);
+extern int unpack_request(struct sncfg_request *request, int size);
+extern int connect_request(void);
+extern int accept_request(int sockfd);
+extern int request_for_sncfg(struct sncfg_request *request);
+
+#endif	// __REQUEST_H__
diff --git a/src/apps/atom-base/progs/property/libprop/utility.c b/src/apps/atom-base/progs/property/libprop/utility.c
new file mode 100644
index 0000000..265aa28
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/utility.c
@@ -0,0 +1,186 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sched.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <syslog.h>
+#include "utility.h"
+
+/*******************************************************************************/
+/* UTILITY local definitions                                                   */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY local prototypes                                                    */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY local variables                                                     */
+/*******************************************************************************/
+int libsncfg_rw_block = 1;
+
+/*******************************************************************************/
+/* UTILITY local functions                                                     */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY functions                                                           */
+/*******************************************************************************/
+int safe_close(int fd)
+{
+	int ret;
+	
+	do {
+		ret = close(fd);
+	} while (ret < 0 && errno == EINTR);
+
+	if (ret < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] close(%d) @ safe_close() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] close(%d) @ safe_close() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+	}
+	return ret;
+}
+
+
+ssize_t safe_read(int fd, void *buf, size_t count)
+{
+	ssize_t n;
+                                                                                
+again:                                                                                
+	do {
+		n = read(fd, buf, count);
+	} while (n < 0 && errno == EINTR);
+
+	if (n < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] read(%d) @ safe_read() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] read(%d) @ safe_read() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+		if ((errnoTmp == EWOULDBLOCK || errnoTmp == EAGAIN) && libsncfg_rw_block) {
+			goto again;
+		}	
+	}
+	return n;
+}
+                                                                                
+
+ssize_t safe_write(int fd, const void *buf, size_t count)
+{
+	ssize_t n;
+                                                                                
+again:
+	do {
+		n = write(fd, buf, count);
+		if (n == 0) {
+			fprintf(stderr, "[LIBSNCFG][%d] write(%d) @ safe_write : write zero byte !!\n", getpid(), fd);
+			syslog(LOG_WARNING, "[LIBSNCFG][%d] write(%d) @ safe_write : write zero byte !!", getpid(), fd);
+		}
+	} while (n < 0 && errno == EINTR);
+
+	if (n < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] write(%d) @ safe_write() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] write(%d) @ safe_write() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+		if ((errno == EWOULDBLOCK || errno == EAGAIN) && libsncfg_rw_block) {
+			goto again;
+		}	
+	}
+	return n;
+}
+
+char *dupstr(char* s)
+{
+    char *r;
+    
+    r = malloc (strlen (s) + 1);
+    if (r)
+    	strcpy (r, s);
+    return (r);
+}
+
+int nonrt_system(const char *cmd)
+{
+	int wait_val, pid;
+	sig_t save_quit, save_int, save_chld;
+	struct sched_param sched;
+
+	if (cmd == 0) {
+		return 1;
+	}
+
+	save_quit = signal(SIGQUIT, SIG_IGN);
+	save_int = signal(SIGINT, SIG_IGN);
+	save_chld = signal(SIGCHLD, SIG_DFL);
+
+	if ((pid = vfork()) < 0) {
+		signal(SIGQUIT, save_quit);
+		signal(SIGINT, save_int);
+		signal(SIGCHLD, save_chld);
+		return -1;
+	}
+	if (pid == 0) {
+		signal(SIGQUIT, SIG_DFL);
+		signal(SIGINT, SIG_DFL);
+		signal(SIGCHLD, SIG_DFL);
+
+		/* child, can only call thread safe functions before exec ... */
+		sched.sched_priority = 0;
+		if (sched_setscheduler(0, SCHED_OTHER, &sched) == -1) {
+			exit(127);
+		}
+		execl("/bin/sh", "sh", "-c", cmd, (char *) 0);
+		exit(127);
+	}
+	/* Signals are not absolutly guarenteed with vfork */
+	signal(SIGQUIT, SIG_IGN);
+	signal(SIGINT, SIG_IGN);
+
+	if (wait4(pid, &wait_val, 0, 0) == -1) {
+		wait_val = -1;
+	}
+
+	signal(SIGQUIT, save_quit);
+	signal(SIGINT, save_int);
+	signal(SIGCHLD, save_chld);
+	return wait_val;
+}	
diff --git a/src/apps/atom-base/progs/property/libprop/utility.h b/src/apps/atom-base/progs/property/libprop/utility.h
new file mode 100644
index 0000000..5495171
--- /dev/null
+++ b/src/apps/atom-base/progs/property/libprop/utility.h
@@ -0,0 +1,63 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __UTILITY_H__
+#define __UTILITY_H__
+
+
+/*******************************************************************************/
+/* UTILITY definitions                                                         */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY prototypes                                                          */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY variables                                                           */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY functions                                                           */
+/*******************************************************************************/
+extern int safe_close(int fd);
+extern ssize_t safe_read(int fd, void *buf, size_t count);
+extern ssize_t safe_write(int fd, const void *buf, size_t count);
+extern char *dupstr(char* s);
+extern int nonrt_system(const char *cmd);
+
+
+#endif	// __UTILITY_H__
diff --git a/src/apps/atom-base/progs/property/prop/LICENSE b/src/apps/atom-base/progs/property/prop/LICENSE
new file mode 100644
index 0000000..77f59ed
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MediaTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+the prior written permission of MediaTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MediaTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MediaTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
diff --git a/src/apps/atom-base/progs/property/prop/Makefile.am b/src/apps/atom-base/progs/property/prop/Makefile.am
new file mode 100644
index 0000000..f64de0c
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/Makefile.am
@@ -0,0 +1,23 @@
+AUTOMAKE_OPTIONS=foreign subdir-objects
+bin_PROGRAMS = prop
+
+prop_SOURCES = property.c \
+        list.c \
+        prop_api.c \
+        prop_core.c \
+        prop_db.c \
+        prop_debug.c \
+        prop_file.c \
+        prop_sncfg.c \
+        prop_svc.c \
+        prop_test.c \
+        request.c \
+        utility.c 
+
+AM_CFLAGS = -I$(srcdir)/inc \
+            -I$(srcdir)/inc/cutils
+
+AM_CFLAGS += $(DNS_FLAGS)
+
+prop_LDADD = -lpthread -ldl -lm
+prop_LDADD +=$(Lib_FLAGS)
diff --git a/src/apps/atom-base/progs/property/prop/configure.ac b/src/apps/atom-base/progs/property/prop/configure.ac
new file mode 100644
index 0000000..a668d83
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/configure.ac
@@ -0,0 +1,9 @@
+AC_INIT([gpshal], [1.0])

+AM_INIT_AUTOMAKE([foreign])

+AC_CONFIG_HEADER(defines.h)

+AC_PROG_CC

+AC_DISABLE_STATIC

+LT_INIT

+AC_CONFIG_FILES([Makefile])

+AC_OUTPUT

+

diff --git a/src/apps/atom-base/progs/property/prop/inc/cutils/properties.h b/src/apps/atom-base/progs/property/prop/inc/cutils/properties.h
new file mode 100644
index 0000000..d46e90c
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/cutils/properties.h
@@ -0,0 +1,87 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifndef __CUTILS_PROPERTIES_H

+#define __CUTILS_PROPERTIES_H

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+/* System properties are *small* name value pairs managed by the

+** property service.  If your data doesn't fit in the provided

+** space it is not appropriate for a system property.

+**

+** WARNING: system/bionic/include/sys/system_properties.h also defines

+**          these, but with different names.  (TODO: fix that)

+*/

+#define PROPERTY_KEY_MAX   64

+#define PROPERTY_VALUE_MAX  92

+

+/* property_get: returns the length of the value which will never be

+** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.

+** (the length does not include the terminating zero).

+**

+** If the property read fails or returns an empty value, the default

+** value is used (if nonnull).

+*/

+int property_get(const char *key, char *value, const char *default_value);

+

+/* property_set: returns 0 on success, < 0 on failure

+*/

+int property_set(const char *key, const char *value);

+

+int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);    

+

+

+#ifdef HAVE_SYSTEM_PROPERTY_SERVER

+/*

+ * We have an external property server instead of built-in libc support.

+ * Used by the simulator.

+ */

+#define SYSTEM_PROPERTY_PIPE_NAME       "/tmp/android-sysprop"

+

+enum {

+    kSystemPropertyUnknown = 0,

+    kSystemPropertyGet,

+    kSystemPropertySet,

+    kSystemPropertyList

+};

+#endif /*HAVE_SYSTEM_PROPERTY_SERVER*/

+

+

+#ifdef __cplusplus

+}

+#endif

+

+#endif

diff --git a/src/apps/atom-base/progs/property/prop/inc/list.h b/src/apps/atom-base/progs/property/prop/inc/list.h
new file mode 100644
index 0000000..8330964
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/list.h
@@ -0,0 +1,92 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __LIST_H__
+#define __LIST_H__
+
+#include <assert.h>
+
+/*******************************************************************************/
+/* LIST prototypes                                                             */
+/*******************************************************************************/
+struct list {
+	struct list *prev, *next;
+};
+
+/*******************************************************************************/
+/* LIST definitions                                                            */
+/*******************************************************************************/
+#define INIT_LIST(ptr) { (ptr)->prev = (ptr); (ptr)->next = (ptr); }
+
+#define LIST_ENTRY(ptr, type, member) \
+	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+#define LIST_INIT(name) struct list name = { &(name), &(name) }
+
+#define LIST_FOR_EACH(pos, head) \
+	for (pos = (head)->next; pos != (head); pos = pos->next)
+
+#define LIST_FOR_EACH_PREV(pos, head) \
+	for (pos = (head)->prev; pos != (head); pos = pos->prev)
+
+
+#define LIST_FOR_EACH_SAFE(pos, n, head) \
+	for (pos = (head)->next, n = pos->next; pos != (head); pos = n, n = pos->next)
+	
+#define LIST_FOR_EACH_PREV_SAFE(pos, p, head) \
+	for (pos = (head)->prev, p = pos->prev; pos != (head); pos = p, p = pos->prev)
+
+#ifdef DEBUG
+#define LIST_CHECK(x)	assert(((x)->prev->next == (x)) && ((x) == (x)->next->prev));
+#else
+#define LIST_CHECK(x)
+#endif
+
+
+/*******************************************************************************/
+/* LIST variables                                                              */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* LIST functions                                                              */
+/*******************************************************************************/
+extern void list_add(struct list *entry, struct list *head);
+extern void list_add_tail(struct list *entry, struct list *head);
+extern void list_del(struct list *entry);
+extern void list_del_init(struct list *entry);
+extern void list_replace(struct list *orig, struct list *repl);
+extern int list_empty(const struct list *head);
+
+
+#endif	// __LIST_H__
diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_api.h b/src/apps/atom-base/progs/property/prop/inc/prop_api.h
new file mode 100644
index 0000000..23b5970
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_api.h
@@ -0,0 +1,39 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifndef _PROP_API_H

+#define _PROP_API_H

+

+

+

+#endif

diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_core.h b/src/apps/atom-base/progs/property/prop/inc/prop_core.h
new file mode 100644
index 0000000..84d1030
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_core.h
@@ -0,0 +1,45 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef _PROP_CORE_H
+#define _PROP_CORE_H
+
+int prop_core_init(void);
+int prop_core_get(const char *name, char *value);
+int prop_core_set(const char *name, const char *value);
+int prop_core_notify_ctrl(pid_t pid);
+void prop_core_load_svc(void);
+void prop_core_load_props(void);
+void prop_core_dump(void);
+
+#endif
diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_db.h b/src/apps/atom-base/progs/property/prop/inc/prop_db.h
new file mode 100644
index 0000000..f9a90e6
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_db.h
@@ -0,0 +1,58 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifndef _SNCFG_PROPERTY_DB_H

+#define _SNCFG_PROPERTY_DB_H

+

+#include "list.h"

+#include <cutils/properties.h>

+

+

+#define PROP_DB_VALUE_SIZE   PROPERTY_VALUE_MAX

+#define PROP_DB_KEY_SIZE     PROPERTY_KEY_MAX

+

+typedef struct 

+{

+	struct  list    sibling;		/* sibling list, for hash */

+    char            *prop_key;

+    char            *prop_value;

+    int             flags;    

+    

+}prop_db_info_t;

+

+int prop_db_set(const char *in_key, const char *in_value);

+int prop_db_get(const char *in_key, char *in_value);

+void prop_db_dump(void);

+void prop_db_init(void);

+

+#endif

diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_debug.h b/src/apps/atom-base/progs/property/prop/inc/prop_debug.h
new file mode 100644
index 0000000..a5bffdf
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_debug.h
@@ -0,0 +1,90 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __PROP_DEBUG_H
+#define __PROP_DEBUG_H
+#include <syslog.h>
+
+#define PROP_DEBUG_OFF                  0
+#define PROP_DEBUG_TEST                 1
+#define PROP_DEBUG_ERROR                2
+#define PROP_DEBUG_WARN                 3
+#define PROP_DEBUG_TRACE                4
+#define PROP_DEBUG_INFO                 5
+#define PROP_DEBUG_LOUD                 6
+
+extern unsigned int  prop_debug_level;
+extern char *prop_debug_name[];
+int prop_debug_set(unsigned int level);
+int prop_debug_get(void);
+
+
+#if 0
+
+#define PROP_DEBUG_PRINT(level, str, args...)               \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			printf("\n\r[SNCFGD-PROP] %s - %s ", __FUNCTION__, prop_debug_name[level]); 		\
+    		printf(str, ##args);                            \
+        }                                                   \
+	} while(0)
+
+#define PROP_DEBUG_LOG(level, str, args...)                 \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			printf("\n\r[SNCFGD-PROP] %s - %s ", __FUNCTION__, prop_debug_name[level]); 		\
+    		printf(str, ##args);                            \
+        }                                                   \
+	} while(0)
+#else
+
+#define PROP_DEBUG_PRINT(level, str, args...)               \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        { 													\
+			syslog(LOG_DEBUG, "[PROP][%s:%d]: " str "\n", __FUNCTION__, __LINE__,  ## args);\
+        }      									            \
+	} while(0)
+
+#define PROP_DEBUG_LOG(level, str, args...)                 \
+	do {                                                    \
+        if(level<=prop_debug_level)                         \
+        {   												\
+			syslog(LOG_DEBUG, "[PROP][%s:%d]: " str "\n", __FUNCTION__, __LINE__,  ## args);\
+        }                                                   \
+	} while(0)
+
+#endif
+#endif
diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_file.h b/src/apps/atom-base/progs/property/prop/inc/prop_file.h
new file mode 100644
index 0000000..1d5e203
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_file.h
@@ -0,0 +1,41 @@
+/* Copyright Statement:

+

+ * This software/firmware and related documentation ("MediaTek Software") are

+ * protected under relevant copyright laws. The information contained herein is

+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without

+ * the prior written permission of MediaTek inc. and/or its licensors, any

+ * reproduction, modification, use or disclosure of MediaTek Software, and

+ * information contained herein, in whole or in part, shall be strictly

+ * prohibited.

+

+ * MediaTek Inc. (C) 2015. All rights reserved.

+

+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES

+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")

+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER

+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL

+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED

+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR

+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH

+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,

+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES

+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.

+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO

+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK

+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE

+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR

+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S

+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE

+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE

+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE

+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.

+ */

+

+#ifndef __PROP_FILE_H

+#define __PROP_FILE_H

+

+void prop_file_write_persistent(const char *name, const char *value);

+void prop_file_load_props(void);

+void prop_file_load_svc(void);

+

+#endif

diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_sncfg.h b/src/apps/atom-base/progs/property/prop/inc/prop_sncfg.h
new file mode 100644
index 0000000..61c998a
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_sncfg.h
@@ -0,0 +1,41 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __PROP_SNCFG_H
+#define __PROP_SNCFG_H
+
+int prop_sncfg_enqueue(struct req *req);
+int prop_sncfg_init(void);
+void prop_sncfg_child_exit_handle(int sig);
+
+#endif
diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_svc.h b/src/apps/atom-base/progs/property/prop/inc/prop_svc.h
new file mode 100644
index 0000000..4384b82
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_svc.h
@@ -0,0 +1,89 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef _PROP_SVC_H
+#define _PROP_SVC_H
+
+#include "list.h"
+#include <cutils/properties.h>
+
+#define PROP_SVC_RUNNING     		(0x1<<2)  /* currently active */
+#define PROP_SVC_STOPPING     		(0x1<<3)  /* currently active */
+#define PROP_SVC_STOPPED     		(0x1<<4)  /* currently active */
+
+#define PROP_SVC_ACTION_MAX_SIZE    (128)   /*???*/
+#define	PROP_SVC_ACTION_BUF_SIZE 	(1024)	/*???*/
+#define	PROP_SVC_TYPE_MAX_SIZE		(64)
+#define PROP_SVC_MAX_ARGS_NUM		(12)
+#define	PROP_SVC_ONPROPERTY	"on property:"
+#define	PROP_SVC_SERVICE		"service "
+
+#define PROP_SVC_TYPE_ON_PROPERTY   (0x1<<1)
+#define PROP_SVC_TYPE_SERVICE       (0x1<<2)
+
+typedef struct
+{
+    struct list    	alist;
+	char			line_buf[PROP_SVC_ACTION_MAX_SIZE];
+	char			act_name[PROP_SVC_ACTION_MAX_SIZE];
+	int				args_num;
+	char			*args[PROP_SVC_MAX_ARGS_NUM];
+}prop_svc_act_t;
+
+typedef struct
+{
+    struct  		list slist;
+	char			svc_name[PROP_SVC_TYPE_MAX_SIZE]; //"service", or "on property"...
+    char    		svc_value[PROPERTY_VALUE_MAX];
+    char    		svc_key[PROPERTY_KEY_MAX];
+	int			    svc_type;     //"service", or "on property"...
+	struct list  	act_list;
+    pid_t   		pid;
+    int     		flags;
+}prop_svc_t;
+
+prop_svc_t * prop_svc_find_by_pid(const pid_t pid);
+prop_svc_t * prop_svc_find_by_name(const char *svc_name, const char *prop_key, const char *prop_value);
+int prop_svc_get_actions(const prop_svc_t *act_item, char *in_buf);
+int prop_svc_del(const prop_svc_t *svc);
+int prop_svc_add(const prop_svc_t *svc);
+prop_svc_t * prop_svc_exe_by_name(const char *svc_name, const char *prop_key, const char *prop_value, void (*callabck)());
+void prop_svc_dump(void);
+int prop_svc_add_act(const char *svc_name, const char *svc_key, const char *svc_value, const char *actions);
+void prop_svc_init(void);
+int prop_svc_get_actions_by_name(const char *svc_name, const char *svc_key, const char *svc_value, char *in_buf);
+int prop_svc_get_daemon(const prop_svc_t *act_item, char *in_buf);
+int prop_svc_get_daemon_ext(const prop_svc_t *act_item, char *in_buf);
+pid_t prop_svc_get_pid(const prop_svc_t *act_item);
+
+#endif
diff --git a/src/apps/atom-base/progs/property/prop/inc/prop_test.h b/src/apps/atom-base/progs/property/prop/inc/prop_test.h
new file mode 100644
index 0000000..3182601
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/prop_test.h
@@ -0,0 +1,39 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef _PROP_TEST_H
+#define _PROP_TEST_H
+
+int prop_test_func(const char *name, const char *value);
+
+#endif
diff --git a/src/apps/atom-base/progs/property/prop/inc/property.h b/src/apps/atom-base/progs/property/prop/inc/property.h
new file mode 100644
index 0000000..cf815de
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/property.h
@@ -0,0 +1,78 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __SNCFGD_H__
+#define __SNCFGD_H__
+
+#include "list.h"
+
+
+/*******************************************************************************/
+/* SNCFGD definitions                                                         */
+/*******************************************************************************/
+#ifdef DEBUG
+#define ASSERT_CHECK(x)	assert(x)
+
+#define DEBUG_PRINT(str, args...) \
+	do { \
+		printf("[SNCFGD] %s - ", __FUNCTION__); \
+		printf(str, ##args); \
+		printf("\n"); \
+	} while(0)
+
+#define LOG_PRINT(level, str, args...) \
+	do { \
+		printf("[SNCFGD] %s - ", __FUNCTION__); \
+		printf(str, ##args); \
+		printf("\n"); \
+	} while(0)
+#else
+#define ASSERT_CHECK(x)
+
+#define DEBUG_PRINT(str, args...)
+
+#define LOG_PRINT(level, str, args...) \
+	do { \
+		syslog(level, str, ##args); \
+	} while(0)
+#endif
+
+/*******************************************************************************/
+/* SNCFGD functions                                                           */
+/*******************************************************************************/
+/*Only for debug/test*/
+int property_reload(void);
+int property_debug(char *key, char *value);
+int property_test(char *key, char *value);
+
+#endif	// __SNCFGD_H__
diff --git a/src/apps/atom-base/progs/property/prop/inc/request.h b/src/apps/atom-base/progs/property/prop/inc/request.h
new file mode 100644
index 0000000..7db6006
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/request.h
@@ -0,0 +1,102 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __REQUEST_H__
+#define __REQUEST_H__
+
+
+/*******************************************************************************/
+/* REQUEST definitions                                                         */
+/*******************************************************************************/
+#define SNCFG_REQUEST_MAGIC			0x2287
+#define SNCFG_REQUEST_UNIX_SOCKET	"/var/run/sncfg.socket"
+
+#ifdef __MEM_COSTDOWN__
+#define SNCFG_REQUEST_MAX_SIZE		512
+#else
+#define SNCFG_REQUEST_MAX_SIZE		4096
+#endif
+
+
+/*******************************************************************************/
+/* REQUEST prototypes                                                          */
+/*******************************************************************************/
+enum {
+	SNCFG_REQUEST_TYPE_PROP_SET,
+	SNCFG_REQUEST_TYPE_PROP_GET,
+	SNCFG_REQUEST_TYPE_PROP_RELOAD,
+	SNCFG_REQUEST_TYPE_PROP_DEBUG,
+	SNCFG_REQUEST_TYPE_PROP_CTRLSTOP_SIGNAL,
+	SNCFG_REQUEST_TYPE_PROP_TEST,
+
+	SNCFG_REQUEST_TYPE_RESERVED
+};
+	
+
+struct sncfg_request {
+	unsigned short magic;
+	unsigned short type;
+	int status;
+	int reservedLen;
+	char *key;
+	char *value;
+	char string[SNCFG_REQUEST_MAX_SIZE];	/* enough ?? */
+};
+
+struct request_list {
+	struct request_list *prev, *next;
+};
+
+struct req {
+	struct request_list	next;
+	int	sock;
+    int child_pid; 
+	struct sncfg_request request;
+};
+
+
+/*******************************************************************************/
+/* REQUEST variables                                                           */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* REQUEST functions                                                           */
+/*******************************************************************************/
+extern int pack_request(struct sncfg_request *request);
+extern int unpack_request(struct sncfg_request *request, int size);
+extern int connect_request(void);
+extern int accept_request(int sockfd);
+extern int request_for_sncfg(struct sncfg_request *request);
+
+#endif	// __REQUEST_H__
diff --git a/src/apps/atom-base/progs/property/prop/inc/utility.h b/src/apps/atom-base/progs/property/prop/inc/utility.h
new file mode 100644
index 0000000..5495171
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/inc/utility.h
@@ -0,0 +1,63 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#ifndef __UTILITY_H__
+#define __UTILITY_H__
+
+
+/*******************************************************************************/
+/* UTILITY definitions                                                         */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY prototypes                                                          */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY variables                                                           */
+/*******************************************************************************/
+
+
+/*******************************************************************************/
+/* UTILITY functions                                                           */
+/*******************************************************************************/
+extern int safe_close(int fd);
+extern ssize_t safe_read(int fd, void *buf, size_t count);
+extern ssize_t safe_write(int fd, const void *buf, size_t count);
+extern char *dupstr(char* s);
+extern int nonrt_system(const char *cmd);
+
+
+#endif	// __UTILITY_H__
diff --git a/src/apps/atom-base/progs/property/prop/list.c b/src/apps/atom-base/progs/property/prop/list.c
new file mode 100644
index 0000000..b8ed720
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/list.c
@@ -0,0 +1,110 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef DEBUG
+#include <assert.h>
+#endif
+#include "list.h"
+
+/*******************************************************************************/
+/* LIST local definitions                                                      */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* LIST local prototypes                                                       */
+/*******************************************************************************/
+static inline void __list_add(struct list *entry, struct list *prev, struct list *next)
+{
+	next->prev = entry;
+	entry->next = next;
+	entry->prev = prev;
+	prev->next = entry;
+}
+
+static inline void __list_del(struct list *prev, struct list *next)
+{
+	next->prev = prev;
+	prev->next = next;
+}
+
+/*******************************************************************************/
+/* LIST local variables                                                        */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* LIST local functions                                                        */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* LIST functions                                                              */
+/*******************************************************************************/
+void list_add(struct list *entry, struct list *head)
+{
+	__list_add(entry, head, head->next);
+}
+
+void list_add_tail(struct list *entry, struct list *head)
+{
+	__list_add(entry, head->prev, head);
+}
+
+void list_del(struct list *entry)
+{
+	__list_del(entry->prev, entry->next);
+}
+
+void list_del_init(struct list *entry)
+{
+	__list_del(entry->prev, entry->next);
+	INIT_LIST(entry);
+}
+
+void list_replace(struct list *orig, struct list *repl)
+{
+	if (!list_empty(orig)) {
+		repl->next = orig->next;
+		repl->prev = orig->prev;
+		repl->next->prev = repl;
+		repl->prev->next = repl;
+		INIT_LIST(orig);
+	} else {
+		INIT_LIST(repl);
+	}
+}
+
+int list_empty(const struct list *head)
+{
+	return (head->next == head);
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop.service b/src/apps/atom-base/progs/property/prop/prop.service
new file mode 100644
index 0000000..63d14f4
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=prop Daemon
+
+[Service]
+ExecStart=/usr/bin/prop
+Restart=always
+
+[Install]
+WantedBy=basic.target
diff --git a/src/apps/atom-base/progs/property/prop/prop_api.c b/src/apps/atom-base/progs/property/prop/prop_api.c
new file mode 100644
index 0000000..8b029c6
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_api.c
@@ -0,0 +1,217 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <cutils/properties.h>
+#include "request.h"
+#include "prop_debug.h"
+#include "prop_test.h"
+#include "list.h"
+
+/*******************************************************************************/
+/* LIBSNCFG functions for Android Property Mechanism                           */
+/*******************************************************************************/
+int _property_check(const char *key, const char *value)
+{
+    if (key == 0) {
+		 PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key==0 return directly\n");
+		 return -1;
+	}
+
+    if (strlen(key) >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key=%s size:%zd >= max:%d\n",
+				                            key, strlen(key), PROPERTY_KEY_MAX);
+		 return -1;
+	}
+
+    if (strlen(value) >= PROPERTY_VALUE_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] value=%s size:%zd >= max:%d\n",
+				                            value, strlen(value), PROPERTY_VALUE_MAX);
+		return -1;
+	}
+	
+    return  0;
+}
+
+int property_get(const char *key, char *value, const char *default_value)
+{
+	struct  sncfg_request request;
+    int     ret_len = 1;
+
+    /*check validaty*/
+    if ((key == 0) || (value == 0)) {
+		 PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key==0 return directly\n");
+		 return -1;
+	}
+
+	if (strlen(key) >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "[PropSet] key=%s size:%zd >= max:%d\n",
+											key, strlen(key), PROPERTY_KEY_MAX);
+		 return -1;
+	}
+
+    /*send socket to get the value*/
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_GET;
+	request.key = (char *)key;
+	if (request_for_sncfg(&request) < 0) {
+        ret_len = 0;        
+	} else if (NULL == request.value) {
+        ret_len = 0;
+    }
+
+    /*
+    *  1. normal case: use db's value.
+    *  2. other case: use default value.
+    */
+    if (ret_len>0) {
+        ret_len = strlen(request.value);
+        if (ret_len >= PROPERTY_VALUE_MAX)  {
+            ret_len = PROPERTY_VALUE_MAX - 1;
+        }
+        strncpy(value, request.value, ret_len);
+        value[ret_len] = '\0';
+    } else {
+        if (default_value) {
+            ret_len = strlen(default_value);
+            if (ret_len >= PROPERTY_VALUE_MAX) {
+                ret_len = PROPERTY_VALUE_MAX - 1;
+            }
+            memcpy(value, default_value, ret_len);
+            value[ret_len] = '\0';
+        } else {
+            value[0] = '\0';
+        }
+    }
+
+	return  ret_len;	
+}
+
+int property_set(const char *key, const char *in_value)
+{
+	struct 	sncfg_request request;
+	char	*value = "";
+
+	if (in_value != NULL)
+		value = in_value;
+	
+    if (_property_check(key, value) < 0) {
+        return  -1;
+    }
+
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_SET;
+	request.key = (char *)key;
+	request.value = (char *)value;
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+	
+	return 0;
+}
+
+int property_reload(void)
+{
+	struct sncfg_request request;
+	
+	bzero(&request, sizeof(struct sncfg_request));
+	
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_RELOAD;	
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+	
+	return 0;		
+}
+
+int property_debug(char *key, char *in_value)
+{
+	struct sncfg_request request;
+	char	*value = "";
+
+	if (in_value != NULL)
+		value = in_value;
+
+    if (_property_check(key, value) < 0) {
+        return  -1;
+    }
+    
+	bzero(&request, sizeof(struct sncfg_request));
+	request.magic = SNCFG_REQUEST_MAGIC;
+	request.type = SNCFG_REQUEST_TYPE_PROP_DEBUG;
+	request.key = key;
+	request.value = value;
+	if (request_for_sncfg(&request) < 0) {
+		return -1;
+	}
+
+	return 0;	
+}
+
+int property_test(char *key, char *in_value)
+{
+	struct sncfg_request request;
+	char	*value = "";
+
+	if (in_value != NULL)
+		value = in_value;
+
+    if (_property_check(key, value) < 0) {
+        return  -1;
+    }
+
+    if (strncmp("UT", key, strlen("UT")) == 0) {
+        prop_test_func(key, value);
+        return  0;
+    }
+    if (strncmp("NULL", key, strlen("NULL")) == 0) {
+        prop_test_func(key, value);
+        return  0;
+    } else {        
+    	bzero(&request, sizeof(struct sncfg_request));
+    	request.magic = SNCFG_REQUEST_MAGIC;
+    	request.type = SNCFG_REQUEST_TYPE_PROP_TEST;
+    	request.key = key;
+    	request.value = value;
+    	if (request_for_sncfg(&request) < 0) {
+    		return -1;
+    	}
+
+    	return 0;	
+    }
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop_core.c b/src/apps/atom-base/progs/property/prop/prop_core.c
new file mode 100644
index 0000000..79f518a
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_core.c
Binary files differ
diff --git a/src/apps/atom-base/progs/property/prop/prop_db.c b/src/apps/atom-base/progs/property/prop/prop_db.c
new file mode 100644
index 0000000..ae7ba53
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_db.c
@@ -0,0 +1,276 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include "prop_db.h"
+#include "prop_debug.h"
+#include "list.h"
+
+#define PROP_DB_HASH_SIZE		32
+
+static struct   list prop_db_hash[PROP_DB_HASH_SIZE];
+static int      prop_db_inited=0;
+
+static int _prop_db_hash(const char *prop_key)
+{
+	int     i, v = 0;
+	char    *c;
+
+	for (i = 31, c = (char *)prop_key; i != 0 && *c != '\0'; i--, c++) {
+		v += *c;
+	}
+
+	return (v % PROP_DB_HASH_SIZE);
+}
+
+int _prop_db_add(const char *in_key, const char *in_value)
+{
+    prop_db_info_t      *prop_item;
+    int                 hash_value;
+    int                 key_length;
+    int                 value_length;
+    char                *value_ptr;
+    char                *key_ptr;
+
+
+    /*terminate the length*/
+    key_length = strlen(in_key);
+    if (key_length >= PROP_DB_KEY_SIZE)
+        key_length = PROP_DB_KEY_SIZE - 1;
+
+    value_length = strlen(in_value);
+    if (value_length >= PROP_DB_VALUE_SIZE)
+        value_length = PROP_DB_VALUE_SIZE - 1;
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "...key:%s value:%s key-len:%d val-len:%d",
+					in_key, in_value,
+					key_length, value_length);
+
+    /*Allocate the buffer*/
+    prop_item = malloc(sizeof(prop_db_info_t));
+	if (!prop_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't malloc buffer!!");
+		return -1;
+	}
+    value_ptr = malloc(value_length+1);
+	if (!value_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't malloc value buffer!!");
+        free(prop_item);
+		return -1;
+	}
+
+    key_ptr = malloc(key_length+1);
+	if (!key_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't malloc key buffer!!");
+        free(prop_item);
+        free(value_ptr);
+		return -1;
+	}
+
+    /*value the item*/
+    memset(prop_item, 0x0, sizeof(prop_db_info_t));
+	prop_item->prop_value = value_ptr;
+	prop_item->prop_key = key_ptr;
+
+    strncpy(prop_item->prop_value, in_value, value_length);
+    prop_item->prop_value[value_length] = '\0';
+
+    strncpy(prop_item->prop_key, in_key, key_length);
+    prop_item->prop_key[key_length] = '\0';
+
+    /*Link to the hash list*/
+	INIT_LIST(&(prop_item->sibling));
+    hash_value = _prop_db_hash(prop_item->prop_key);
+	list_add(&(prop_item->sibling), &(prop_db_hash[hash_value]));
+
+	return 0;
+}
+
+prop_db_info_t *_prop_db_get(const char *in_key)
+{
+    int             hash_value;
+	struct list     *list_head;
+	struct list     *list_item;
+    prop_db_info_t  *prop_item;
+
+    hash_value = _prop_db_hash(in_key);
+
+    list_head = &(prop_db_hash[hash_value]);
+	LIST_CHECK(list_head);
+
+	LIST_FOR_EACH(list_item, list_head) {
+		LIST_CHECK(list_item);
+
+        prop_item = (prop_db_info_t *)list_item;
+		if (!strcmp(in_key, prop_item->prop_key)) {
+			return  prop_item;
+		}
+	}
+
+	return  NULL;
+}
+
+int prop_db_get(const char *in_key, char * value)
+{
+    prop_db_info_t  *prop_item = NULL;
+    int             length;
+
+    if (!prop_db_inited) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Not Inited!");
+		return	-1;
+	}
+
+    if (!in_key || !value) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Wrong key or value!");
+		return	-1;
+	}
+
+    prop_item = _prop_db_get(in_key);
+    if (!prop_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can not find the value! key:%s ", in_key);
+        return  -1;
+    }
+
+    length = strlen(prop_item->prop_value);
+    if (length >= (PROP_DB_VALUE_SIZE-1))
+        length = PROP_DB_VALUE_SIZE-1;
+
+    strncpy(value, prop_item->prop_value, length);
+    value[length] = '\0';
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " key:%s..value:%s length:%d ", in_key, value, length);
+
+    return  0;
+}
+
+int prop_db_set(const char *in_key, const char *in_value)
+{
+    prop_db_info_t      *prop_item;
+    int                 value_length;
+    char                *value_ptr;
+
+    if (!prop_db_inited) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Not Inited!");
+		return	-1;
+	}
+
+    if (!in_key || !in_value) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Wrong key or value!");
+		return	-1;
+	}
+
+    /*Add the item*/
+    prop_item = _prop_db_get(in_key);
+    if (!prop_item) {
+        return  _prop_db_add(in_key, in_value);
+    }
+
+    /*terminate the length*/
+    value_length = strlen(in_value);
+    if (value_length >= PROP_DB_VALUE_SIZE)
+        value_length = PROP_DB_VALUE_SIZE - 1;
+
+    /*check if old buffer can be re-used*/
+    if (prop_item->prop_value) {
+        if (value_length <= strlen(prop_item->prop_value)) {
+            strncpy(prop_item->prop_value, in_value, value_length);
+            prop_item->prop_value[value_length] = '\0';
+
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Update the item ");
+            return  0;
+        }
+    }
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Update item with big wrongs. key:%s value:%s ", in_key, in_value);
+
+    /*shoule allocate first, then delete old one*/
+    value_ptr = malloc(value_length+1);
+	if (!value_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't malloc for set prop_value!!");
+		return -1;
+	}
+    strncpy(value_ptr, in_value, value_length);
+    value_ptr[value_length] = '\0';
+
+    /*need to free old value buffer*/
+    if (prop_item->prop_value)
+        free(prop_item->prop_value);
+
+    prop_item->prop_value = value_ptr;
+
+    return  0;
+}
+
+void prop_db_dump(void)
+{
+    int             hash_value;
+	struct list     *list_head;
+	struct list     *list_item;
+    prop_db_info_t  *prop_item;
+
+    if (!prop_db_inited)
+        return;
+
+	syslog(LOG_DEBUG, "\n\n\r Dumping properties...");
+
+	for (hash_value=0; hash_value<PROP_DB_HASH_SIZE; hash_value++) {
+		list_head = &(prop_db_hash[hash_value]);
+		if (list_empty(list_head))
+			continue;
+
+		LIST_FOR_EACH(list_item, list_head) {
+			LIST_CHECK(list_item);
+
+			prop_item = (prop_db_info_t *)list_item;
+			syslog(LOG_DEBUG, "\n\r    %s=%s", prop_item->prop_key, prop_item->prop_value);
+		}
+	}
+
+	printf("\n");
+
+    return;
+}
+
+void prop_db_init(void)
+{
+    int i;
+
+	for (i=0; i<PROP_DB_HASH_SIZE; i++) {
+		INIT_LIST(&prop_db_hash[i]);
+	}
+
+    prop_db_inited = 1;
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop_debug.c b/src/apps/atom-base/progs/property/prop/prop_debug.c
new file mode 100644
index 0000000..35bbc68
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_debug.c
@@ -0,0 +1,62 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include "prop_debug.h"
+
+unsigned int prop_debug_level = PROP_DEBUG_ERROR;
+
+char *prop_debug_name[] =
+	{
+		"",
+		"TEST! ",
+		"FAIL! ",
+		"WARN! ",
+		"TRACE! ",
+		"INFO! ",
+		"LOUD! ",
+	};
+
+int prop_debug_set(unsigned int level)
+{
+    if ((level>=PROP_DEBUG_OFF) && (level <=PROP_DEBUG_LOUD)) {
+        prop_debug_level = level;
+    }
+
+    return  0;
+}
+
+int prop_debug_get(void)
+{
+    return  prop_debug_level;
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop_file.c b/src/apps/atom-base/progs/property/prop/prop_file.c
new file mode 100644
index 0000000..40811f6
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_file.c
@@ -0,0 +1,656 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <dirent.h>		//for read directories
+#include <errno.h>
+#include <cutils/properties.h>
+#include "prop_file.h"
+#include "prop_db.h"
+#include "prop_debug.h"
+#include "prop_core.h"
+#include "prop_svc.h"
+
+typedef enum
+{
+	svc_cmd_type_command=1,
+	svc_cmd_type_service,
+	svc_cmd_type_onproperty,
+	svc_cmd_type_others
+
+}prop_file_svc_cmd_t;
+
+/*for APSIM, must put in /mnt/sncfg/apsim/*/
+#if defined(PARTITION_FOR_APSIM)
+#define PROP_CORE_PERSISTENT_PROPERTY_DIR   "/mnt/sncfg/apsim/property"
+#define PROP_CORE_PROPERTY_DIR              "/mnt/sncfg/apsim/property"
+#else
+#define PROP_CORE_PERSISTENT_PROPERTY_DIR   "/data/property"
+#define PROP_CORE_PROPERTY_DIR              "/data/property"
+#endif
+
+#define PROP_CORE_SERVICE_DIR               "/"
+#define	PROP_CORE_PROP_DEFAULT		"/default.prop"
+#define	PROP_CORE_PROP_SYSTEM_BUILD	"/system/build.prop"
+#define	PROP_CORE_PROP_VENDOR_BUILD	"/vendor/build.prop"
+#define	PROP_CORE_PROP_LOCAL		"/data/local.prop"
+#define	PROP_CORE_PROP_FACTORY		"/factory/factory.prop"
+
+static int prop_file_persist_load_done = 0;
+static int prop_file_persist_bootup_sync = 0;
+
+static void _prop_file_trim_line(char *line)
+{
+	int		len;
+	int		index;
+
+	if (!line)
+		return;
+
+	len = strlen(line);
+	if (len <= 0)
+		return;
+
+	for (index=len-1; index >= 0; index-- ) {
+		if ((line[index] == ' ') ||
+			(line[index] == '\n')) {
+			line[index] = '\0';
+		} else {
+			break;
+		}
+	}
+
+	return;
+}
+
+/*
+ * Filter is used to decide which properties to load: NULL loads all keys,
+ * "ro.foo.*" is a prefix match, and "ro.foo.bar" is an exact match.
+ */
+static void _prop_file_load_properties(char *data, const char *filter)
+{
+    char *key, *value, *eol, *sol, *tmp;
+    size_t flen = 0;
+
+    if (filter) {
+        flen = strlen(filter);
+    }
+
+    sol = data;
+    while ((eol = strchr(sol, '\n')))
+    {
+        key = sol;
+        *eol++ = 0;
+        sol = eol;
+
+        while (isspace(*key)) key++;
+        if (*key == '#')
+			continue;
+
+        tmp = eol - 2;
+        while ((tmp > key) && isspace(*tmp)) *tmp-- = 0;
+
+        {
+            value = strchr(key, '=');
+            if (!value) continue;
+            *value++ = 0;
+
+            tmp = value - 2;
+            while ((tmp > key) && isspace(*tmp)) *tmp-- = 0;
+
+            while (isspace(*value)) value++;
+
+            if (flen > 0) {
+                if (filter[flen - 1] == '*') {
+                    if (strncmp(key, filter, flen - 1)) continue;
+                } else {
+                    if (strcmp(key, filter)) continue;
+                }
+            }
+
+            prop_core_set(key, value);
+        }
+    }
+}
+
+static int _prop_file_parse_svc_service(const char *line_buf, char *prop_key, char *daemon_name)
+{
+	char	*key_ptr, *value_ptr, *temp_ptr;
+	int		length_key, length_value;
+
+	key_ptr = strstr(line_buf, PROP_SVC_SERVICE);
+	if (!key_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Not the service line...Line:%s ", line_buf);
+		return	-1;
+	}
+
+	if (strlen(key_ptr) < 8) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "service length wrong. len:%d Line:%s ", strlen(key_ptr), line_buf);
+		return	-1;
+	}
+
+	/*skip the : and space*/
+	key_ptr = key_ptr + strlen(PROP_SVC_SERVICE);
+	while (*key_ptr == ' ') {
+		key_ptr++;
+	}
+
+	temp_ptr = strstr(key_ptr, " ");
+	if (!temp_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line...key:%s line:%s ", key_ptr, line_buf);
+		return	-1;
+	}
+
+	length_key = (int)temp_ptr - (int)key_ptr;
+	if (length_key >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong key len:%d line:%s ", length_key, line_buf);
+		return	-1;
+	}
+
+	strncpy(prop_key, key_ptr, length_key);
+	prop_key[length_key] = '\0';
+
+	value_ptr = temp_ptr;
+	while (*value_ptr == ' ') {
+		value_ptr++;
+	}
+
+	length_value = strlen(value_ptr);
+	if (length_value>= PROP_SVC_ACTION_MAX_SIZE) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong value len:%d line:%s ", length_value, line_buf);
+		return	-1;
+	}
+
+	strcpy(daemon_name, value_ptr);
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " line:%s key:%s value:%s ", line_buf, prop_key, daemon_name);
+
+	return	0;
+}
+
+static int _prop_file_parse_svc_onproperty(char *line_buf, char *prop_key, char *prop_value)
+{
+	char	*key_ptr, *value_ptr, *temp_ptr;
+	int		length_key, length_value;
+
+	key_ptr = strstr(line_buf, ":");
+	if (!key_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line...Line:%s ", line_buf);
+		return	-1;
+	}
+
+	if (strlen(key_ptr) < 4) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line len:%d Line:%s ", strlen(key_ptr), line_buf);
+		return	-1;
+	}
+
+	/*skip the : and space*/
+	key_ptr++;
+	while (*key_ptr == ' ') {
+		key_ptr++;
+	}
+
+	temp_ptr = strstr(key_ptr, "=");
+	if (!temp_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line without '=' line:%s Line:%s ", key_ptr, line_buf);
+		return	-1;
+	}
+
+	while ((temp_ptr >= key_ptr) && *temp_ptr == ' ') {
+		temp_ptr--;
+	}
+
+	if (temp_ptr <= key_ptr) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line...2...Line:%s ", line_buf);
+		return	-1;
+	}
+
+	length_key = (int)temp_ptr - (int)key_ptr;
+
+	strncpy(prop_key, key_ptr, length_key);
+	prop_key[length_key] = '\0';
+	value_ptr = strstr(temp_ptr, "=");
+	if (strlen(value_ptr) < 2) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line...3...value:%s ", value_ptr);
+		return	-1;
+	}
+
+	/*skip the = and space*/
+	value_ptr++;
+	while (*value_ptr == ' ') {
+		value_ptr++;
+	}
+
+	length_value = strlen(value_ptr);
+	if (length_value>= PROPERTY_VALUE_MAX)
+		length_value = PROPERTY_VALUE_MAX - 1;
+
+	if ((length_value+length_key) >= PROPERTY_VALUE_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong value or length. key_len:%d value_len:%d value:%s ",
+						length_key, length_value, value_ptr);
+		return	-1;
+	}
+
+	strncpy(prop_value, value_ptr, length_value);
+	prop_value[length_value] = '\0';
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " End. key:%s value:%s line_buf:%s ", prop_key, prop_value, value_ptr);
+
+	return	0;
+
+}
+
+prop_file_svc_cmd_t _prop_file_parse_svc_type(char *line_buf)
+{
+	char						on_property[] = "on property:";
+	char						service[] = "service ";
+	prop_file_svc_cmd_t			cur_command_type;
+
+	if (strncmp(line_buf, on_property, strlen(on_property)) == 0) {
+		cur_command_type = svc_cmd_type_onproperty;
+	} else if (strncmp(line_buf, service, strlen(service)) == 0) {
+		cur_command_type = svc_cmd_type_service;
+	} else if ( (line_buf[0] == ' ') &&
+		 (line_buf[1] == ' ') &&
+		 (line_buf[2] == ' ') &&
+		 (line_buf[3] == ' ') &&
+		 (line_buf[4] != ' ')) {
+		/*how many space?*/
+		cur_command_type = svc_cmd_type_command;
+	} else {
+		cur_command_type = svc_cmd_type_others;
+	}
+
+	return	cur_command_type;
+
+}
+
+/* reads a file, making sure it is terminated with \n \0 */
+void *_prop_file_read_file(const char *fn, unsigned *_sz)
+{
+    char *data = NULL;
+    int sz;
+    int fd;
+
+    data = 0;
+    fd = open(fn, O_RDONLY);
+    if (fd < 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "... :%s ", fn);
+		return 0;
+	}
+
+    sz = lseek(fd, 0, SEEK_END);
+    if (sz < 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "... :%s ", fn);
+        goto oops;
+	}
+
+    if (lseek(fd, 0, SEEK_SET) != 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "... :%s ", fn);
+		goto oops;
+	}
+
+    data = (char*) malloc(sz + 2);
+    if (data == 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "... :%s ", fn);
+		goto oops;
+	}
+
+    if (read(fd, data, sz) != sz) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "... :%s ", fn);
+		goto oops;
+	}
+
+    close(fd);
+    data[sz] = '\n';
+    data[sz+1] = 0;
+    if(_sz) *_sz = sz;
+
+    return data;
+
+oops:
+    close(fd);
+    if (data != 0)
+        free(data);
+
+    return 0;
+}
+
+static void _prop_file_load_dir_svc(void)
+{
+#define	LINE_BUFFER_MAX_SIZE	256
+    DIR         *dir;
+    struct      dirent*  entry;
+	char        folder_path[264];
+	FILE 		*read_file;
+	char		line_buf[LINE_BUFFER_MAX_SIZE];
+	prop_file_svc_cmd_t			cur_command_type;
+	prop_svc_t			*cur_svc;
+	prop_svc_t			svc_buf;
+	char				*act_ptr;
+	char				act_name[PROP_SVC_ACTION_MAX_SIZE];
+	int					index;
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Begin. ");
+
+    dir = opendir(PROP_CORE_SERVICE_DIR);
+    if (!dir) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to open default property directory %s errno: %d", PROP_CORE_SERVICE_DIR, errno);
+        return;
+    }
+
+    while ((entry = readdir(dir)) != NULL) {
+	    if (!strstr(entry->d_name, ".rc"))
+            continue;
+
+		sprintf(folder_path, "%s/%s", PROP_CORE_SERVICE_DIR, entry->d_name);
+
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Begin parse the line. file-name:%s ", folder_path);
+
+		read_file = fopen(folder_path , "r" );
+		if (!read_file) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to open default file %s errno: %d\n", folder_path, errno);
+			continue;
+		}
+
+		cur_svc = NULL;
+		while (fgets(line_buf, LINE_BUFFER_MAX_SIZE-1, read_file ) != NULL) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " line:%s len:%d", line_buf, strlen(line_buf));
+
+			/*trim out '\n'...*/
+			_prop_file_trim_line(line_buf);
+
+			/*filter out #*/
+			index = 0;
+			while (line_buf[index] == ' ') index++;
+			if (line_buf[index] == '#')
+				continue;
+
+			cur_command_type = _prop_file_parse_svc_type(line_buf);
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " line_buf:%s len:%d command_type:%d ", line_buf, strlen(line_buf), cur_command_type);
+
+			switch (cur_command_type) {
+				case svc_cmd_type_command:
+					if (cur_svc) {
+						act_ptr = line_buf;
+						while (*act_ptr == ' ')
+							act_ptr++;
+
+						if (strlen(act_ptr) >= PROP_SVC_ACTION_MAX_SIZE) {
+							PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Action length exceed MAX %s ", act_ptr);
+						} else {
+							if (prop_svc_add_act(cur_svc->svc_name, cur_svc->svc_key, cur_svc->svc_value, act_ptr) < 0) {
+								PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can not add the action.name:%s %s ", cur_svc->svc_key, act_ptr);
+							}
+						}
+					} else {
+						PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Wrong command, because of no prefix. Line:%s ", line_buf);
+					}
+					break;
+
+				case svc_cmd_type_service:
+					cur_svc = &svc_buf;
+					memset(cur_svc, 0x0, sizeof(prop_svc_t));
+					INIT_LIST(&(cur_svc->act_list));
+					INIT_LIST(&(cur_svc->slist));
+					strcpy(cur_svc->svc_name, entry->d_name);
+                    cur_svc->svc_type = PROP_SVC_TYPE_SERVICE;
+					if (_prop_file_parse_svc_service(line_buf, cur_svc->svc_key, act_name) < 0) {
+						PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to parse the name %s\n", line_buf);
+						cur_svc = NULL;
+					} else {
+						PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " service! name:%s daemon:%s ", cur_svc->svc_key, act_name);
+						if (prop_svc_add(cur_svc) < 0)
+						{
+							PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to add the on property");
+							cur_svc = NULL;
+						} else {
+							if (prop_svc_add_act(cur_svc->svc_name, cur_svc->svc_key, NULL, act_name) < 0) {
+								PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to add the property");
+								cur_svc = NULL;
+							}
+						}
+					}
+
+					/*Init the cur_svc, since only need the first line for service*/
+					cur_svc = NULL;
+					break;
+
+				case svc_cmd_type_onproperty:
+					cur_svc = &svc_buf;
+					/*parse key and value*/
+					memset(cur_svc, 0x0, sizeof(prop_svc_t));
+					INIT_LIST(&(cur_svc->act_list));
+					INIT_LIST(&(cur_svc->slist));
+					strcpy(cur_svc->svc_name, entry->d_name);
+                    cur_svc->svc_type = PROP_SVC_TYPE_ON_PROPERTY;
+					if (_prop_file_parse_svc_onproperty(line_buf, cur_svc->svc_key, cur_svc->svc_value) < 0) {
+						PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to parse the name %s ", line_buf);
+						cur_svc = NULL;
+					} else {
+						PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " onproperty!line_buf:%s key:%s value:%s ",
+										 line_buf, cur_svc->svc_key, cur_svc->svc_value);
+						if (prop_svc_add(cur_svc) < 0) {
+							PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to add the onproperty");
+							cur_svc = NULL;
+						}
+					}
+
+					break;
+
+				case svc_cmd_type_others:
+				default:
+					cur_svc = NULL;
+					break;
+			}
+		}
+
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " File end. ");
+		fclose ( read_file );
+    }
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Directory end. ");
+    closedir(dir);
+}
+
+static void _prop_file_load_props_file(const char *file_path)
+{
+    char        *data;
+    unsigned    sz;
+
+    data = _prop_file_read_file(file_path, &sz);
+    if(0 == data) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to read file data. File:%s ", file_path);
+		return;
+    }
+
+	_prop_file_load_properties(data, NULL);
+	free(data);
+
+	return;
+}
+
+static void _prop_file_load_dir_props(void)
+{
+    DIR         *dir;
+    struct      dirent*  entry;
+	char        folder_path[256];
+    char        *data;
+    unsigned    sz;
+
+    dir = opendir(PROP_CORE_PROPERTY_DIR);
+    if (!dir) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to open default property directory %s errno: %d ", PROP_CORE_PROPERTY_DIR, errno);
+        return;
+    }
+
+    while ((entry = readdir(dir)) != NULL) {
+	    if (!strstr(entry->d_name, ".prop"))
+            continue;
+
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " *.prop file. file:%s ", entry->d_name);
+
+		sprintf(folder_path, "%s/%s", PROP_CORE_PROPERTY_DIR, entry->d_name);
+        data = _prop_file_read_file(folder_path, &sz);
+        if(data != 0) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to read file data. File:%s ", folder_path);
+            _prop_file_load_properties(data, NULL);
+            free(data);
+        }
+    }
+    closedir(dir);
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " End. ");
+}
+
+static void _prop_file_load_dir_persistent(void)
+{
+    DIR         *dir;
+    int         dir_fd;
+    struct      dirent*  entry;
+    char        value[PROPERTY_VALUE_MAX];
+    int         fd, length;
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Begin. ");
+
+    dir = opendir(PROP_CORE_PERSISTENT_PROPERTY_DIR);
+    if (!dir) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to open persistent property directory %s errno: %d\n", PROP_CORE_PERSISTENT_PROPERTY_DIR, errno);
+        return;
+    }
+
+    dir_fd = dirfd(dir);
+    while ((entry = readdir(dir)) != NULL) {
+        if (strncmp("persist.", entry->d_name, strlen("persist.")))
+            continue;
+
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " persist.* file. file:%s ", entry->d_name);
+
+        /* open the file and read the property value */
+        fd = openat(dir_fd, entry->d_name, O_RDONLY);
+        if (fd < 0) {
+            PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to open persistent property file. %s errno: %d ",
+                  entry->d_name, errno);
+            continue;
+        }
+
+        length = read(fd, value, sizeof(value) - 1);
+        close(fd);
+
+        if (length >= 0) {
+            value[length] = 0;
+            prop_core_set(entry->d_name, value);
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " name:%s value:%s ", entry->d_name, value);
+        } else {
+            PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to read persistent property file %s errno: %d\n",
+                  entry->d_name, errno);
+        }
+    }
+    closedir(dir);
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " End. ");
+}
+
+void prop_file_write_persistent(const char *name, const char *value)
+{
+#define     PROP_FILE_PATH_MAX    256
+    char    temp_path[PROP_FILE_PATH_MAX];
+    char    path[PROP_FILE_PATH_MAX];
+	FILE 	*file_ptr;
+
+    /*avoid to overwrite by default value*/
+    if (!prop_file_persist_load_done) {
+        snprintf(path, sizeof(path), "%s/%s", PROP_CORE_PERSISTENT_PROPERTY_DIR, name);
+        if (0 == access(path, F_OK)){
+            return;
+        }
+
+        prop_file_persist_bootup_sync = 1;
+    }
+
+    PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "key:%s value:%s ", name, value);
+
+    snprintf(temp_path, sizeof(temp_path), "%s/.temp.xxx", PROP_CORE_PERSISTENT_PROPERTY_DIR);
+
+	file_ptr = fopen(temp_path , "w");
+    if (!file_ptr) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to write persistent property to temp file %s errno: %d", temp_path, errno);
+        return;
+    }
+
+	fwrite(value, 1, strlen(value), file_ptr);
+    fflush(file_ptr);
+	fclose(file_ptr);
+
+    snprintf(path, sizeof(path), "%s/%s", PROP_CORE_PERSISTENT_PROPERTY_DIR, name);
+    if (rename(temp_path, path) < 0) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Unable to rename persistent property file %s to %s ", temp_path, path);
+    }
+
+    /*bootup performance*/
+    if (prop_file_persist_load_done) {
+        sync();
+    }
+}
+
+void prop_file_load_props(void)
+{
+    char    temp_path[128];
+    prop_file_persist_load_done = 0;
+
+	/*make sure folder exist*/
+    snprintf(temp_path, sizeof(temp_path), "mkdir -p %s", PROP_CORE_PERSISTENT_PROPERTY_DIR);
+	system(temp_path);
+
+	_prop_file_load_props_file(PROP_CORE_PROP_DEFAULT);
+	_prop_file_load_props_file(PROP_CORE_PROP_SYSTEM_BUILD);
+	_prop_file_load_props_file(PROP_CORE_PROP_VENDOR_BUILD);
+	_prop_file_load_props_file(PROP_CORE_PROP_FACTORY);
+	_prop_file_load_props_file(PROP_CORE_PROP_LOCAL);
+    _prop_file_load_dir_persistent();
+
+    if (prop_file_persist_bootup_sync){
+        sync();
+    }
+    prop_file_persist_load_done = 1;
+}
+
+void prop_file_load_svc(void)
+{
+    _prop_file_load_dir_svc();
+}
+
diff --git a/src/apps/atom-base/progs/property/prop/prop_sncfg.c b/src/apps/atom-base/progs/property/prop/prop_sncfg.c
new file mode 100644
index 0000000..43f917c
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_sncfg.c
@@ -0,0 +1,407 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include "list.h"
+#include "prop_core.h"
+#include <cutils/properties.h>
+#include "prop_debug.h"
+#include "prop_svc.h"
+#include "utility.h"
+#include "request.h"
+
+static pthread_t        prop_pthread;
+static struct list      prop_queue_list;
+static pthread_mutex_t  prop_queue_mutex;
+static pthread_cond_t   prop_queue_condition;
+static int              prop_queue_inited=0;
+
+/** Signed 8-bit */
+typedef char               s_8;
+
+/** Signed 16-bit */
+typedef short              s_16;
+
+#if defined (__APPLE64__)
+/** Signed 32-bit */
+typedef long               s_32;
+#else
+/** Signed 32-bit */
+typedef int                s_32;
+#endif
+
+/** Signed 64-bit */
+typedef long               s_64;
+
+/** Unsigned 8-bit */
+typedef unsigned char      u_8;
+
+/** Unsigned 16-bit */
+typedef unsigned short     u_16;
+
+#if defined (__APPLE64__)
+/** Unsigned 32-bit */
+typedef unsigned long      u_32;
+#else
+/** Unsigned 32-bit */
+typedef unsigned int       u_32;
+#endif
+
+/** Unsigned 64-bit */
+typedef unsigned long      u_64;
+
+/** Boolean Definition */
+typedef int              bool;
+
+/** True Definition */
+#define SC_TRUE            0x1
+
+/** False Definition */
+#define SC_FALSE           0x0
+
+/* for checking overflow*/
+#define SC_INT_MAX         2147483647 /* 0x7fffffff */
+#define SC_INT_MIN         -2147483647
+#define SC_UINT_MAX        0xffffffff
+#define SC_ULONG_MAX       SC_UINT_MAX
+#define SC_LONG_MAX        SC_INT_MAX
+
+static s_32 util_isdigit(s_8 ch)
+{
+  if (ch >= '0' && ch <= '9')
+  {
+    return SC_TRUE;
+  }
+  else
+  {
+    return SC_FALSE;
+  }
+}
+
+static s_32 util_isspace(s_8 ch)
+{
+  if (ch == ' ' || ch == '\t' || ch == '\r' ||
+      ch == '\n' || ch == '\v' || ch == '\f')
+  {
+    return SC_TRUE;
+  }
+  else
+  {
+    return SC_FALSE;
+  }
+}
+
+/*
+ ******************************************************************************
+ *
+ *  DESCRIPTION:
+ *    This function converts the ascii string into the long int (32bit)
+ *
+ *  INPUT PARAMS
+ *    str: Pointer to the ascii string
+ *
+ *  RETURN:
+ *    Integer converted
+ *
+ ******************************************************************************
+*/
+s_32 sc_str_to_long(const s_8 * str)
+{
+  s_32 working;
+  s_32 neg;
+  s_8 *cursor;
+
+  working = 0;
+  neg     = 0;
+  cursor  = (s_8 *)str;
+
+  /* Create the number.  Method:
+     * Multiply value by 10 (harmless on first pass: 0 * 10 == 0).
+     * Add offset value (character minus '0') to number.
+     */
+
+  /* Remove leading white spaces (space, tab, vertical tab, carriage return,
+     linefeed, formfeed) */
+  while (util_isspace(*cursor))
+  {
+    cursor++;
+  }
+
+  if (*cursor == '-')
+  {
+    neg = 1;
+    cursor++;
+  }
+
+  for(; *cursor; cursor++)
+  {
+    /* Validity check */
+    if (!util_isdigit(*cursor))
+    {
+      return working;
+    }
+
+    if (working > SC_LONG_MAX/10)
+    {
+      // Overflow ( > 32 bit unsigned)
+      return SC_LONG_MAX;
+    }
+
+    working *= 10;
+    working += *cursor - '0';
+
+    if (working > SC_LONG_MAX)
+    {
+      // Overflow ( > 32 bit unsigned)
+      return SC_LONG_MAX;
+    }
+  }
+  return neg ?  (-1 * working) : working;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  sc_util_atoi
+ * DESCRIPTION
+ *  This function converts the ascii string into the long int (32bit)
+ * PARAMETERS
+ *  str     [IN]        Pointer to the ascii string
+ * RETURNS
+ *  Integer converted
+ *****************************************************************************/
+s_32 sc_util_atoi(const s_8 *str)
+{
+    /*----------------------------------------------------------------*/
+    /* Local Variables                                                */
+    /*----------------------------------------------------------------*/
+    
+    /*----------------------------------------------------------------*/
+    /* Code Body                                                      */
+    /*----------------------------------------------------------------*/
+    return (s_32)sc_str_to_long((const s_8*)str);
+}
+
+int _prop_sncfg_request_handle(const int sock, struct sncfg_request *request)
+{
+	int         size;
+    unsigned int         debug_level;
+    char        value_buffer[PROPERTY_VALUE_MAX];
+
+	switch (request->type) {
+    	case SNCFG_REQUEST_TYPE_PROP_GET:
+		    request->status = prop_core_get(request->key, value_buffer);
+            request->value = value_buffer;
+    		size = pack_request(request);
+    		if (size < 0) {
+    			request->status = -1;
+    			request->value = NULL;
+    			size = pack_request(request);
+    		}
+		    safe_write(sock, request, size);     
+    		break;
+
+    	case SNCFG_REQUEST_TYPE_PROP_SET:
+   		    request->status = prop_core_set(request->key, request->value);
+    		size = pack_request(request);
+		    safe_write(sock, request, size);
+    		break;
+
+		case SNCFG_REQUEST_TYPE_PROP_RELOAD:
+			request->status = prop_core_init();
+			request->key = NULL;
+			request->value = NULL;
+			size = pack_request(request);
+			safe_write(sock, request, size);
+			break;
+
+		case SNCFG_REQUEST_TYPE_PROP_DEBUG:
+            debug_level = (unsigned int)sc_util_atoi(request->key);
+			request->status = prop_debug_set(debug_level);
+			request->key = NULL;
+			request->value = NULL;
+			size = pack_request(request);
+			safe_write(sock, request, size);
+			break;
+
+		case SNCFG_REQUEST_TYPE_PROP_TEST:
+			request->status = prop_test_func(request->key, request->value);
+			request->value = NULL;
+			size = pack_request(request);
+			safe_write(sock, request, size);
+			break;
+
+	    default:
+    		break;
+
+    }
+
+    return  0;
+}
+
+struct req *_prop_sncfg_dequeue(void)
+{
+	struct list *p, *n;
+	struct req *temp_req;
+
+    if (!prop_queue_inited)
+        return  NULL;
+
+	pthread_mutex_lock(&prop_queue_mutex);
+
+	LIST_CHECK(&prop_queue_list);
+	if (list_empty(&prop_queue_list)) {
+		pthread_cond_wait(&prop_queue_condition, &prop_queue_mutex);
+	}
+
+	LIST_FOR_EACH_SAFE(p, n, &prop_queue_list) {
+		LIST_CHECK(p);
+		list_del(p);
+		break;
+	}
+
+	pthread_mutex_unlock(&prop_queue_mutex);
+
+	temp_req = (struct req *)p;
+
+	return temp_req;
+}
+
+void *_prop_sncfg_thread(void *arg)
+{
+	struct req             	*action_req;
+
+	for (;;) {
+        action_req = _prop_sncfg_dequeue();
+        if (NULL == action_req) {
+            continue;
+        }
+        
+    	switch (action_req->request.type) {
+			case SNCFG_REQUEST_TYPE_PROP_GET:
+			case SNCFG_REQUEST_TYPE_PROP_SET:
+			case SNCFG_REQUEST_TYPE_PROP_RELOAD:
+			case SNCFG_REQUEST_TYPE_PROP_DEBUG:
+			case SNCFG_REQUEST_TYPE_PROP_TEST:
+				_prop_sncfg_request_handle(action_req->sock, &(action_req->request));
+				safe_close(action_req->sock);
+				break;
+			case SNCFG_REQUEST_TYPE_PROP_CTRLSTOP_SIGNAL:
+				prop_core_notify_ctrl(action_req->child_pid);
+				break;
+			default:
+				break;
+
+		}
+
+		free(action_req);
+	}
+
+	pthread_exit(NULL);
+}
+
+int prop_sncfg_enqueue(struct req *req)
+{
+    if (!req)
+        return  -1;
+
+    if (!prop_queue_inited)
+        return  -1;
+
+	pthread_mutex_lock(&prop_queue_mutex);
+
+	LIST_CHECK(&prop_queue_list);
+	list_add_tail((struct list *)req, &prop_queue_list);
+	pthread_cond_signal(&prop_queue_condition);
+
+	pthread_mutex_unlock(&prop_queue_mutex);
+
+    return  0;
+}
+
+void prop_sncfg_child_exit_handle(int sig)
+{
+	pid_t		pid;
+	int			ret_val;
+	struct 		req *req;
+	int 		status;
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Begin");
+
+	while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Get the pid:%d ", pid);
+
+		req = malloc(sizeof(struct req));
+		if (!req) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't malloc!!");
+			return;
+		}
+
+		memset(req, 0x0, sizeof(struct req));
+		req->child_pid = pid;
+		req->request.magic = SNCFG_REQUEST_MAGIC;
+		req->request.type = SNCFG_REQUEST_TYPE_PROP_CTRLSTOP_SIGNAL;
+
+		ret_val = prop_sncfg_enqueue(req);
+		if (ret_val < 0) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't enque!!");
+			free(req);
+		}
+	}
+}
+
+int prop_sncfg_init(void)
+{
+    /*Init the queue DBS*/
+    INIT_LIST(&prop_queue_list);
+	pthread_mutex_init(&prop_queue_mutex, NULL);
+	pthread_cond_init(&prop_queue_condition, NULL);
+    prop_queue_inited = 1;
+
+    /*Property handle thread*/
+	if (pthread_create(&prop_pthread, NULL, _prop_sncfg_thread, (void *)NULL) != 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Can't create thread. %s !!", strerror(errno));
+        return  -1;
+	}
+
+    /*Init the Property DB and load *.prop, *.rc, persist.* files.*/
+    prop_core_init();
+
+    return 0;
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop_svc.c b/src/apps/atom-base/progs/property/prop/prop_svc.c
new file mode 100644
index 0000000..531fa23
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_svc.c
@@ -0,0 +1,508 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <syslog.h>
+#include "prop_svc.h"
+#include "prop_debug.h"
+#include "list.h"
+
+static struct list prop_svc_list;
+
+/*
+*  parse out the daemon-name.
+*  Format : service service-name /path/daemon-name
+*/
+int prop_svc_get_daemon(const prop_svc_t *act_item, char *in_buf)
+{
+	struct list 		*act_node;
+	prop_svc_act_t		*svc_act;
+	char				*buf_ptr;
+	int					len, index;
+
+	if (!act_item || !in_buf)
+		return	-1;
+
+	LIST_FOR_EACH(act_node, &(act_item->act_list)) {
+		LIST_CHECK(act_node);
+		svc_act = LIST_ENTRY(act_node, prop_svc_act_t, alist);
+		if (svc_act) {
+			/*act_name: service service-name /path/daemon-name*/
+			if (svc_act->act_name) {
+				/*filter out the space*/
+				len = strlen(svc_act->act_name);
+				buf_ptr = svc_act->act_name;
+				for (index=len-1; index>=0; index--) {
+					if (buf_ptr[index] == ' ')
+						continue;
+
+					break;
+				}
+
+				/*find the reverse ' ' or '/' */
+				for (; index>=0; index--) {
+					if ((buf_ptr[index] == ' ') ||
+						(buf_ptr[index] == '/')) {
+						strcpy(in_buf, &(buf_ptr[index+1]));
+						PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Get the actions...act_name:%s daemon-name:%s",
+															svc_act->act_name, in_buf);
+
+						return	0;
+					}
+				}
+			}
+		}
+	}
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can not Get the actions...name:%s", act_item->svc_key);
+	return	-1;
+
+}
+
+/*
+*  parse out the daemon-name.
+*  Format : service service-name /path/daemon-name
+*/
+int prop_svc_get_daemon_ext(const prop_svc_t *act_item, char *in_buf)
+{
+	struct list 		*act_node = NULL;
+	prop_svc_act_t		*svc_act = NULL;
+	char				*buf_ptr = NULL;
+
+	if (!act_item || !in_buf)
+		return	-1;
+
+	LIST_FOR_EACH(act_node, &(act_item->act_list)) {
+		LIST_CHECK(act_node);
+		svc_act = LIST_ENTRY(act_node, prop_svc_act_t, alist);
+		/*act_name: service service-name /path/daemon-name*/
+		if (svc_act && svc_act->act_name) {
+			if (NULL != (buf_ptr = strchr(svc_act->act_name, '/'))) {
+				strcpy(in_buf, buf_ptr);
+				PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Get the actions...act_name:%s daemon-name:%s",
+														svc_act->act_name, in_buf);
+				return	0;
+			}
+		}
+	}
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can not Get the actions...name:%s", act_item->svc_key);
+	return	-1;
+}
+
+pid_t prop_svc_get_pid(const prop_svc_t *act_item)
+{
+#define	ACTION_BUF_LEN	256
+	char	daemon_name[PROP_SVC_ACTION_MAX_SIZE] = {0};
+	char	action_buf[ACTION_BUF_LEN] = {0};
+	char	buffer[10] = {0};
+	FILE	*fp = NULL;
+	int		len = 0;
+	pid_t	pid = -1;
+
+	if (prop_svc_get_daemon_ext(act_item, daemon_name) < 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "failed to get the svc's action: %s", act_item->svc_key);
+		return pid;
+	}
+
+	len = snprintf(action_buf, ACTION_BUF_LEN-1, "pgrep -f \'%s\'", daemon_name);
+	if (len >= (ACTION_BUF_LEN-1)) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Length is error: %s", daemon_name);
+		return pid;
+	}
+
+	fp = popen(action_buf, "r");
+	if (NULL != fgets(buffer, sizeof(buffer)-1, fp)) {
+		pid = strtoul(buffer, 0, 10);
+		PROP_DEBUG_PRINT(PROP_DEBUG_INFO, "success to fgets: %s (%d)", action_buf, pid);
+	} else {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "failed to fgets: %s", action_buf);
+	}
+
+	pclose(fp);
+	return pid;
+}
+
+int prop_svc_get_actions(const prop_svc_t *act_item, char *in_buf)
+{
+	int					cur_act_len;
+	struct list 		*act_node;
+	prop_svc_act_t		*svc_act;
+	char				*buf_ptr;
+
+	if (!act_item || !in_buf)
+		return	-1;
+
+	buf_ptr = in_buf;
+	cur_act_len = 0;
+
+	LIST_FOR_EACH(act_node, &(act_item->act_list)) {
+		LIST_CHECK(act_node);
+		svc_act = LIST_ENTRY(act_node, prop_svc_act_t, alist);
+		if (svc_act) {
+			if (svc_act->act_name) {
+				if ((cur_act_len + strlen(svc_act->act_name)) >= PROP_SVC_ACTION_BUF_SIZE) {
+					PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " action max length error!...name:%s length:%d cur_len:%d ",
+							svc_act->act_name, strlen(svc_act->act_name), cur_act_len);
+				} else {
+					if (cur_act_len) {
+						buf_ptr[cur_act_len] = ';';
+						cur_act_len += 1;	/*for ';'*/
+					}
+
+					strncpy(&(buf_ptr[cur_act_len]), svc_act->act_name, strlen(svc_act->act_name));
+					cur_act_len += strlen(svc_act->act_name);
+					buf_ptr[cur_act_len] = '\0';
+
+					PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Find! name:%s actions:%s buffer:%s length:%d ",
+										act_item->svc_key, svc_act->act_name,
+										buf_ptr, cur_act_len);
+
+				}
+			} else {
+				PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " find the action without name???");
+			}
+		}
+	}
+
+	in_buf[cur_act_len] = '\0';
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Get the actions...name:%s action:%s cur_act_len:%d ",
+				act_item->svc_key, in_buf, cur_act_len);
+
+	return	0;
+}
+
+int prop_svc_get_actions_by_name(const char *svc_name, const char *svc_key, const char *svc_value, char *in_buf)
+{
+	prop_svc_t 		*svc_item;
+
+	if (!svc_key || !in_buf)
+		return	-1;
+
+	svc_item =  prop_svc_find_by_name(svc_name, svc_key, svc_value);
+	if (!svc_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "svc not exist...name:%s ", svc_key);
+		return	-1;
+	}
+
+	if (prop_svc_get_actions(svc_item, in_buf) < 0) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "can not find the actions...name:%s ", svc_key);
+		return	-1;
+	}
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "End. name:%s buf:%s ", svc_key, in_buf);
+
+	return	0;
+}
+
+prop_svc_t * prop_svc_find_by_name(const char *svc_name, const char *prop_key, const char *prop_value)
+{
+    struct list                 *node;
+    prop_svc_t                  *svc;
+
+    if (!prop_key) {
+        return  NULL;
+    }
+
+    LIST_FOR_EACH(node, &prop_svc_list) {
+		LIST_CHECK(node);
+        svc = LIST_ENTRY(node, prop_svc_t, slist);
+        if (!strcmp(svc->svc_name, svc_name)) {
+    		if (prop_value) {
+    	        if (!strcmp(svc->svc_key, prop_key) && !strcmp(svc->svc_value, prop_value)) {
+    				PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Find the svc! db_key:%s len:%d db_value:%s len:%d ",
+    													svc->svc_key, strlen(svc->svc_key),
+    													svc->svc_value, strlen(svc->svc_value));
+    	            return svc;
+    	        }
+    		} else {
+    	        if (!strcmp(svc->svc_key, prop_key)) {
+    				PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Find the svc! db_key:%s len:%d ",
+    													svc->svc_key, strlen(svc->svc_key));
+    	            return svc;
+    	        }
+    		}
+        }
+    }
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can not find! key:%s len:%d ",
+										prop_key, strlen(prop_key));
+
+    return NULL;
+}
+
+prop_svc_t * prop_svc_find_by_pid(const pid_t pid)
+{
+    struct list                 *node;
+    prop_svc_t                  *svc;
+
+    LIST_FOR_EACH(node, &prop_svc_list) {
+		LIST_CHECK(node);
+        svc = LIST_ENTRY(node, prop_svc_t, slist);
+        if (svc->pid == pid) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, " Find the svc %s", svc->svc_key);
+            return svc;
+        }
+    }
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can not find. pid:%d", pid);
+
+    return NULL;
+
+}
+
+int prop_svc_add(const prop_svc_t *svc)
+{
+    prop_svc_t  *db_item;
+
+    if (!svc)
+        return  -1;
+
+	if (strlen(svc->svc_key) >= PROPERTY_KEY_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Fail name. key:%s length:%d ", svc->svc_key, strlen(svc->svc_key));
+		return	-1;
+	}
+	if (strlen(svc->svc_value) >= PROPERTY_VALUE_MAX) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Fail name. value:%s length:%d ", svc->svc_value, strlen(svc->svc_value));
+		return	-1;
+	}
+	if (strlen(svc->svc_name) >= PROP_SVC_TYPE_MAX_SIZE) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, " Fail name. name:%s length:%d ", svc->svc_name, strlen(svc->svc_name));
+		return	-1;
+	}
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "...1...type:%s len:%d key:%s len:%d value:%s len:%d",
+					 svc->svc_name, strlen(svc->svc_name),
+					 svc->svc_key, strlen(svc->svc_key),
+					 svc->svc_value, strlen(svc->svc_value));
+
+    db_item = prop_svc_find_by_name(svc->svc_name, svc->svc_key, svc->svc_value);
+	if (db_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Item already existed...name:%s ", svc->svc_key);
+        return  -1;
+    }
+
+    db_item = malloc(sizeof(prop_svc_t));
+    if (!db_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Fail to malloc..name:%s ", svc->svc_key);
+		return	-1;
+	}
+
+    memset(db_item, 0x0, sizeof(prop_svc_t));
+
+	strcpy(db_item->svc_name, svc->svc_name);
+	strcpy(db_item->svc_key, svc->svc_key);
+	strcpy(db_item->svc_value, svc->svc_value);
+    db_item->svc_type = svc->svc_type;
+
+	db_item->flags = svc->flags;
+	INIT_LIST(&(db_item->slist));
+	INIT_LIST(&(db_item->act_list));
+	list_add_tail((struct list *)db_item, &prop_svc_list);
+
+    return  0;
+}
+
+int prop_svc_add_act(const char *svc_name, const char *svc_key, const char *svc_value, const char *actions)
+{
+    prop_svc_t  	*db_item;
+    prop_svc_act_t	*act_item;
+    int         	action_len;
+	int				index;
+	char			*args_temp;
+
+    if (!svc_key || !actions)
+        return  -1;
+
+	if (svc_value)
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "name:%s svc_key:%s svc_value:%s actions:%s ", svc_name, svc_key, svc_value, actions);
+	else
+		PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "name:%s svc_key:%s svc_value:NULL actions:%s ", svc_name, svc_key, actions);
+
+
+    /*check the length ???*/
+    action_len = strlen(actions);
+    if ((PROP_SVC_ACTION_MAX_SIZE <= action_len) ||
+		(!action_len)) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "action length:%d ", action_len);
+		return	-1;
+	}
+
+    db_item = prop_svc_find_by_name(svc_name, svc_key, svc_value);
+    if (!db_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "can not find the svc");
+		return	-1;
+	}
+
+    act_item = malloc(sizeof(prop_svc_act_t));
+    if (!act_item) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "can not malloc");
+		return	-1;
+	}
+
+	memset(act_item, 0x0, sizeof(prop_svc_act_t));
+
+	/*parse the args and args_num*/
+    strcpy(act_item->line_buf, actions);
+	args_temp = act_item->line_buf;
+	index = 0;
+	while (args_temp[index] == ' ')index++;
+	if ((args_temp[index] == '\0') ||
+		(index >= action_len)) {
+		PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong line! action_len:%d index:%d ", action_len, index);
+        free(act_item);
+		return	-1;
+	}
+
+	act_item->args_num = 0;
+	while (args_temp[index] != '\0') {
+		act_item->args[act_item->args_num] = &(args_temp[index]);
+		act_item->args_num++;
+		while ((args_temp[index] != ' ') &&
+				(args_temp[index] != '\0')) {
+			index++;
+		}
+		if (index >= action_len)
+			break;
+
+		args_temp[index] = '\0';
+		index++;
+
+		while (args_temp[index] == ' ') index++;
+		if (index >= action_len)
+			break;
+	}
+
+    strcpy(act_item->act_name, actions);
+	INIT_LIST(&(act_item->alist));
+	list_add_tail(&(act_item->alist), &(db_item->act_list));
+
+    return  0;
+}
+
+prop_svc_t * prop_svc_exe_by_name(const char *svc_name, const char *prop_key, const char *prop_value, void (*callabck)())
+{
+    struct list                 *node;
+    prop_svc_t                  *svc;
+    int                         find_times = 0;
+
+    if (!prop_key) {
+        PROP_DEBUG_PRINT(PROP_DEBUG_ERROR, "Wrong key!");
+
+        return  NULL;
+    }
+
+    LIST_FOR_EACH(node, &prop_svc_list) {
+		LIST_CHECK(node);
+        svc = LIST_ENTRY(node, prop_svc_t, slist);
+
+        if (svc_name && (strcmp(svc->svc_name, svc_name))) {
+            continue;
+        }
+
+		if (prop_value) {
+	        if (!strcmp(svc->svc_key, prop_key) && !strcmp(svc->svc_value, prop_value)) {
+				PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Find the svc!  db_key:%s len:%d db_value:%s len:%d ",
+													svc->svc_key, strlen(svc->svc_key),
+													svc->svc_value, strlen(svc->svc_value));
+                find_times++;
+                (*callabck)(svc);
+	        }
+		} else {
+	        if (!strcmp(svc->svc_key, prop_key)) {
+				PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Find the svc! name:%s db_key:%s len:%d ",
+                                                    svc->svc_value, svc->svc_key, strlen(svc->svc_key));
+                find_times++;
+                (*callabck)(svc);
+	        }
+		}
+    }
+
+	PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Exe the svc! key:%s len:%d value:%s len:%d find:%d ",
+										prop_key, strlen(prop_key),
+										prop_value, strlen(prop_value), find_times);
+
+    return NULL;
+}
+
+
+
+void prop_svc_dump(void)
+{
+	struct list 				*node;
+	struct list 				*act_node;
+	prop_svc_t					*svc;
+	prop_svc_act_t				*svc_act;
+	int							index;
+	int							is_service;
+
+	syslog(LOG_DEBUG, "\n\n\rDumping services...");
+
+	LIST_FOR_EACH(node, &prop_svc_list) {
+		LIST_CHECK(node);
+
+		svc = LIST_ENTRY(node, prop_svc_t, slist);
+		if (svc) {
+			if (svc->svc_type == PROP_SVC_TYPE_SERVICE)
+				is_service = 1;
+			else
+				is_service = 0;
+
+			if (!is_service)
+				syslog(LOG_DEBUG, "\n\n\r%s    on property:%s=%s", svc->svc_name, svc->svc_key, svc->svc_value);
+			else
+				syslog(LOG_DEBUG, "\n\n\r%s    service:%s %s", svc->svc_name, svc->svc_key, svc->svc_value);
+			LIST_FOR_EACH(act_node, &(svc->act_list)) {
+				LIST_CHECK(act_node);
+				svc_act = LIST_ENTRY(act_node, prop_svc_act_t, alist);
+				if (svc_act) {
+                    syslog(LOG_DEBUG, "\n\r     %s", svc_act->act_name);
+
+					for (index=0; index<svc_act->args_num; index++) {
+						syslog(LOG_DEBUG, "\n\r         (args[%d]:%s len:%d)", index, svc_act->args[index], strlen(svc_act->args[index]));
+					}
+				}
+			}
+		}
+	}
+	printf("\n");
+}
+
+void prop_svc_init(void)
+{
+    INIT_LIST(&prop_svc_list);
+}
diff --git a/src/apps/atom-base/progs/property/prop/prop_test.c b/src/apps/atom-base/progs/property/prop/prop_test.c
new file mode 100644
index 0000000..343e5c5
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/prop_test.c
@@ -0,0 +1,723 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>

+#include <unistd.h>

+#include <sys/time.h>

+#include <dirent.h>		//for read directories

+#include <cutils/properties.h>

+#include "prop_debug.h"

+#include "prop_core.h"

+#include "prop_svc.h"

+

+/*for APSIM, must put in /mnt/sncfg/apsim/*/

+#if defined(PARTITION_FOR_APSIM)

+#define PROP_TEST_PERSISTENT_PROPERTY_DIR   "/mnt/sncfg/apsim/property"

+#else

+#define PROP_TEST_PERSISTENT_PROPERTY_DIR   "/data/property"

+#endif

+

+#define PROP_TEST_FILE_PREFIX				"persist.test."

+

+int __prop_test_get_time(void)

+{

+ 	struct  timeval current;

+	int	cur_usec;

+

+	gettimeofday(&current, NULL);

+

+	cur_usec = (int)(current.tv_sec * 1000000 + current.tv_usec);

+	return	cur_usec;

+}

+

+

+void __prop_test_trim_line(char *line)

+{

+	int		len;

+	int		index;

+

+	if (!line)

+		return;

+

+	len = strlen(line);

+	if (len <= 0)

+		return;

+

+	for (index=len-1; index >= 0; index-- ) {

+		if ((line[index] == ' ') ||

+			(line[index] == '\n')) {

+			line[index] = '\0';

+		} else {

+			break;

+		}

+	}

+	return;

+}

+

+int __prop_test_func_def(const char *key, const char*def_value)

+{

+    int     ret_val = 0;

+    char    value_buffer[PROPERTY_VALUE_MAX];

+

+    if (!key || !def_value)

+        return  -1;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin!");

+

+    ret_val = property_get(key, value_buffer, def_value);

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL! Key:%s ", key);

+        ret_val = -1;

+    } else {

+        if (strcmp(value_buffer, def_value)) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL! key:%s value:%s def_value:%s", key, value_buffer, def_value);

+            ret_val = -1;

+

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "End!\n");

+    return  ret_val;

+}

+

+int __prop_test_func_basic(const char *key, const char*value)

+{

+    int     ret_val = 0;

+    int     total_ret = 0;

+    char    value_buffer[PROPERTY_VALUE_MAX];

+

+    if (!key || !value)

+        return  -1;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin! key:%s value:%s ", key, value);

+

+    ret_val = property_set(key, value);

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...1 ");

+        total_ret = -1;

+    }

+

+	if (total_ret >= 0) {

+	    ret_val = property_get(key, value_buffer, "123");

+	    if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...2 ");

+	        total_ret = -1;

+	    }  else  {

+	        if (strcmp(value_buffer, value)) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...get_value:%s len:%d set_value:%s len:%d ",

+						value_buffer, strlen(value_buffer), value, strlen(value));

+	            total_ret = -1;

+	        }

+	    }

+	}

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "End");

+

+    return  total_ret;

+}

+

+int _prop_test_func_normal(void)

+{

+    int     ret_val;

+    int     total_ret = 0;

+    char    *ok_value[] = {

+                            "func_test.value_1_01234567",

+                            "func_test.value_1_0123456789_123456789_123456789_123456789_123456789_123456789_1234",

+                        };

+    char    *default_value[] = {

+                            "func_test.def_value_1_01",

+                            "func_test.def_value_1_012",

+                        };

+    char    key_buffer[PROPERTY_KEY_MAX];

+    int     case_num;

+    int     index = 1;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+

+    case_num = sizeof(default_value)/sizeof(default_value[0]);

+    for (index=0; index<case_num; index++) {

+ 	    sprintf(key_buffer, "%s.%d.%d", "normal.key", __prop_test_get_time(), index);

+        ret_val = __prop_test_func_def(key_buffer, default_value[index]);

+        if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...1...key:%s ", key_buffer);

+			total_ret = -1;

+		}

+

+        ret_val = __prop_test_func_basic(key_buffer, ok_value[index]);

+        if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...2...key:%s ", key_buffer);

+			total_ret = -1;

+		}

+    }

+

+    if (total_ret < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+	return	total_ret;

+}

+

+int _prop_test_func_ro(void)

+{

+    int     ret_val;

+    int     total_ret = 0;

+    char    key_buffer[PROPERTY_KEY_MAX];

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+

+    sprintf(key_buffer, "%s.%d", "ro.key", __prop_test_get_time());

+    ret_val = __prop_test_func_def(key_buffer, "12345678");

+    if (ret_val < 0)

+	{

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...1...key:%s ", key_buffer);

+		total_ret = -1;

+	}

+

+    ret_val = __prop_test_func_basic(key_buffer, "87654321");

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...2...key:%s ", key_buffer);

+		total_ret = -1;

+	}

+

+    ret_val = property_set(key_buffer, "0123456789");

+    if (ret_val >= 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Fail! ...3...key:%s ", key_buffer);

+		total_ret = -1;

+	}

+

+    if (total_ret < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+	return	total_ret;

+}

+

+int _prop_test_func_persist(void)

+{

+    int     ret_val;

+    int     total_ret = 0;

+    char    key_buffer[PROPERTY_KEY_MAX];

+    char    value_buffer[PROPERTY_VALUE_MAX];

+    char    file_buffer[128];

+    FILE    *read_file;

+	char    file_line[256];

+    int     file_line_num;

+	int		usec_num;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+

+	usec_num = __prop_test_get_time();

+

+    sprintf(key_buffer, "%s%d", PROP_TEST_FILE_PREFIX, usec_num);

+    sprintf(value_buffer, "%s%d", "persist.value.", usec_num);

+    ret_val = __prop_test_func_def(key_buffer, "12345678");

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL! ...1...");

+		total_ret = -1;

+	}

+ 	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Key:%s  value:%s ", key_buffer, value_buffer);

+

+    ret_val = __prop_test_func_basic(key_buffer, value_buffer);

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL! ...2...");

+		total_ret = -1;

+	}

+

+    sprintf(file_buffer, "%s/%s", PROP_TEST_PERSISTENT_PROPERTY_DIR, key_buffer);

+	read_file = fopen(file_buffer , "r" );

+    if (!read_file) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3... ");

+        total_ret = -1;

+    } else {

+        file_line_num = 0;

+		while (fgets(file_line, sizeof(file_line), read_file ) != NULL) {

+			__prop_test_trim_line(file_line);

+

+            file_line_num++;

+            if (strcmp(value_buffer, file_line)) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...4...file_line:%s set_value:%s ", file_line, value_buffer);

+                total_ret = -1;

+            }

+		}

+

+        if (file_line_num != 1) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...5...num:%d ", file_line_num);

+            total_ret = -1;

+        }

+		fclose (read_file );

+    }

+

+    if (total_ret < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+    return  total_ret;

+}

+

+int _prop_test_func_performance(void)

+{

+    int     ret_val = 0;

+    int     total_ret = 0;

+    char    key_buffer[PROPERTY_KEY_MAX];

+    char    value_buffer[PROPERTY_VALUE_MAX];

+ 	struct  timeval start, end; //To record start time and end time

+	int		elapsed_time;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+

+	gettimeofday(&start, NULL);

+

+    sprintf(key_buffer, "%s.%d", "performance.test.1", __prop_test_get_time());

+    ret_val = property_set(key_buffer, "12345");

+	if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...2...key:%s ", key_buffer);

+		total_ret = -1;

+	}

+

+	gettimeofday(&end, NULL);

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_set time! start=%ld, %ld usecond", start.tv_sec, start.tv_usec);

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_set time!   end=%ld, %ld usecond", end.tv_sec, end.tv_usec );

+	elapsed_time = (end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec );

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_set time!   Elapsed_time:%d ", elapsed_time);

+	if (elapsed_time >= 2000)

+		total_ret = -1;

+

+	gettimeofday(&start, NULL);

+

+    ret_val = property_get(key_buffer, value_buffer, "123");

+    if (ret_val < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key:%s ", key_buffer);

+        total_ret = -1;

+    }

+

+	gettimeofday(&end, NULL);

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_get time! start=%ld, %ld usecond", start.tv_sec, start.tv_usec);

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_get time!   end=%ld, %ld usecond", end.tv_sec, end.tv_usec );

+	elapsed_time = (end.tv_sec - start.tv_sec)*1000000 + (end.tv_usec - start.tv_usec );

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "property_get time!   Elapsed_time:%d ", elapsed_time);

+	if (elapsed_time >= 2000)

+		total_ret = -1;

+

+    if (total_ret < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+    return  total_ret;

+}

+

+int _prop_test_func_stress(void)

+{

+    int     ret_val = 0;

+    int     total_ret = 0;

+    char    key_buffer[PROPERTY_KEY_MAX];

+    char    value_buffer[PROPERTY_VALUE_MAX];

+    char    read_buffer[PROPERTY_VALUE_MAX];

+	int		index;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+

+	for (index = 0; index<1000; index++) {

+		sprintf(key_buffer, "%s.%d", "stress.test", __prop_test_get_time()+index);

+		sprintf(value_buffer, "%s.%d", "stress.test.value", __prop_test_get_time()+index);

+

+	    ret_val = property_set(key_buffer, value_buffer);

+		if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...1...key:%s value:%s ", key_buffer, value_buffer);

+			total_ret = -1;

+		}

+

+		memset(read_buffer, 0x0, PROPERTY_VALUE_MAX);

+		ret_val = property_get(key_buffer, read_buffer, "123");

+		if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...2...key:%s value:%s ", key_buffer, value_buffer);

+			total_ret = -1;

+		}

+

+		if (strcmp(read_buffer, value_buffer)) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key:%s set_value:%s get_value:%s ",

+							key_buffer, read_buffer, value_buffer);

+			total_ret = -1;

+		}

+	}

+

+    if (total_ret < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+    return  total_ret;

+

+}

+

+int _prop_test_unit_set(void)

+{

+    int     ret_val;

+    int     total_val = 0;

+    char    *failed_key[4] = {

+                                NULL,

+                                "property_set.test.key_1_01234567",

+                                "property_set.test.key_1_012345678",

+                                "property_set.test.key_1_0123456789012345678",

+                            };

+

+    char    *ok_key[2] = {

+                            "property_set.test.key_2_01",

+                            "property_set.test.key_2_0123",

+                        };

+

+    char    *ok_value[4] = {

+                            "",

+                            "v",

+                            "property_set.test.value_1_01234567",

+                            "property_set.test.value_1_0123456789_123456789_123456789_123456789_123456789_123456789_1234",

+                        };

+

+    char    *failed_value[2] = {

+                            "property_set.test.value_2_0123456789_123456789_123456789_123456789_123456789_123456789_12345",

+                            "property_set.test.value_2_0123456789_123456789_123456789_123456789_123456789_123456789_123456",

+                        };

+    char    *test_ptr;

+    char    key_buffer[128];

+    int     index;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin Fail-Key");

+

+    /*test the key*/

+    for (index=0; index<4; index++) {

+    	test_ptr = failed_key[index];

+        ret_val = property_set(test_ptr, "123");

+        if (ret_val >= 0) {

+            if (test_ptr) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...1...key:%s length:%d", test_ptr, strlen(test_ptr));

+            } else {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...1...key=NULL");

+            }

+            total_val = -1;

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin OK-Key");

+

+    for (index=0; index<2; index++) {

+    	test_ptr = ok_key[index];

+        ret_val = property_set(test_ptr, "123");

+        if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...2...key:%s length:%d", test_ptr, strlen(test_ptr));

+            total_val = -1;

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin Fail-Value");

+

+    /*test the value*/

+    for (index=0; index<2; index++) {

+    	test_ptr = failed_value[index];

+

+		sprintf(key_buffer, "%s.%d", "key.1.property_set", __prop_test_get_time());

+        ret_val = property_set(key_buffer, test_ptr);

+        if (ret_val >= 0) {

+            if (test_ptr) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key:%s length:%d", test_ptr, strlen(test_ptr));

+            } else {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key=NULL");

+            }

+            total_val = -1;

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin OK-Value");

+

+    for (index=0; index<4; index++) {

+    	test_ptr = ok_value[index];

+

+		sprintf(key_buffer, "%s.%d", "key.2.property_set", __prop_test_get_time());

+        ret_val = property_set(key_buffer, test_ptr);

+        if (ret_val < 0) {

+            if (test_ptr)

+            {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...4...key:%s length:%d", test_ptr, strlen(test_ptr));

+            } else {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...4...key=NULL");

+            }

+

+            total_val = -1;

+        }

+    }

+

+    if (total_val < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+    return  total_val;

+

+}

+

+int _prop_test_unit_get(void)

+{

+    int     ret_val;

+    int     total_val = 0;

+    char    *failed_key[] = {

+                                NULL,

+                                "property_get.test.key_1_01234567",

+                                "property_get.test.key_1_012345678",

+                                "property_get.test.key_1_0123456789012345678",

+                            };

+

+    char    *ok_key[] = {

+                            "property_get.test.key_2_0123456",

+                            "property_get.test.key_2_0123",

+                        };

+

+    char    *failed_value[] = {

+                            NULL,

+                        };

+    char    *test_ptr;

+    char    value_buffer[PROPERTY_VALUE_MAX];

+    char    key_buffer[PROPERTY_KEY_MAX];

+    int     index;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin!");

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin Fail-Key");

+

+    /*test the key*/

+    for (index=0; index<4; index++) {

+		test_ptr = failed_key[index];

+        ret_val = property_get(test_ptr, value_buffer, "123");

+        if (ret_val >= 0) {

+            if (test_ptr) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...1...key:%s length:%d", test_ptr, strlen(test_ptr));

+            } else {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...1...key=NULL");

+            }

+

+            total_val = -1;

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin OK-Key");

+

+    for (index=0; index<2; index++) {

+		test_ptr = ok_key[index];

+        ret_val = property_get(test_ptr, value_buffer, "123");

+        if (ret_val < 0) {

+			PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...2...key:%s length:%d", test_ptr, strlen(test_ptr));

+            total_val = -1;

+        }

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "Begin Fail-Value");

+

+    /*test the value*/

+    for (index=0; index<1; index++) {

+		test_ptr = failed_value[index];

+		sprintf(key_buffer, "%s.%d", "key.property_get", __prop_test_get_time());

+        ret_val = property_get(key_buffer, test_ptr, "123");

+        if (ret_val >= 0) {

+            if (test_ptr) {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key:%s length:%d", test_ptr, strlen(test_ptr));

+            } else {

+				PROP_DEBUG_PRINT(PROP_DEBUG_TEST, "FAIL!...3...key=NULL");

+            }

+            total_val = -1;

+        }

+    }

+

+    if (total_val < 0)

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test Fail!");

+	else

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Test OK!");

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End!\n");

+

+    return  total_val;

+}

+

+void _prop_test_ut(const char *value)

+{

+    int     ret_val;

+    int     total_ret = 0;

+	int		test_all = 0;

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Begin...");

+

+	if (!strncmp("all", value, strlen("all"))) {

+		prop_debug_set(PROP_DEBUG_OFF);

+		test_all = 1;

+	}

+

+	if (!strncmp("all_trace", value, strlen("all_trace"))) {

+		prop_debug_set(PROP_DEBUG_TEST);

+		test_all = 1;

+	}

+

+    if (!strncmp("set", value, strlen("set")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_unit_set();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("get", value, strlen("get")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_unit_get();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("perform", value, strlen("perform")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_func_performance();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("normal", value, strlen("normal")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_func_normal();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("ro", value, strlen("ro")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_func_ro();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("persist", value, strlen("persist")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_func_persist();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (!strncmp("stress", value, strlen("stress")) ||

+		(test_all != 0)) {

+	    ret_val = _prop_test_func_stress();

+	    if (ret_val < 0)

+	        total_ret = -1;

+	}

+

+    if (total_ret < 0) {

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "Fail! ");

+    } else {

+		PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "OK!");

+    }

+

+	PROP_DEBUG_PRINT(PROP_DEBUG_OFF, "End. \n");

+}

+

+int prop_test_func(const char *name, const char *value)

+{

+    char        command_buffer[256];

+	char		*command_1 = "mkdir -p /usr/sc/property/test/";

+	char		*command_2 = "mkdir -p /usr/sc/property/test/";

+	pid_t 		pid;

+

+	if (0 == strncmp("UT", name, strlen("UT")))

+	{

+		_prop_test_ut(value);

+	} else if (0 == strncmp("DUMP", name, strlen("DUMP"))) {

+		prop_core_dump();

+	} else if (0 == strncmp("system_func", name, strlen("system_func"))) {

+		sprintf(command_buffer, "%s%d;%s%d",

+				command_1, __prop_test_get_time(),

+				command_2, __prop_test_get_time()+1);

+

+		system(command_buffer);

+	} else if (0 == strncmp("exec_func", name, strlen("exec_func"))) {

+		sprintf(command_buffer, "%s%d;%s%d",

+				command_1, __prop_test_get_time(),

+				command_2, __prop_test_get_time()+1);

+

+		pid = fork();

+		if (pid < 0) {

+			return	-1;

+		} else if (pid == 0) {

+			execl("/bin/sh", "sh", "-c", command_buffer, (char *)0);

+			exit(127);

+		} 

+	} else if (0 == strncmp("svc", name, strlen("svc"))) {

+	#if 0

+		char	action_buf[1024];

+

+		if (prop_svc_get_actions_by_name(value, NULL, action_buf) >= 0) {

+			printf("\n Get the ACTIONS. name:%s action:%s  ", name, action_buf);

+		} else {

+			printf("\n Can not get the ACTIONS. name:%s ", value);

+			prop_svc_dump();

+		}

+    #endif

+	} else if (0 == strncmp("NULL", name, strlen("NULL"))) {

+		int		ret_val;

+		char	value[32];

+

+		ret_val = property_set("test.null.key.1", "");

+		printf("\n Test.null.key.1.   ret:%d ", ret_val);

+

+		ret_val = property_set("test.null.key.2", NULL);

+		printf("\n Test.null.key.2.   ret:%d ", ret_val);

+

+		value[0] = '\0';

+		ret_val = property_get("test.null.key.1", value, "abc");

+		printf("\n Test.null.key.1.   ret:%d value:%s!", ret_val, value);

+

+		value[0] = '\0';

+		ret_val = property_get("test.null.key.2", value, "abcd");

+		printf("\n Test.null.key.2.   ret:%d value:%s!", ret_val, value);

+	}

+    return  0;

+}

diff --git a/src/apps/atom-base/progs/property/prop/property.c b/src/apps/atom-base/progs/property/prop/property.c
new file mode 100644
index 0000000..0c579df
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/property.c
@@ -0,0 +1,427 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <dirent.h>
+#include <signal.h>
+#include <pthread.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <netinet/ether.h>
+#include <arpa/inet.h>
+#include <sched.h>
+#include <syslog.h>
+#include "list.h"
+#include "request.h"
+#include "utility.h"
+#include "property.h"
+#include "prop_debug.h"
+#include "prop_sncfg.h"
+
+/*******************************************************************************/
+/* SNCFGD local definitions                                                    */
+/*******************************************************************************/
+#ifndef PID_FILE
+#define PID_FILE "/var/run/sncfgd.pid"
+#endif
+
+#define CONFIG_HASH_SIZE		64
+
+/*******************************************************************************/
+/* property deamon local variables                                                      */
+/*******************************************************************************/
+static struct sockaddr_un RequestSockAddr = { AF_UNIX, SNCFG_REQUEST_UNIX_SOCKET };
+static struct list ReqList;
+static pthread_mutex_t MutexReqList, MutexConfig;
+static pthread_cond_t ConditionReqList;
+
+/*******************************************************************************/
+/* property deamon local functions                                                      */
+/*******************************************************************************/
+static void reapchild(int sig)
+{
+	int status;
+
+	while (waitpid(-1, &status, WNOHANG) > 0) {
+		/* do nothing, just prevent from zombie children */
+	}
+}
+
+static void term_handler(int sig
+#ifdef SA_SIGINFO
+	     , siginfo_t *siginfo, void *context
+#endif
+	    )
+{
+	printf("[SNCFGD] Received a signal %d, Terminating !!", sig);
+	exit(-1);
+}
+
+static void trap_signals(void)
+{
+	unsigned int i, j;
+	struct sigaction act, oldact;
+	const int term_signals[] = {
+#ifdef SIGHUP
+	SIGHUP,
+#endif
+#ifdef SIGINT
+	SIGINT,
+#endif
+#ifdef SIGUSR1
+	SIGUSR1,
+#endif
+#ifdef SIGUSR2
+	SIGUSR2,
+#endif
+#ifdef SIGPIPE
+	SIGPIPE,
+#endif
+#ifdef SIGALRM
+	SIGALRM,
+#endif
+#ifdef SIGTERM
+	SIGTERM,
+#endif
+#ifdef SIGSTKFLT
+	SIGSTKFLT,
+#endif
+#ifdef SIGVTALRM
+	SIGVTALRM,
+#endif
+#ifdef SIGPROF
+	SIGPROF,
+#endif
+#ifdef SIGPOLL
+	SIGPOLL,
+#endif
+#ifdef SIGPWR
+	SIGPWR,
+#endif
+	};
+	const int ignore_signals[] = {
+#ifdef SIGPIPE
+	SIGPIPE,
+#endif
+	};
+	const struct {
+		const int *sigs;
+		unsigned int nsigs;
+		void (*handler)(int signo
+#ifdef SA_SIGINFO
+		, siginfo_t *info, void *context
+#endif
+		);
+	} sigmap[] = {
+		{term_signals, sizeof(term_signals)/sizeof(term_signals[0]), term_handler},
+		{ignore_signals, sizeof(ignore_signals)/sizeof(ignore_signals[0]), NULL},
+	};
+
+	for (i = 0; i < sizeof(sigmap)/sizeof(sigmap[0]); i++) {
+		for (j = 0; j < sigmap[i].nsigs; j++) {
+			sigfillset(&act.sa_mask);
+			if (sigmap[i].handler == NULL) {
+				act.sa_handler = SIG_IGN;
+				act.sa_flags = 0;
+			}
+			else {
+#ifdef SA_SIGINFO
+				act.sa_sigaction = sigmap[i].handler;
+				act.sa_flags = SA_SIGINFO;
+#else
+				act.sa_handler = sigmap[i].handler;
+				act.sa_flags = 0;
+#endif
+			}
+			if (sigaction(sigmap[i].sigs[j], &act, &oldact) < 0) {
+				DEBUG_PRINT("Can't set signal handler for signal %d: %s",
+						sigmap[i].sigs[j], strerror(errno));
+			}
+		}
+	}
+}
+
+static int pidfile_acquire(void)
+{
+	int pidfd;
+
+	pidfd = open(PID_FILE, O_CREAT | O_WRONLY, 0644);
+	if (pidfd < 0) {
+		DEBUG_PRINT("Can't open pidfile %s : %s !!", PID_FILE, strerror(errno));
+	}
+	else {
+		lockf(pidfd, F_LOCK, 0);
+	}
+
+	return pidfd;
+}
+
+static void pidfile_write_release(int pidfd)
+{
+	FILE *out;
+
+	if (pidfd < 0) {
+		return;
+	}
+
+	if ((out = fdopen(pidfd, "w")) != NULL) {
+		fprintf(out, "%d\n", getpid());
+	}
+
+	lockf(pidfd, F_UNLCK, 0);
+	if (out) {
+		fclose(out);
+	}
+	else {
+		safe_close(pidfd);
+	}
+}
+
+static void req_enqueue(struct req *req)
+{
+	pthread_mutex_lock(&MutexReqList);
+	LIST_CHECK(&ReqList);
+	list_add_tail((struct list *)req, &ReqList);
+	pthread_cond_signal(&ConditionReqList);
+	pthread_mutex_unlock(&MutexReqList);
+}
+
+static struct req *req_dequeue(void)
+{
+	struct list *p, *n;
+	pthread_mutex_lock(&MutexReqList);
+	LIST_CHECK(&ReqList);
+	if (list_empty(&ReqList)) {
+		pthread_cond_wait(&ConditionReqList, &MutexReqList);
+	}
+	LIST_FOR_EACH_SAFE(p, n, &ReqList) {
+		LIST_CHECK(p);
+		list_del(p);
+		break;
+	}
+	pthread_mutex_unlock(&MutexReqList);
+	return (struct req *)p;
+}
+
+static void request_handle(int reqfd)
+{
+	int size, sock;
+	struct req *req;
+ 	struct sncfg_request *request;
+
+	sock = accept_request(reqfd);
+	if (sock < 0) {
+		syslog(LOG_ERR, "Can't accept request socket on %d : %s !!", reqfd, strerror(errno));
+		return;
+	}
+
+	req = malloc(sizeof(struct req));
+	if (!req) {
+		syslog(LOG_ERR, "Can't malloc for pending request : %s !!", strerror(errno));
+		safe_close(sock);
+		return;
+	}
+	req->sock = sock;
+	request = &req->request;
+
+	size = safe_read(sock, request, sizeof(struct sncfg_request));
+	if (size < 0) {
+		syslog(LOG_ERR, "Can't read request on %d : %s !!", sock, strerror(errno));
+		free(req);
+		safe_close(sock);
+		return;
+    }
+
+	if (unpack_request(request, size) < 0) {
+		syslog(LOG_ERR, "Can't unpack request, size = %d !!", size);
+		free(req);
+		safe_close(sock);
+		return;
+    }
+
+	switch (request->type) {
+	case SNCFG_REQUEST_TYPE_PROP_SET:
+	case SNCFG_REQUEST_TYPE_PROP_GET:
+	case SNCFG_REQUEST_TYPE_PROP_DEBUG:
+	case SNCFG_REQUEST_TYPE_PROP_RELOAD:
+    case SNCFG_REQUEST_TYPE_PROP_TEST:
+	    if (prop_sncfg_enqueue(req) < 0) {
+			PROP_DEBUG_PRINT(PROP_DEBUG_TRACE, "Can't prop_sncfg_enqueue!!");
+		    free(req);
+		    safe_close(sock);
+        }
+		break;
+
+	default:
+		syslog(LOG_WARNING, "Unknown request type : %d !!", request->type);
+        free(req);
+		safe_close(sock);
+		break;
+	} /* switch (request.type) */
+}
+
+static int request_init(void)
+{
+	int reqfd;
+	const int reuse = 1;
+
+	/* force to re-create */
+	unlink(RequestSockAddr.sun_path);
+
+	reqfd = socket(AF_UNIX, SOCK_STREAM, 0);
+	if (reqfd == -1) {
+		LOG_PRINT(LOG_ERR, "Can't create socket on %s : %s !!", RequestSockAddr.sun_path, strerror(errno));
+		return -1;
+	}
+
+	if (fcntl(reqfd, F_SETFD, FD_CLOEXEC) == -1) {
+		LOG_PRINT(LOG_ERR, "Can't fcntl set FD_CLOEXEC on %s : %s !!", RequestSockAddr.sun_path, strerror(errno));
+		safe_close(reqfd);
+		return -1;
+	}
+
+	if (setsockopt(reqfd, SOL_SOCKET, SO_REUSEADDR, (const void *)&reuse, sizeof(reuse)) < 0) {
+		LOG_PRINT(LOG_ERR, "Can't setsockopt SO_REUSEADDR on %s : %s !!", RequestSockAddr.sun_path, strerror(errno));
+		safe_close(reqfd);
+		return -1;
+	}
+
+	if (bind(reqfd, (struct sockaddr *)&RequestSockAddr,
+	    offsetof(struct sockaddr_un, sun_path) + strlen(RequestSockAddr.sun_path)) < 0) {
+		LOG_PRINT(LOG_ERR, "Can't bind on %s : %s !!", RequestSockAddr.sun_path, strerror(errno));
+		safe_close(reqfd);
+		return -1;
+	}
+
+	if (listen(reqfd, 5) < 0) {
+		LOG_PRINT(LOG_ERR, "Can't listen on %s : %s !!", RequestSockAddr.sun_path, strerror(errno));
+		safe_close(reqfd);
+		return -1;
+	}
+
+	/* initialize request list */
+	INIT_LIST(&ReqList);
+
+	return reqfd;
+}
+
+/*******************************************************************************/
+/* Prperty deamon                                                            */
+/*******************************************************************************/
+int main(int argc, char **argv)
+{
+	int reqfd, pidfd;
+	pid_t pid;
+#ifdef RT_SCHED
+	struct sched_param sched;
+
+	/* realtime priority */
+	sched.sched_priority = 89;
+	if (sched_setscheduler(0, SCHED_FIFO, &sched) == -1) {
+		LOG_PRINT(LOG_ERR, "Can't set realtime scheduler : %s !!", strerror(errno));
+	}
+#endif
+
+	openlog("[prop]", LOG_CONS | LOG_ODELAY | LOG_PERROR, LOG_DAEMON);
+
+    LOG_PRINT(LOG_ERR, "Bootup...prop daemon BEGIN.");
+
+	/* initialize request interface */
+	if ((reqfd = request_init()) < 0) {
+		LOG_PRINT(LOG_ERR, "Request interface initialization error !!");
+		exit(-1);
+	}
+
+#if 0
+	/* it's time to become a daemon */
+	trap_signals();
+	signal(SIGCHLD, reapchild);
+	pidfd = pidfile_acquire();
+	pid = fork();
+	if (pid < 0) {
+		LOG_PRINT(LOG_ERR, "Can't fork to become a daemon : %s  !!", strerror(errno));
+		exit(-1);
+	}
+	if (pid != 0) {
+		exit(0);
+	}
+	pidfile_write_release(pidfd);
+
+    LOG_PRINT(LOG_ERR, "Bootup...prop begin...service done");
+#endif
+
+    if (prop_sncfg_init() < 0) {
+		safe_close(reqfd);
+		exit(-1);
+    }
+    LOG_PRINT(LOG_ERR, "Bootup...prop begin...property done");
+
+	for (;;) {
+		int ndes, maxfd;
+		fd_set readfds;
+		fd_set writefds;
+
+		maxfd = 0;
+		FD_ZERO(&readfds);
+		FD_ZERO(&writefds);
+		FD_SET(reqfd, &readfds);
+		if (maxfd < reqfd) {
+			maxfd = reqfd;
+		}
+		ndes = select((maxfd + 1), &readfds, &writefds, NULL, NULL);
+		if (ndes == -1) {
+			/* select failed, may be interrupted, try again */
+			continue;
+		} else if (ndes == 0) {
+			/* select timeout, should not be */
+			continue;
+		} else {
+			if (FD_ISSET(reqfd, &readfds))	{
+				request_handle(reqfd);
+			}
+		}
+	}
+
+	return 0;
+}
diff --git a/src/apps/atom-base/progs/property/prop/request.c b/src/apps/atom-base/progs/property/prop/request.c
new file mode 100644
index 0000000..fea91ab
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/request.c
@@ -0,0 +1,265 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <syslog.h>
+#include "property.h"
+#include "utility.h"
+#include "request.h"
+
+/*******************************************************************************/
+/* REQUEST local definitions                                                   */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local prototypes                                                    */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local variables                                                     */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* REQUEST local functions                                                     */
+/*******************************************************************************/
+static int pack_request_string(char **p, char **next, const char *roof)
+{
+	if (*p == NULL) {
+		return 0;
+	} else {
+		size_t len = strlen(*p) + 1;
+
+		if ((roof - *next) < (ptrdiff_t)len) {
+			return -1;
+		} else {
+			strcpy(*next, *p);
+			*next += len;
+			*p = (char *)0x12345678;
+			return 0;
+		}
+	}	
+}
+
+static int unpack_request_string(char **p, char **next, const char *roof)
+{
+	if (*p == NULL) {
+		return 0;
+	} else if (*p == (char *)0x12345678) {
+		char *end = memchr(*next, '\0', roof - *next);
+		
+		if (end == NULL) {
+			return -1;
+		} else {
+			*p = *next;
+			*next = end + 1;
+			return 0;
+		}
+	}
+	return -1;
+}
+
+/*******************************************************************************/
+/* REQUEST functions                                                           */
+/*******************************************************************************/
+int pack_request(struct sncfg_request *request)
+{
+	int size;
+	char *next, *roof;
+	
+    next = request->string + request->reservedLen;
+    roof = next + sizeof(request->string);
+    
+	if (request->magic != SNCFG_REQUEST_MAGIC) {
+		return -1;
+	}
+
+	if (request->type >= SNCFG_REQUEST_TYPE_RESERVED) {
+		return -1;
+	}
+					
+	if (pack_request_string(&request->key, &next, roof) < 0 ||
+		pack_request_string(&request->value, &next, roof) < 0) {
+		return -1;
+	}
+
+	size = next - (char *)request;
+	return size;
+}
+
+int unpack_request(struct sncfg_request *request, int size)
+{
+	char *next, *roof;
+	
+	next = request->string + request->reservedLen;
+	roof = (char *)request + size;
+
+	if (roof < next) {
+		return -1;
+	}
+	
+	if (request->magic != SNCFG_REQUEST_MAGIC) {
+		return -1;
+	}
+
+	if (request->type >= SNCFG_REQUEST_TYPE_RESERVED) {
+		return -1;
+	}
+
+	if (unpack_request_string(&request->key, &next, roof) < 0 ||
+		unpack_request_string(&request->value, &next, roof) < 0) {
+		return -1;
+	}
+
+	return 0;
+}
+
+int connect_request(void)
+{
+	int sock;
+	struct sockaddr_un addr = { AF_UNIX, SNCFG_REQUEST_UNIX_SOCKET };
+
+	if (access(addr.sun_path, R_OK | W_OK) < 0) {
+		return -1;
+	}
+
+	sock = socket(AF_UNIX, SOCK_STREAM, 0);
+	if (sock == -1) {
+		return -1;
+	}
+					
+	struct timeval tm;
+	tm.tv_sec = 8;  /* 8 Secs Timeout */
+	tm.tv_usec = 0;
+		
+	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for connect ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for connect ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for connect ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for connect ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+					
+	if (connect(sock, (struct sockaddr *)&addr, 
+				offsetof(struct sockaddr_un, sun_path) + strlen(addr.sun_path)) < 0) {
+		close(sock);
+		return -1;
+	}
+			
+	return sock;
+}
+
+int accept_request(int sockfd)
+{
+	int sock;
+	socklen_t addrlen;
+	struct sockaddr_un addr;
+
+	addrlen = sizeof(addr);
+	sock = accept(sockfd, (struct sockaddr *)&addr, &addrlen);
+	if (sock == -1) {
+		return -1;
+	}
+
+	if (fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) {
+		close(sock);
+		return -1;
+    }	
+
+	struct timeval tm;
+	tm.tv_sec = 8;  /* 8 Secs Timeout */
+	tm.tv_usec = 0;
+		
+	if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for accept ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_SNDTIMEO 8 seconds for accept ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+	if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tm, sizeof(tm)) < 0) {
+		fprintf(stderr, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for accept ... %s !!\r\n", getpid(), strerror(errno));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] Can't setsockopt SO_RCVTIMEO 8 seconds for accept ... %s !!", getpid(), strerror(errno));
+		close(sock);
+		return -1;
+	}
+
+	return sock;
+}
+
+int request_for_sncfg(struct sncfg_request *request)
+{
+	int sock, size;
+
+	size = pack_request(request);
+	if (size < 0) {
+		return -1;
+	}
+	
+	sock = connect_request();
+	if (sock < 0) {
+		return -1;
+	}
+	
+	if (safe_write(sock, request, size) != size) {
+		close(sock);
+		return -1;
+	}
+
+	size = safe_read(sock, request, sizeof(struct sncfg_request));
+
+	if (size < 0 ||
+		unpack_request(request, size) < 0 ||
+		request->status < 0) {
+		/* request processing failed */
+		close(sock);
+		return -1;
+	}
+	
+	close(sock);
+	return 0;
+}
diff --git a/src/apps/atom-base/progs/property/prop/utility.c b/src/apps/atom-base/progs/property/prop/utility.c
new file mode 100644
index 0000000..8390413
--- /dev/null
+++ b/src/apps/atom-base/progs/property/prop/utility.c
@@ -0,0 +1,184 @@
+/* Copyright Statement:
+
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+
+ * MediaTek Inc. (C) 2015. All rights reserved.
+
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sched.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <syslog.h>
+#include "utility.h"
+
+/*******************************************************************************/
+/* UTILITY local definitions                                                   */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY local prototypes                                                    */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY local variables                                                     */
+/*******************************************************************************/
+int libsncfg_rw_block = 1;
+
+/*******************************************************************************/
+/* UTILITY local functions                                                     */
+/*******************************************************************************/
+
+/*******************************************************************************/
+/* UTILITY functions                                                           */
+/*******************************************************************************/
+int safe_close(int fd)
+{
+	int ret;
+	
+	do {
+		ret = close(fd);
+	} while (ret < 0 && errno == EINTR);
+
+	if (ret < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] close(%d) @ safe_close() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] close(%d) @ safe_close() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+	}
+	return ret;
+}
+
+ssize_t safe_read(int fd, void *buf, size_t count)
+{
+	ssize_t n;
+                                                                                
+again:                                                                                
+	do {
+		n = read(fd, buf, count);
+	} while (n < 0 && errno == EINTR);
+
+	if (n < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] read(%d) @ safe_read() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] read(%d) @ safe_read() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+		if ((errnoTmp == EWOULDBLOCK || errnoTmp == EAGAIN) && libsncfg_rw_block) {
+			goto again;
+		}	
+	}
+	return n;
+}                                                                              
+
+ssize_t safe_write(int fd, const void *buf, size_t count)
+{
+	ssize_t n;
+                                                                                
+again:
+	do {
+		n = write(fd, buf, count);
+		if (n == 0) {
+			fprintf(stderr, "[LIBSNCFG][%d] write(%d) @ safe_write : write zero byte !!\n", getpid(), fd);
+			syslog(LOG_WARNING, "[LIBSNCFG][%d] write(%d) @ safe_write : write zero byte !!", getpid(), fd);
+		}
+	} while (n < 0 && errno == EINTR);
+
+	if (n < 0) {
+		int errnoTmp = errno;
+
+		fprintf(stderr, "[LIBSNCFG][%d] write(%d) @ safe_write() failed : %s !!\n", getpid(), fd, strerror(errnoTmp));
+		syslog(LOG_WARNING, "[LIBSNCFG][%d] write(%d) @ safe_write() failed : %s !!", getpid(), fd, strerror(errnoTmp));
+		if ((errno == EWOULDBLOCK || errno == EAGAIN) && libsncfg_rw_block) {
+			goto again;
+		}	
+	}
+	return n;
+}
+
+char *dupstr(char* s)
+{
+    char *r;
+    
+    r = malloc (strlen (s) + 1);
+    if (r)
+    	strcpy (r, s);
+    return (r);
+}
+
+int nonrt_system(const char *cmd)
+{
+	int wait_val, pid;
+	sig_t save_quit, save_int, save_chld;
+	struct sched_param sched;
+
+	if (cmd == 0) {
+		return 1;
+	}
+
+	save_quit = signal(SIGQUIT, SIG_IGN);
+	save_int = signal(SIGINT, SIG_IGN);
+	save_chld = signal(SIGCHLD, SIG_DFL);
+
+	if ((pid = vfork()) < 0) {
+		signal(SIGQUIT, save_quit);
+		signal(SIGINT, save_int);
+		signal(SIGCHLD, save_chld);
+		return -1;
+	}
+	if (pid == 0) {
+		signal(SIGQUIT, SIG_DFL);
+		signal(SIGINT, SIG_DFL);
+		signal(SIGCHLD, SIG_DFL);
+
+		/* child, can only call thread safe functions before exec ... */
+		sched.sched_priority = 0;
+		if (sched_setscheduler(0, SCHED_OTHER, &sched) == -1) {
+			exit(127);
+		}
+		execl("/bin/sh", "sh", "-c", cmd, (char *) 0);
+		exit(127);
+	}
+	/* Signals are not absolutly guarenteed with vfork */
+	signal(SIGQUIT, SIG_IGN);
+	signal(SIGINT, SIG_IGN);
+
+	if (wait4(pid, &wait_val, 0, 0) == -1) {
+		wait_val = -1;
+	}
+
+	signal(SIGQUIT, save_quit);
+	signal(SIGINT, save_int);
+	signal(SIGCHLD, save_chld);
+	return wait_val;
+}	
diff --git a/src/apps/ivt-base/thermal-manager/Makefile b/src/apps/ivt-base/thermal-manager/Makefile
new file mode 100644
index 0000000..7208696
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/Makefile
@@ -0,0 +1,33 @@
+TARGET  := thermal_manager

+SOURCES := thermal_manager.c

+OBJ_PATH = thermal_manager.o

+#OBJECTS := $(SOURCES:.c=.o)

+OBJ = thermal_manager.o

+LDFLAGS += -lmtcloader

+

+CFLAGS += -O3 -D__EXTERN_C_LIB__ -ldl

+GET_LOCAL_DIR = $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))

+

+.PHONY: all clean install

+

+all: $(TARGET)

+

+${TARGET}:${OBJ_PATH}

+	${CC} ${OBJ} ${CFLAGS} -o $@

+

+#$(TARGET): $(OBJECTS)

+#	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@

+

+clean:

+	$(RM) $(OBJECTS) $(TARGET)

+

+MTKTHERMAL_DIR_INSTALL = "/usr/bin/"

+

+install: $(TARGET)

+	echo $(DESTDIR)

+	echo $(PREFIX)

+	echo $(shell pwd)

+	install -d $(DESTDIR)$(PREFIX)/bin/

+	install -d $(DESTDIR)$(PREFIX)/lib/

+	install -d ${DESTDIR}${PREFIX}/lib/pkgconfig/

+	install -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/

diff --git a/src/apps/ivt-base/thermal-manager/dis_thermal.conf b/src/apps/ivt-base/thermal-manager/dis_thermal.conf
new file mode 100644
index 0000000..a4db549
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/dis_thermal.conf
@@ -0,0 +1,62 @@
+Sec_Chip_Name

+MT2731

+Sec_End

+Sec_CD_TM

+/proc/mtkcooler/mtktscpu-sysrst

+

+/proc/mtkcooler/cpu00

+EXIT 6000

+/proc/mtkcooler/cpu_adaptive_0

+EXIT 6000

+/proc/mtkcooler/mtktspmic-sysrst

+

+/proc/mtkcooler/mtktspa4g-sysrst

+

+/proc/mtkcooler/mtk-cl-PApower

+

+/proc/mtkcooler/mtk-cl-noIMS

+

+/proc/mtkcooler/mtk-cl-adp-mutt

+

+/proc/mtkcooler/mtktsrf-sysrst

+

+/proc/mtkcooler/mtktsdram-sysrst

+

+/proc/mtkcooler/mtktsaplt-sysrst

+

+Sec_End

+Sec_ITP

+/proc/driver/thermal/clatm_setting

+0 1000 10 15 1 200 0 10 0

+/proc/driver/thermal/clmutt

+0 400 100 300 200 200 200 100 25500 105000

+Sec_End

+Sec_RTP

+/proc/driver/thermal/tzcpu

+1 135000 0 mtktscpu-sysrst 105000 0 cpu00 100000 0 cpu_adaptive_0 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzpmic

+1 145000 0 mtktspmic-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzpa4g

+1 125000 0 mtktspa4g-sysrst 115000 0 mtk-cl-PApower 110000 0 mtk-cl-noIMS 105000 0 mtk-cl-adp-mutt 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzrf

+1 125000 0 mtktsrf-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzdram

+1 125000 0 mtktsdram-sysrst 0 0 no-cooler 53000 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzaplt

+1 125000 0 mtktsaplt-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+Sec_End

+Sec_TZ_TM

+/proc/mtktz/mtktscpu

+ma_len 1

+/proc/mtktz/mtktspmic

+ma_len 1

+/proc/mtktz/mtktspa4g

+ma_len 1

+/proc/mtktz/mtktsrf

+ma_len 1

+/proc/mtktz/mtktsdram

+ma_len 1

+/proc/mtktz/mtktsaplt

+ma_len 1

+Sec_End

+EOF

diff --git a/src/apps/ivt-base/thermal-manager/lib/libmtcloader.so b/src/apps/ivt-base/thermal-manager/lib/libmtcloader.so
new file mode 100644
index 0000000..ab21659
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/lib/libmtcloader.so
Binary files differ
diff --git a/src/apps/ivt-base/thermal-manager/lib64/libmtcloader.so b/src/apps/ivt-base/thermal-manager/lib64/libmtcloader.so
new file mode 100644
index 0000000..1979748
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/lib64/libmtcloader.so
Binary files differ
diff --git a/src/apps/ivt-base/thermal-manager/thermal-manager.service b/src/apps/ivt-base/thermal-manager/thermal-manager.service
new file mode 100644
index 0000000..77160c3
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/thermal-manager.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=thermal_manager
+
+[Service]
+ExecStart=/usr/bin/thermal_manager /data/thermal/thermal.conf
+Type=simple
+
+[Install]
+WantedBy=multi-user.target
diff --git a/src/apps/ivt-base/thermal-manager/thermal.conf b/src/apps/ivt-base/thermal-manager/thermal.conf
new file mode 100644
index 0000000..134c9b5
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/thermal.conf
@@ -0,0 +1,62 @@
+Sec_Chip_Name

+MT2731

+Sec_End

+Sec_CD_TM

+/proc/mtkcooler/mtktscpu-sysrst

+

+/proc/mtkcooler/cpu00

+EXIT 6000

+/proc/mtkcooler/cpu_adaptive_0

+EXIT 6000

+/proc/mtkcooler/mtktspmic-sysrst

+

+/proc/mtkcooler/mtktspa4g-sysrst

+

+/proc/mtkcooler/mtk-cl-PApower

+EXIT 2000

+/proc/mtkcooler/mtk-cl-noIMS

+

+/proc/mtkcooler/mtk-cl-adp-mutt

+

+/proc/mtkcooler/mtktsrf-sysrst

+

+/proc/mtkcooler/mtktsdram-sysrst

+

+/proc/mtkcooler/mtktsaplt-sysrst

+

+Sec_End

+Sec_ITP

+/proc/driver/thermal/clatm_setting

+0 1000 10 15 1 200 0 10 0

+/proc/driver/thermal/clmutt

+0 400 100 300 200 200 200 100 25500 105000

+Sec_End

+Sec_RTP

+/proc/driver/thermal/tzcpu

+3 125000 0 mtktscpu-sysrst 120000 0 cpu00 115000 0 cpu_adaptive_0 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzpmic

+1 125000 0 mtktspmic-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzpa4g

+4 125000 0 mtktspa4g-sysrst 115000 0 mtk-cl-PApower 110000 0 mtk-cl-noIMS 105000 0 mtk-cl-adp-mutt 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzrf

+1 125000 0 mtktsrf-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzdram

+1 125000 0 mtktsdram-sysrst 0 0 no-cooler 53000 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+/proc/driver/thermal/tzaplt

+1 125000 0 mtktsaplt-sysrst 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 0 0 no-cooler 1000

+Sec_End

+Sec_TZ_TM

+/proc/mtktz/mtktscpu

+ma_len 1 

+/proc/mtktz/mtktspmic

+ma_len 1 

+/proc/mtktz/mtktspa4g

+ma_len 1 

+/proc/mtktz/mtktsrf

+ma_len 1 

+/proc/mtktz/mtktsdram

+ma_len 1 

+/proc/mtktz/mtktsaplt

+ma_len 1 

+Sec_End

+EOF

diff --git a/src/apps/ivt-base/thermal-manager/thermal_manager.c b/src/apps/ivt-base/thermal-manager/thermal_manager.c
new file mode 100644
index 0000000..29fa32d
--- /dev/null
+++ b/src/apps/ivt-base/thermal-manager/thermal_manager.c
@@ -0,0 +1,144 @@
+/* Copyright Statement:
+ *
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein is
+ * confidential and proprietary to MediaTek Inc. and/or its licensors. Without
+ * the prior written permission of MediaTek inc. and/or its licensors, any
+ * reproduction, modification, use or disclosure of MediaTek Software, and
+ * information contained herein, in whole or in part, shall be strictly
+ * prohibited.
+ *
+ * MediaTek Inc. (C) 2012. All rights reserved.
+ *
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ * ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
+ * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+ * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
+ * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+ * INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
+ * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+ * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+ * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
+ * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
+ * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
+ * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
+ * RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
+ * MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+ * CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ *
+ * The following software/firmware and/or related documentation ("MediaTek
+ * Software") have been modified by MediaTek Inc. All revisions are subject to
+ * any receiver's applicable license agreements with MediaTek Inc.
+ */
+
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ *      thermal_manager.c
+ *
+ * Project:
+ * --------
+ *      YuSu
+ *
+ * Description:
+ * ------------
+ *      Set default values to all thermal zone device drivers and cooling device drivers when
+ *      system init.
+ *
+ * Author:
+ * -------
+ *      CT Fang (mtk02403)
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+//#include <cutils/properties.h>
+//#include <android/log.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <dlfcn.h>
+//#include <utils/Log.h>
+//#include <cutils/log.h>
+
+#if 0
+#define MTK_LOG_ENABLE	(1)
+#define TM_LOG_TAG "thermal_mgr"
+
+#if MTK_LOG_ENABLE
+#define TM_LOG(_priority_, _fmt_, args...)  LOG_PRI(_priority_, TM_LOG_TAG, _fmt_, ##args)
+static int _tm_debug_on = 1;
+#else
+#define TM_LOG(_priority_, _fmt_, args...)
+#endif
+#endif
+
+int (*loadmtc)(char *) = NULL;
+#define LIB_FULL_NAME "libmtcloader.so"
+
+typedef int (*load)(char *);
+
+int (*loadchange_policy)(char *, int) = NULL;
+typedef int (*load_change_policy)(char *, int);
+
+int main(int argc, char **argv)
+{
+    int i = 0;
+    void *handle, *func, *func2;
+
+printf("[thermal_manager]main\n");
+
+    for (; i < argc; i++) {
+        printf("[thermal_manager] argv[%d] %s.\n", i, argv[i]);
+    }
+
+    handle = dlopen(LIB_FULL_NAME, RTLD_NOW);
+
+	if (handle == NULL) {
+		printf("[thermal_manager] fails to load lib err: %s.\n", dlerror());
+		return -1;
+	}
+
+	func = dlsym(handle, "loadmtc");
+	loadmtc = (load)func;
+
+	if (loadmtc == NULL) {
+		printf("[thermal_manager] loadmtc err: %s.\n", dlerror());
+		dlclose(handle);
+		return -1;
+	}
+
+    if (argc - 1 > 0) {
+        int ret = 0;
+
+        if (argc == 2) {
+        	ret = loadmtc(argv[1]);
+        } else if (argc == 3) {
+			func2 = dlsym(handle, "change_policy");
+			loadchange_policy = (load_change_policy)func2;
+
+			if (loadchange_policy == NULL) {
+				dlclose(handle);
+				return -1;
+			}
+			ret = loadchange_policy(argv[1], atoi(argv[2]));
+		}
+		dlclose(handle);
+        return ret;
+    } else {
+        //int ret = loadmtc("/vendor/etc/.tp/thermal.conf"); /* default policy */
+		int ret = loadmtc("/data/thermal/thermal.conf"); /* default policy */
+        dlclose(handle);
+        return ret;
+    }
+}
+