diff --git a/mbtk/mbtk_logd/alog_read.c b/mbtk/mbtk_logd/alog_read.c
index a907662..cfb7556 100755
--- a/mbtk/mbtk_logd/alog_read.c
+++ b/mbtk/mbtk_logd/alog_read.c
@@ -9,7 +9,12 @@
 #include <time.h>
 #include <unistd.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
 #include "log_config.h"
+#include "mbtk_utils.h"
 
 #define  ALOG_DEV "/dev/log_radio"
 #define LOG_CONFIG_LEN 50
@@ -35,7 +40,7 @@
     android_LogPriority priority;
     int32_t pid;
     int32_t tid;
-    const char * tag;
+    char * tag;
     size_t messageLen;
     const char * message;
 } AndroidLogEntry;
@@ -45,10 +50,11 @@
 static int log_size = 1 * 1024 * 1024;
 
 static log_config_entry *config = NULL;
-static char tmp_log[48] = {0};
+static char tmp_log[1024] = {0};
 
 static int fd_radio = 0;
 
+int tcp_connect(char* ip, int port);
 
 void hex_print(char* buf, int len)
 {
@@ -135,7 +141,7 @@
 int alog_process(char* data, int len, AndroidLogEntry *entry)
 {
     int i, n = 0;
-    int tmp_len;
+//    int tmp_len;
 
     for (i = 0; i < len;) {
         if (data[i] == '\0') {
@@ -202,32 +208,32 @@
     int index = 0;
     int len = 0;
     struct stat s;
-    
+
 
     static char buffer[MAX_BUFFER_SIZE] = {0};
     static int buffer_index = 0;
-    
+
     if(access(tmp_log, W_OK) != 0)
     {
         fd_radio = open(tmp_log, O_CREAT | O_WRONLY| O_APPEND, 0600);
-        if (fd_radio < 0) 
+        if (fd_radio < 0)
         {
             fprintf(stderr, "failed to open %s: %s\n", tmp_log, strerror(errno));
             exit(-1);
         }
-        
+
     }
 
 
     if (log_size && (!stat(tmp_log, &s)) && (s.st_size > log_size))
     {
         fd_radio = get_rotate_file(fd_radio, log_file, _file_list);
-        if (fd_radio < 0) 
+        if (fd_radio < 0)
         {
             fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno));
             exit(-1);
         }
-      
+
     }
 
     if(fileter_log(entry->priority, entry->tag, config->filter_list))
@@ -242,7 +248,7 @@
 
     totalLen = snprintf(defaultBuffer, sizeof(defaultBuffer),
     "%s %c/%s (%d): %s\n", timeBuf, priChar, entry->tag, entry->pid, entry->message);
-    
+
     len = strlen(defaultBuffer);
     if(access("/etc/syslog_encrypt_flag", F_OK) == 0)
     {
@@ -256,33 +262,33 @@
     if(buffer_index >= RADIOLOG_BUFF_SIZE)
     {
         // Flush the buffer if it's full
-        if (write(fd_radio, buffer, buffer_index) < 0) 
+        if (write(fd_radio, buffer, buffer_index) < 0)
         {
             perror("write error");
             return -1;
         }
         buffer_index = 0; // Reset buffer index after flushing
     }
-        
+
     if(totalLen < RADIOLOG_BUFF_SIZE)
     {
-        //copy buf to buffer 
+        //copy buf to buffer
         memcpy(buffer + buffer_index, defaultBuffer, totalLen);
         buffer_index += totalLen;
     }
     else
     {
-        write(fd_radio, defaultBuffer, totalLen);
+        mbtk_write(fd_radio, defaultBuffer, totalLen);
     }
-        
-    
+
+
     return 0;
 }
 
 void* alog_thread(void* argv)
 {
     int dev_fd, ret;
-    int log_fd;
+//    int log_fd;
     AndroidLogEntry entry;
     char buf[512] = {0};
     static struct file_list_t file_list;
@@ -312,33 +318,33 @@
 		strncpy(log_file, config->out_path, LOG_CONFIG_LEN - 1);
 	}
 
-    if (config->ip && config->port) 
+    if (config->ip && config->port)
     {
         int port = atoi(config->port);
         printf("%s %d : %s:%s\n", __FUNCTION__, __LINE__, config->ip, config->port);
-        log_fd = tcp_connect(config->ip, port);
-    } 
-    else if (strlen(log_file) > 0) 
+        tcp_connect(config->ip, port);
+    }
+    else if (strlen(log_file) > 0)
     {
         //sprintf(tmp_log, "/tmp/log%s", strstr_tail(log_file, "/"));
-        
+
         snprintf(tmp_log,sizeof(tmp_log), "%s", log_file);
         // 先将文件保存到 /tmp/log/ 目录下，后面到达 rotate_file_size 后，转移到out_path
-       
-    } 
-    else 
+
+    }
+    else
     {
-        log_fd = STDOUT_FILENO;
+        //log_fd = STDOUT_FILENO;
     }
     if(config->rotate_file_size)
     {
         log_size = config->rotate_file_size;
     }
     printf("android log start...\n");
