Merge "[BugFix][Feature][T106BUG-641] SPI packet loss problem, merged into ZXW patch start"
diff --git a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
index 177bb92..95c40dc 100755
--- a/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
+++ b/ap/os/linux/linux-3.4.x/drivers/net/wireless/aic8800d80l/aicwf_sdio.c
@@ -2062,7 +2062,7 @@
 	struct mmc_host *host;
 	u8 byte_mode_disable = 0x1;//1: no byte mode
 	int ret = 0;
-	uint32_t sdio_clock = 100000000;
+	uint32_t sdio_clock = 78000000; //zw.wang WiFi low temperature -40 degrees failure on 20240716
     u8 val;
 	u8 val1 = 0;
 	//struct aicbsp_feature_t feature;
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
index c116e65..949c1f3 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/lynq-wifi-demo.cpp
@@ -13,6 +13,7 @@
 #include <syslog.h>
 #include <pthread.h>
 
+#include <include/lynq-qser-autosuspend.h>
 #include <include/lynq-qser-wifi.h>
 
 void lynq_wifi_event_handle_demo(lynq_wifi_event_s *event, void *arg)
@@ -51,6 +52,12 @@
 
 int main(int argc, char *argv[])
 {
+    int num = qser_wakelock_create("wifi_lock", 10);
+    if(num < 0)
+    {
+        printf("wakelock create fail\n");
+        printf("num=%d\n", num);
+    }
     lynq_wifi_ap_index_e type;
     if (strcmp(argv[0], "lynq-wifi-demo") == 0)
         type = LYNQ_WIFI_AP_INDEX_AP0; // 2.4G
@@ -63,6 +70,18 @@
             qser_wifi_enable();      // enable wifi
             qser_wifi_ap_stop(type); // Disable ap mode for 2.4G/5G
             qser_wifi_disable();     // Turn off WiFi
+            int ret = qser_wakelock_unlock(num);
+            if(ret != 0)
+            {
+                printf("wakelock unlock fail\n");
+                printf("ret=%d\n", ret);
+            }
+            ret = qser_wakelock_destroy(num);
+            if(ret != 0)
+            {
+                printf("wakelock destroy fail\n");
+                printf("ret=%d\n", ret);
+            }
         }
         else if (strcmp(argv[1], "1") == 0) //Load WiFi and turn on WiFi
         {
@@ -93,6 +112,12 @@
             }
             qser_wifi_ap_auth_set(type, LYNQ_WIFI_AUTH_WPA2_PSK, pw); // Set the authentication of 2.4G/5G to wpa2 and the password to lynq123456
             qser_wifi_ap_start(type);                                 // Set the ap mode of 2.4G/5G
