[Feature][API-230]add debug

Change-Id: I0607a481ba3e445af9845dafc2b0f49f7792847f
diff --git a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
index f4bd3cb..b37724c 100755
--- a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
+++ b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
@@ -236,9 +236,14 @@
     
     system("echo \"Sys standby mode\" >/dev/console");
     // sleep(1);
-    system("echo 7 | emdlogger_ctrl");
-    // sleep(1);
-
+    if(adb_debug_mode == 2)
+    {
+        system("echo 11 | emdlogger_ctrl");
+    }
+    else
+    {
+        system("echo 7 | emdlogger_ctrl");
+    }
     if (lynq_screen(0) != 0)  //notify ril for screen off
     {
         ALOGI("lynq_screen off fail\n");
@@ -316,28 +321,36 @@
     RLOGD("TIME: rtc to sys\n");
     if (!success)
     {
+       if(adb_debug_mode == 2)
+        {
+            system("echo 12 | emdlogger_ctrl");
+        }
+        else
+        {
+            system("mdlogctl start");
+            system("echo 8 | emdlogger_ctrl");
+        }
 
-       system("mdlogctl start");
-
-       system("echo 8 | emdlogger_ctrl");
-    
        usleep(200000); 
        ALOGI("Log on with failure\n");
        return ;
     }
 
-    
     if (lynq_screen(1) != 0)  // notify ril for screen on
     {
     ALOGI("lynq_screen on fail\n");
 
     }
 
-    system("mdlogctl start");
-
-//  sleep(1);
-
-    system("echo 8 | emdlogger_ctrl");
+     if(adb_debug_mode == 2)
+    {
+        system("echo 12 | emdlogger_ctrl");
+    }
+     else
+    {
+        system("mdlogctl start");
+        system("echo 8 | emdlogger_ctrl");
+    }
 
     usleep(300000); //delay 2s for ril handling screen on,at least 70ms
 
diff --git a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/main.c b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/main.c
index 5665176..bbd9029 100755
--- a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/main.c
+++ b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/main.c
@@ -406,16 +406,32 @@
             continue ;//jb.qi add for service send when DTR is low on 20221111 
         }        
         pthread_mutex_unlock(&time_info_mutex);
-
         pthread_mutex_unlock(&feedback_mutex);
-
-
-
     }
 
 }
 
 
+void *check_wakeup_sources(void *sockfd)
+{
+    FILE *fp;
+    int ret;
+    char buf[256];
+    RLOGD("start check wakeup_sources  !!!\n");
+    while(1)
+    {
+        memset(buf,0,sizeof(buf));
+        fp = popen("cat /sys/kernel/debug/wakeup_sources|sed -e 's/\"^ \"/\"unnamed\"/g' | awk '{print $6 \"\t\" $1}'| grep -v \"^0\" |sort -n \n","r");
+        while(fgets(buf, 255, fp) != NULL)
+        {
+             RLOGD("%s", buf);
+        }
+        pclose(fp);
+        sleep(3);
+    }
+}
+
+
 int main(int argc, char **argv) {
 
 
@@ -433,7 +449,7 @@
     len = sizeof(server_sockaddr);
 
 
-    pthread_t tid,tid_1; //jb.qi add for service send when DTR is low on 20221111 
+    pthread_t tid,tid_1,tid_2; //jb.qi add for service send when DTR is low on 20221111 
     
     LYLOGEINIT(USER_LOG_TAG);
     LYLOGSET(LOG_DEBUG);    
@@ -452,16 +468,6 @@
 
     signal(SIGPIPE,SIG_IGN); // 忽略SIGPIPE信号,防止由于客户端关闭,继续往客户端write,会导致服务端收到SIGPIPE信号而Broken pipe
 
-    
-    // init_network_func();
-
-    // if(pthread_cond_init(&feedback_cond,NULL) != 0)
-    // {
-    //     strerror_r(errno, buf, sizeof(buf));
-    //     ALOGI("Error creating cond: %s\n", buf);
-    //     return -1;
-    // }
-
     set_wakeup_callback(wakeup_feedback);
     // 注册回调函数
 
@@ -502,6 +508,12 @@
     pthread_detach(tid_1);
     /*jb.qi add for service send when DTR is low on 20221111 end*/
 
+    if(adb_debug_mode == 2)
+    {
+        pthread_create(&tid_2,NULL, check_wakeup_sources,NULL);
+        pthread_detach(tid_2);
+    }
+
     while (1)
     {
         ALOGI("service socket listening...\n");