-    while (1) 
+    while (1)
     {
         ret = read(dev_fd, buf, sizeof(buf));
-        if (ret < 0) 
+        if (ret < 0)
         {
             printf("read error\n");
             break;
@@ -348,7 +354,7 @@
         memset(buf, 0, sizeof(buf));
     }
     close(dev_fd);
-   
+
     printf("%s exit \n", __FUNCTION__);
     pthread_exit(NULL);
 	return NULL;
diff --git a/mbtk/mbtk_logd/log_config.h b/mbtk/mbtk_logd/log_config.h
index c37ce24..b3ca188 100755
--- a/mbtk/mbtk_logd/log_config.h
+++ b/mbtk/mbtk_logd/log_config.h
@@ -21,9 +21,9 @@
 
 typedef struct log_config_entry_t {
     int enable;
-    char *name;
+    const char *name;
     int send_fd;
-    char *out_path;
+    const char *out_path;
     char *ip;
     char *port;
     int rotate_file_size;
diff --git a/mbtk/mbtk_logd/main.c b/mbtk/mbtk_logd/main.c
index 7925381..ef750e8 100755
--- a/mbtk/mbtk_logd/main.c
+++ b/mbtk/mbtk_logd/main.c
@@ -41,9 +41,9 @@
             }
             _filter_list = entry->filter_list;
             for (n = 0; n < 10; n++) {
-                printf("%s %d: malloc %x!\n", __FUNCTION__, __LINE__, _filter_list);
+                printf("%s %d: malloc %p!\n", __FUNCTION__, __LINE__, _filter_list);
                 if (_filter_list) {
-                    printf("%s %d: malloc %x!\n", __FUNCTION__, __LINE__, _filter_list->next);
+                    printf("%s %d: malloc %p!\n", __FUNCTION__, __LINE__, _filter_list->next);
                     if (_filter_list->tag) {
                         free(_filter_list->tag);
                     }
@@ -69,7 +69,7 @@
     json_object* fileter_listjson = NULL;
     log_config_entry* entry;
     int i, n, ret, array_length;
-    char* cmdval = NULL;
+    const char* cmdval = NULL;
 
     printf("MBTK_LOGD: in parse_config\n");
     jsonobj = json_object_from_file(LOG_CONFIG_PATH);
@@ -108,7 +108,7 @@
 
         json_object_object_get_ex(datajson, "name", &listjson);
         entry->name = json_object_get_string(listjson);
-        printf("cmdval: %x, %s\n", entry->name, entry->name);
+        printf("cmdval: %s\n", entry->name);
 
         json_object_object_get_ex(datajson, "log_file", &listjson);
         entry->out_path = json_object_get_string(listjson);