+            int ret = qser_wakelock_lock(num);
+            if(ret != 0)
+            {
+                printf("wakelock lock fail\n");
+                printf("ret=%d\n", ret);
+            }
         }
         else if (strcmp(argv[1], "2") == 0) //Callback query that only covers WiFi as an ap
         {
@@ -195,7 +220,12 @@
             qser_wifi_sta_start();
             qser_wifi_sta_start_scan(); // When this function is executed once, sta's scan is called once
             memset(cmdstr, 0, sizeof(cmdstr));
-
+            ret = qser_wakelock_lock(num);
+            if(ret != 0)
+            {
+                printf("wakelock lock fail\n");
+                printf("ret=%d\n", ret);
+            }
             while (1)
             {
                 printf("[lynq-wifi-demo]Enter the ssid and password as shown in the following example:ssid auth paris pw ||sta_pkt_get ||sta_param_get || sta_scan ||sta_stop\n");
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
index bac0c42..e3ec151 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/files/makefile
@@ -29,6 +29,7 @@
     -lstdc++ \
     -lpthread \
     -llynq-qser-wifi \
+    -llynq-qser-autosuspend \
 
 SOURCES = lynq-wifi-demo.cpp
 
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
index 2b48617..ffd0288 100644
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-wifi-demo/lynq-wifi-demo.bb
@@ -8,6 +8,7 @@
            file://makefile \
 "
 DEPENDS += "liblynq-qser-wifi"
+DEPENDS += "liblynq-qser-autosuspend"
 
 SRC-DIR = "${S}/../lynq-wifi-demo"
 FILES_${PN} += "${bindir}/"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
index 1589c5f..811e7e7 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
@@ -123,7 +123,7 @@
 int lynq_get_upgrade_type();

 int lynq_get_sync_status();

 int lynq_set_sync_status(char *option_para);

-

+int  calculate_md5_sum( char *md5_sum,int md5_size);

 

 /*****************************************

 * @brief:rock_update_main

@@ -145,6 +145,7 @@
     time_t endTime;

     struct tm *localTime;

     double elapsed = 0;

+    char md5_sum[48] = {0};

 

     FILE *fp = NULL;

     fp = fopen(FOTA_FLAG_FILE,"w+");

@@ -192,6 +193,12 @@
         return -1;

     }

 

+    ret = calculate_md5_sum(md5_sum,sizeof(md5_sum));

+    if(ret != 0)

+    {

+        LYINFLOG("Calculate md5 sum failed");

+    }

+

     startTime = time(NULL);

     if(startTime == (time_t)-1) 

     {

@@ -211,7 +218,7 @@
     if(ret != 0)

     {

         LYERRLOG("Upgrade failed");

-        ret =  sc_debug_info_record(MODULE_ID_CAP_FOTA,"failed,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));

+        ret =  sc_debug_info_record(MODULE_ID_CAP_FOTA,"failed,spendtime: %.2lf seconds,finished time %s,md5:%s", elapsed,asctime(localTime),md5_sum);

         if(ret <= 0)

         {

             LYERRLOG("lynq_record_debug_info failed");

@@ -221,7 +228,7 @@
     else

     {

         LYINFLOG("Upgrade success");

-        ret =  sc_debug_info_record(MODULE_ID_CAP_FOTA,"success,spendtime: %.2lf seconds,package size:%d,finished time %s", elapsed,total_size,asctime(localTime));

+        ret =  sc_debug_info_record(MODULE_ID_CAP_FOTA,"success,spendtime: %.2lf seconds,finished time %s,md5:%s", elapsed,asctime(localTime),md5_sum);

         if(ret <= 0)

         {

             LYERRLOG("lynq_record_debug_info failed");

@@ -1006,6 +1013,58 @@
      return ration;

 }

 

+int  calculate_md5_sum( char *md5_sum,int md5_size)

+{

+    FILE *fp = NULL;

+    char package_path[256] = {0};

+    char command[64] = {0};

+    char *space_pos = NULL;

+    int length = 0;

+    char command_result[64] = {0};

+    

+    fp = fopen(FOTA_ADDR_FILE, "rb");

+    if(fp == NULL)

+    {

+        LYERRLOG("Open file failed", FOTA_ADDR_FILE);

+        return -1;

+    }

+    if(fgets(package_path, sizeof(package_path), fp) == NULL)

+    {

+        LYERRLOG("Read file %s failed", package_path);

+    }

+    fclose(fp);

+    

+    snprintf(command, sizeof(command), "md5sum %s",package_path);

+

+    fp = popen(command, "r");

+    if (fp == NULL) 

+    {

+        LYERRLOG("Failed to run command\n");

+        return -1;

+    }

+    if (fgets(command_result, sizeof(command_result), fp) != NULL) 

+    {

+       

+        space_pos = strchr(command_result, ' ');

+        if (space_pos != NULL) 

+        {

+            length = space_pos - command_result;

+             if(length >= md5_size) 

+             {

+                pclose(fp);

+                return -1;

+            }

+            strncpy(md5_sum, command_result, length);

+            md5_sum[length] = '\0';

+        } 

+    } 

+    

+    pclose(fp);

+    

+    return 0;

+

+}

+

 DEFINE_LYNQ_LIB_LOG(LYNQ_FOTA)

 

 #ifdef __cplusplus

diff --git a/update_version.sh b/update_version.sh
index b60c396..ff03aa6 100755
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
 #!/bin/bash
 #export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106-V2.01.01.02P56U06.AP.15.06"
-LYNQ_CAP_INSIDE_VERSION="CAP.15.06"
-LYNQ_CAP_VERSION="CAP.15.06"
+LYNQ_AP_VERSION="T106-W-V2.01.01.02P56U06.AP.15.07"
+LYNQ_CAP_INSIDE_VERSION="CAP.15.07"
+LYNQ_CAP_VERSION="CAP.15.07"
 COMMIT_ID="$(git rev-parse HEAD)"
 
 LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""