[Feature][ZXW-283]wifi is locked when loaded and unlocked when unloaded
Only Configure :No
Affected branch: master
Affected module: wifi
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: Yes
Change-Id: If6dcd6c25c6fdb3cd2566a09c856d799160f6307
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}/"