Merge "Revert "[Feature][T106BUG-76] change log system implement & log level control""
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
index d5acc77..d8c6a80 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
@@ -225,6 +225,8 @@
service \
service-test \
lynq-ril-service \
+ lynq-qser-sim-demo \
+ lynq-qser-sms-demo \
uci \
gdb \
mobiletek-tester-rdit \
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 88778a9..8d07dc3 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -193,6 +193,8 @@
liblynq-qser-fota \
libpoweralarm \
liblynq-systime \
+ liblynq-autosuspend \
+ liblynq-qser-autosuspend \
"
zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril', 'libtelsvr', d)}"
@@ -263,7 +265,10 @@
poweralarm-demo \
lynq-systime-demo \
lynq-fota-backup \
+ lynq-qser-sim-demo \
+ lynq-qser-sms-demo \
lynq-qser-data-demo \
+ lynq-autosuspend \
"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/zcatlog_config.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/zcatlog_config.sh
index 064dd2b..604cd22 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/zcatlog_config.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/zcatlog_config.sh
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ! -f "/mnt/userdata/config" ];then
+ cp -R /etc/config /mnt/userdata/
+fi
+
# 0 for usb, 1 for net
if [ -e /proc/sys/zcatkern/log_com_mode ]; then
zcat_com_mode=`nv get zcat_mode`
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-autosuspend/liblynq-autosuspend.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-autosuspend/liblynq-autosuspend.bb
new file mode 100644
index 0000000..fc81884
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-autosuspend/liblynq-autosuspend.bb
@@ -0,0 +1,53 @@
+#inherit externalsrc package
+
+DESCRIPTION = "liblynq-autosuspend"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "libbsp liblynq-log"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-autosuspend"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+ file://liblynq-autosuspend \
+ "
+
+SRC-DIR = "${S}/../liblynq-autosuspend"
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+FILES_${PN} = "${base_libdir}/*.so \
+ ${base_bindir}\
+ ${base_sbindir} \
+ /etc/dbus-1/system.d/"
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+FILES_${PN}-doc = "/doc"
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if [ "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu"
+ elif [ "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu"
+ elif [ "${PACKAGE_ARCH}" = "cortexa53hf-neon-fp-armv8" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -mhard-float -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53"
+ else
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ fi
+}
+
+do_install() {
+ oe_runmake install -C ${SRC-DIR} ROOT=${D}
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}
+ cp -af ${SRC-DIR}/include/libauto/ ${D}${includedir}/libauto
+ fi
+}
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-autosuspend/liblynq-qser-autosuspend.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-autosuspend/liblynq-qser-autosuspend.bb
new file mode 100644
index 0000000..375742d
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-autosuspend/liblynq-qser-autosuspend.bb
@@ -0,0 +1,52 @@
+#inherit externalsrc package
+
+DESCRIPTION = "liblynq-qser-autosuspend"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
+
+DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'mt2735', 'audio-mixer-ctrl streamer1.0', '', d)} liblynq-autosuspend liblynq-log"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-autosuspend/"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+ file://liblynq-qser-autosuspend\
+ "
+
+SRC-DIR = "${S}/../liblynq-qser-autosuspend"
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+FILES_${PN} = "${base_libdir}/*.so "
+
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+
+FILES_${PN}-doc = "/doc"
+
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu"
+}
+
+do_install () {
+ oe_runmake install -C ${SRC-DIR} ROOT=${D}
+
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}/
+ cp -af ${SRC-DIR}/include/ ${D}${includedir}/
+ fi
+}
+
+addtask bachclean
+do_bachclean () {
+ oe_runmake clean
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb
index c646163..23076f4 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/lynq-autosuspend.bb
@@ -15,9 +15,7 @@
file://makefile \
"
-EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
- 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
- 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
TARGET_CC_ARCH += "${LDFLAGS}"
@@ -30,11 +28,6 @@
OBJECTS = "$(SOURCES:.c=.o)"
-EXTRA_OEMAKE += "'MOBILETEK_SUSPEND_CFG = ${MOBILETEK_SUSPEND_CFG}'\
- 'TARGET_PLATFORM = ${TARGET_PLATFORM}'\
- 'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'\
- 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
-
EXECUTABLE = "autosuspend"
S = "${WORKDIR}"
TARGET_CC_ARCH += "${LDFLAGS}"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.bb
new file mode 100644
index 0000000..ab8d052
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.bb
@@ -0,0 +1,40 @@
+inherit externalsrc package
+DESCRIPTION = "autosuspend-client demo"
+
+LICENSE = "MobileTekProprietary"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4f60c98fa94e02f659ef5939f67fa8ae"
+#DEPENDS = "platform-libs"
+
+
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/lynq-qser-autosuspend-demo"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/packages/apps:"
+SRC_URI = " \
+ file://lynq-qser-autosuspend-demo \
+ "
+
+SRC-DIR = "${S}/../lynq-qser-autosuspend-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+SYSTEMD_PACKAGES = "${PN}"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'\"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+EXTRA_OEMAKE += "'MOBILETEK_FOTA_CFG = ${MOBILETEK_FOTA_CFG}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+ else
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+ fi
+}
+
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${SRC-DIR}/lynq-qser-autosuspend-demo ${D}${bindir}/
+ install -d ${D}${includedir}
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.cpp
new file mode 100755
index 0000000..abcea42
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.cpp
@@ -0,0 +1,436 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+#include"lynq-qser-sim-demo.h"
+
+
+#define BUF_SIZE 32
+#define BUF_PIN 8
+
+typedef uint32_t sim_client_handle_type;
+
+sim_client_handle_type ph_sim = 2023;
+sim_client_handle_type h_sim = 2023;
+int flag_init = 0;
+
+int (*qser_sim_client_init)(sim_client_handle_type *ph_sim);
+int (*qser_sim_client_deinit)(sim_client_handle_type h_sim);
+int (*qser_sim_getimsi)(
+ sim_client_handle_type h_sim,
+ QSER_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier info.
+ char *imsi, ///< [OUT] IMSI buffer
+ size_t imsiLen ///< [IN] IMSI buffer length
+);
+
+int (*qser_sim_geticcid)
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ char *iccid, ///< [OUT] ICCID
+ size_t iccidLen ///< [IN] ICCID buffer length
+);
+
+int (*qser_sim_getphonenumber)
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier.
+ char *phone_num, ///< [OUT] phone number
+ size_t phoneLen ///< [IN] phone number buffer length
+);
+int (*qser_sim_verifypin)(sim_client_handle_type h_sim, QSER_SIM_VERIFY_PIN_INFO_T *pt_info);
+int (*qser_sim_changepin)(sim_client_handle_type h_sim, QSER_SIM_CHANGE_PIN_INFO_T *pt_info);
+int (*qser_sim_unblockpin)(sim_client_handle_type h_sim, QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info);
+int (*qser_sim_enablepin)(sim_client_handle_type h_sim, QSER_SIM_ENABLE_PIN_INFO_T *pt_info);
+int (*qser_sim_disablepin)(sim_client_handle_type h_sim, QSER_SIM_DISABLE_PIN_INFO_T *pt_info);
+int (*qser_sim_getcardstatus)(sim_client_handle_type h_sim, QSER_SIM_SLOT_ID_TYPE_T simId, QSER_SIM_CARD_STATUS_INFO_T *pt_info);
+
+
+typedef struct
+{
+ int cmdIdx;
+ const char *funcName;
+} st_api_test_case;
+
+//for server test
+st_api_test_case at_api_testcases[] =
+{
+ {0, "qser_sim_init"},
+ {1, "qser_get_imsi"},
+ {2, "qser_get_iccid"},
+ {3, "qser_get_phonenumber"},
+ {4, "qser_verify_pin"},
+ {5, "qser_change_pin"},
+ {6, "qser_unlock_pin"},
+ {7, "qser_enable_pin"},
+ {8, "qser_disable_pin"},
+ {9, "qser_get_sim_status"},
+ {10, "qser_deinit_sim"},
+ {-1, NULL}
+};
+
+void print_help(void)
+{
+ int i;
+ printf("Supported test cases:\n");
+ for(i = 0; ; i++)
+ {
+ if(at_api_testcases[i].cmdIdx == -1)
+ {
+ break;
+ }
+ printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);
+ }
+}
+
+int main(int argc, char const *argv[])
+{
+ int cmdIdx = 0;
+ int res = 0;
+
+ const char *lynq_libpath_sim = "/lib/liblynq-qser-sim.so";
+ void *dlHandle_sim = dlopen(lynq_libpath_sim, RTLD_NOW);
+ if (dlHandle_sim == NULL)
+ {
+ printf("dlopen dlHandle_sim failed: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+
+ print_help();
+ while(1)
+ {
+ printf("\nplease input cmd index(-1 exit): ");
+ scanf("%d", &cmdIdx);
+ if(cmdIdx == -1)
+ {
+ break;
+ }
+
+ switch(cmdIdx)
+ {
+ //"qser_sim_init"
+ case 0:
+ {
+ if(flag_init == 1)
+ {
+ printf("init is already\n");
+ break;
+ }
+ else{
+ //int token;
+ //printf("input token\n");
+ //scanf("%d", &token);
+ qser_sim_client_init = (int(*)(sim_client_handle_type *ph_sim))dlsym(dlHandle_sim,"qser_sim_client_init");
+ if(NULL != qser_sim_client_init)
+ {
+ res = qser_sim_client_init(&ph_sim);
+ if(res == 0)
+ {
+ printf("Run qser_sim_client_init\n");
+ flag_init = 1;
+ }else{
+ printf("qser_sim_client_init error\n");
+ }
+ }else{
+ printf("qser_sim_client_init dlsym error\n");
+ }
+ break;
+ }
+ }
+
+ //"qser_sim_getimsi"
+ case 1:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char imsi[BUF_SIZE] = {0};
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ qser_sim_getimsi = (int(*)(sim_client_handle_type h_sim, QSER_SIM_APP_ID_INFO_T *pt_info, char *imsi, size_t imsiLen))dlsym(dlHandle_sim,"qser_sim_getimsi");
+ if(NULL != qser_sim_getimsi)
+ {
+ res = qser_sim_getimsi(h_sim, &pt_info, imsi, 0);
+ if(res == 0)
+ {
+ printf("imsi is %s!!!\n",imsi);
+ }else{
+ printf("get imsi error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_getimsi dlsym error\n");
+ }
+ }
+ break;
+ }
+
+ //"qser_get_iccid"
+ case 2:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char iccid[BUF_SIZE] = {0};
+ qser_sim_geticcid = (int(*)(sim_client_handle_type h_sim, QSER_SIM_SLOT_ID_TYPE_T simId, char *iccid, size_t iccidLen))dlsym(dlHandle_sim,"qser_sim_geticcid");
+ if(NULL != qser_sim_geticcid)
+ {
+ res = qser_sim_geticcid(h_sim, QSER_SIM_SLOT_ID_1, iccid, 0);
+ if(res == 0)
+ {
+ printf("get iccid success!!! iccid is %s\n",iccid);
+ }else{
+ printf("get iccid error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_geticcid dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_get_phonenumber
+ case 3:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char phonenumber[BUF_SIZE] = "";
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ qser_sim_getphonenumber = (int(*)(sim_client_handle_type h_sim, QSER_SIM_APP_ID_INFO_T *pt_info, char *phone_num, size_t phoneLen))dlsym(dlHandle_sim,"qser_sim_getphonenumber");
+ if(NULL != qser_sim_getphonenumber)
+ {
+ res = qser_sim_getphonenumber(h_sim, &pt_info, phonenumber, 0);
+ if(res == 0)
+ {
+ printf("get phonenumber success!!! phonenumber is %s\n",phonenumber);
+ }else{
+ printf("get phonenumber error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_getphonenumber dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_verify_pin
+ case 4:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_VERIFY_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ printf("pin_value = %s , pin = %s\n", pt_info.pin_value, pin);
+
+ qser_sim_verifypin = (int(*)(sim_client_handle_type h_sim, QSER_SIM_VERIFY_PIN_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_verifypin");
+ if(NULL != qser_sim_verifypin)
+ {
+ res = qser_sim_verifypin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("verify pin success!!!\n");
+ }else{
+ printf("verify pin error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_verifypin dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_change_pin
+ case 5:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char old_pin[BUF_PIN] = {0};
+ QSER_SIM_CHANGE_PIN_INFO_T pt_info;
+ printf("input old pin\n");
+ scanf("%s", old_pin);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
+ strncpy(pt_info.old_pin_value, old_pin, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.old_pin_value = %s, old_pin = %s\n", pt_info.old_pin_value, old_pin);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+
+ qser_sim_changepin = (int(*)(sim_client_handle_type h_sim, QSER_SIM_CHANGE_PIN_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_changepin");
+ if(NULL != qser_sim_changepin)
+ {
+ res = qser_sim_changepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("change pin success!!!\n");
+ }else{
+ printf("change pin error, res = %d\n", res);
+ }
+ }else{
+ printf("lynq_change_pin dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_unlock_pin
+ case 6:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char puk[BUF_PIN] = {0};
+ QSER_SIM_UNBLOCK_PIN_INFO_T pt_info;
+ printf("input puk\n");
+ scanf("%s", puk);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
+
+ strncpy(pt_info.puk_value, puk, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.puk_value = %s, puk = %s\n", pt_info.puk_value, puk);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+
+ qser_sim_unblockpin = (int(*)(sim_client_handle_type h_sim, QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_unblockpin");
+ if(NULL != qser_sim_unblockpin)
+ {
+ res = qser_sim_unblockpin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("unlock pin success!!!\n");
+ }else{
+ printf("unlock pin error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_unblockpin dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_enable_pin
+ case 7:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+
+ qser_sim_enablepin = (int(*)(sim_client_handle_type h_sim, QSER_SIM_ENABLE_PIN_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_enablepin");
+ if(NULL != qser_sim_enablepin)
+ {
+ res = qser_sim_enablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin enabled!!!\n");
+ }else{
+ printf("pin enable error, res =%d\n", res);
+ }
+ }else{
+ printf("qser_sim_enablepin dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_disable_pin
+ case 8:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+
+ qser_sim_disablepin = (int(*)(sim_client_handle_type h_sim, QSER_SIM_DISABLE_PIN_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_disablepin");
+ if(NULL != qser_sim_disablepin)
+ {
+ res = qser_sim_disablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin disnabled!!!\n");
+ }else{
+ printf("pin disable error,res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_disablepin dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_get_sim_status
+ case 9:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ QSER_SIM_CARD_STATUS_INFO_T pt_info;
+
+ qser_sim_getcardstatus = (int(*)(sim_client_handle_type h_sim, QSER_SIM_SLOT_ID_TYPE_T simId, QSER_SIM_CARD_STATUS_INFO_T *pt_info))dlsym(dlHandle_sim,"qser_sim_getcardstatus");
+ if(NULL != qser_sim_getcardstatus)
+ {
+ res = qser_sim_getcardstatus(h_sim, QSER_SIM_SLOT_ID_1, &pt_info);
+ if(res == 0)
+ {
+ printf("state is %d !!!\n",pt_info.e_card_state);
+ }else{
+ printf("get imsi error,res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_getcardstatus dlsym error\n");
+ }
+ }
+ break;
+ }
+ //qser_deinit_sim
+ case 10:
+ {
+ qser_sim_client_deinit = (int(*)(sim_client_handle_type h_sim))dlsym(dlHandle_sim,"qser_sim_client_deinit");
+ if(NULL != qser_sim_client_deinit)
+ {
+ res = qser_sim_client_deinit(h_sim);
+ if(res == 0)
+ {
+ printf("sim deinit success is!!!\n");
+ }else{
+ printf("get imsi error, res = %d\n", res);
+ }
+ }else{
+ printf("qser_sim_client_deinit dlsym error\n");
+ }
+ flag_init = 0;
+ break;
+ }
+ default:
+ print_help();
+ break;
+ }
+
+ }
+
+ return 0;
+
+
+}
+
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.h
new file mode 100755
index 0000000..cdd905d
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/files/lynq-qser-sim-demo.h
@@ -0,0 +1,167 @@
+#define QSER_SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
+#define QSER_SIM_ICCID_LEN_MAX 20 /** Maximum length of ICCID data. */
+
+
+typedef enum
+{
+ E_QSER_SUCCESS = 0, /**< Success. */
+ E_QSER_ERROR_BADPARM = 4, /**< Bad parameter. */
+}E_QSER_ERROR_CODE_T;
+
+typedef enum
+{
+ QSER_SIM_SLOT_ID_1 = 0xB01, /**< Identify card in slot 1. */
+ QSER_SIM_SLOT_ID_2 = 0xB02, /**< Identify card in slot 2. */
+}QSER_SIM_SLOT_ID_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
+ QSER_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
+ QSER_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
+ QSER_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
+}QSER_SIM_APP_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SLOT_ID_TYPE_T e_slot_id; /**< Indicates the slot to be used. */
+ QSER_SIM_APP_TYPE_T e_app; /**< Indicates the type of the application. */
+}QSER_SIM_APP_ID_INFO_T; /* Type */
+
+#define QSER_SIM_PIN_LEN_MAX 8 /** Maximum length of PIN data. */
+
+typedef enum
+{
+ QSER_SIM_PIN_ID_1 = 0xB01, /**< Level 1 user verification. */
+ QSER_SIM_PIN_ID_2 = 0xB02, /**< Level 2 user verification. */
+}QSER_SIM_PIN_ID_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t pin_value_len; /**< Must be set to the number of elements in pin_value. */
+ char pin_value[QSER_SIM_PIN_LEN_MAX]; /* Value of the PIN */
+}QSER_SIM_VERIFY_PIN_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t old_pin_value_len; /**< Must be set to the number of elements in old_pin_value. */
+ char old_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the old PIN as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_CHANGE_PIN_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t puk_value_len; /**< Must be set to the number of elements in puk_value. */
+ char puk_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the PUK as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_UNBLOCK_PIN_INFO_T;
+
+/** Enables the PIN on an application. */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_ENABLE_PIN_INFO_T; //Same
+
+/** Disables the PIN of an application, */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_DISABLE_PIN_INFO_T; //Same
+
+
+typedef enum
+{
+ QSER_SIM_PERSO_FEATURE_TYPE_UNKNOWN = 0xB00, /**< Unknown personalization feature. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK = 0xB01, /**< Featurization based on 3GPP MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET = 0xB02, /**< Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER = 0xB03, /**< Featurization based on 3GPP MCC, MNC, and GID1. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE = 0xB04, /**< Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SIM = 0xB05, /**< Featurization based on the 3GPP IMSI. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1 = 0xB06, /**< Featurization based on 3GPP2 MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2 = 0xB07, /**< Featurization based on 3GPP2 IRM code. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM = 0xB08, /**< Featurization based on 3GPP2 IMSI_M. */
+}QSER_SIM_PERSO_FEATURE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_CARD_STATE_UNKNOWN = 0xB01, /**< Card state unknown. */
+ QSER_SIM_CARD_STATE_ABSENT = 0xB02, /**< Card is absent. */
+ QSER_SIM_CARD_STATE_PRESENT = 0xB03, /**< Card is present. */
+ QSER_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04, /**< Unknown error state. */
+ QSER_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05, /**< Power down. */
+ QSER_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06, /**< Poll error. */
+ QSER_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07, /**< Failed to receive an answer to reset. */
+ QSER_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08, /**< Voltage mismatch. */
+ QSER_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09, /**< Parity error. */
+ QSER_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A, /**< Card returned technical problems. */
+}QSER_SIM_CARD_STATE_TYPE_T; /**< Card state. */
+
+typedef enum
+{
+ QSER_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
+ QSER_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
+ QSER_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
+}QSER_SIM_CARD_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PROV_STATE_NONE = 0xB00, /**< Nonprovisioning. */
+ QSER_SIM_PROV_STATE_PRI = 0xB01, /**< Primary provisioning subscription. */
+ QSER_SIM_PROV_STATE_SEC = 0xB02, /**< Secondary provisioning subscription. */
+}QSER_SIM_SUBSCRIPTION_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
+ QSER_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
+ QSER_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
+ QSER_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
+ QSER_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
+ QSER_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
+ QSER_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
+ QSER_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07, /**< Personalization is permanently blocked. */
+ QSER_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
+ QSER_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
+ QSER_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. @newpage */
+}QSER_SIM_APP_STATE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PIN_STATE_UNKNOWN = 0xB01, /**< Unknown PIN state. */
+ QSER_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02, /**< PIN required, but has not been verified. */
+ QSER_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03, /**< PIN required and has been verified. */
+ QSER_SIM_PIN_STATE_DISABLED = 0xB04, /**< PIN not required. */
+ QSER_SIM_PIN_STATE_BLOCKED = 0xB05, /**< PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
+ QSER_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06, /**< PUK verification has failed too many times and is not recoverable. */
+}QSER_SIM_PIN_STATE_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SUBSCRIPTION_TYPE_T subscription; /**< Type of subscription (i.e., primary, secondary, etc.). */
+ QSER_SIM_APP_STATE_TYPE_T app_state; /**< Current state of the application. */
+ QSER_SIM_PERSO_FEATURE_TYPE_T perso_feature; /**< Current personalization state and feature enabled. */
+ uint8_t perso_retries; /**< Number of personalization retries. */
+ uint8_t perso_unblock_retries; /**< Number of personalization unblock retries. */
+ QSER_SIM_PIN_STATE_TYPE_T pin1_state; /**< Current PIN 1 state. */
+ uint8_t pin1_num_retries; /**< Number of PIN 1 retries. */
+ uint8_t puk1_num_retries; /**< Number of PUK 1 retries. */
+ QSER_SIM_PIN_STATE_TYPE_T pin2_state; /**< Current PIN 2 state. */
+ uint8_t pin2_num_retries; /**< Number of PIN 2 retries. */
+ uint8_t puk2_num_retries; /**< Number of PUK 2 retries. */
+}QSER_SIM_CARD_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_APP_INFO_T app_3gpp; /**< Stores 3GPP application information. */
+ QSER_SIM_CARD_APP_INFO_T app_3gpp2; /**< Stores 3GPP2 application information. */
+ QSER_SIM_CARD_APP_INFO_T app_isim; /**< Stores ISIM application information. */
+}QSER_SIM_CARD_ALL_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_STATE_TYPE_T e_card_state;/**< Current card and card error state. */
+ QSER_SIM_CARD_TYPE_T e_card_type; /**< Card type. */
+ QSER_SIM_CARD_ALL_APP_INFO_T card_app_info; /**< Stores all relevant application information. */
+}QSER_SIM_CARD_STATUS_INFO_T;
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/lynq-qser-sim-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/lynq-qser-sim-demo.bb
new file mode 100755
index 0000000..391a5f9
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sim-demo/lynq-qser-sim-demo.bb
@@ -0,0 +1,33 @@
+# Package summary
+SUMMARY = "lynq-qser-sim-demo"
+# License, for example MIT
+LICENSE = "MIT"
+# License checksum file is always required
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "file://lynq-qser-sim-demo.h file://lynq-qser-sim-demo.cpp"
+
+SRC-DIR = "${S}/../lynq-qser-sim-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'\"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+LOCAL_C_INCLUDES = "-I."
+
+LOCAL_LIBS = "-L. -ldl -lstdc++"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+S = "${WORKDIR}"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+
+ ${CXX} -Wall lynq-qser-sim-demo.cpp ${LOCAL_LIBS} ${LOCAL_C_INCLUDES} -o lynq-qser-sim-demo
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${S}/lynq-qser-sim-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.cpp
new file mode 100755
index 0000000..16be058
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.cpp
@@ -0,0 +1,287 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+#include"lynq-qser-sms-demo.h"
+
+
+#define SMS_BUF 64
+#define MSG_BUF 100
+
+int flag_init = 0;
+
+typedef uint32_t sim_client_handle_type;
+sms_client_handle_type ph_sms = 2022;
+sms_client_handle_type h_sms = 2022;
+
+
+int (*qser_sms_client_init)(sms_client_handle_type *ph_sms);
+int (*qser_sms_client_deinit)(sms_client_handle_type h_sms);
+int (*qser_sms_send_sms)(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info);
+int (*qser_sms_addrxmsghandler)(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr);
+int (*qser_sms_deletefromstorage)(sms_client_handle_type h_sms, QSER_sms_storage_info_t *pt_sms_storage);
+int (*qser_sms_getsmscenteraddress)(sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *set_sca_cfg);
+int (*qser_sms_setsmscenteraddress)(sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *get_sca_cfg);
+
+
+typedef struct
+{
+ int cmdIdx;
+ const char *funcName;
+} st_api_test_case;
+
+//for server test
+st_api_test_case at_api_testcases[] =
+{
+ {0, "qser_sms_client_init"},
+ {1, "qser_sms_client_deinit"},
+ {2, "qser_sms_send_sms"},
+ {3, "qser_sms_addrxmsghandler"},
+ {4, "qser_sms_deletefromstorage"},
+ {5, "qser_sms_getsmscenteraddress"},
+ {6, "qser_sms_setsmscenteraddress"},
+ {-1, NULL}
+};
+
+void print_help(void)
+{
+ int i;
+ printf("Supported test cases:\n");
+ for(i = 0; ; i++)
+ {
+ if(at_api_testcases[i].cmdIdx == -1)
+ {
+ break;
+ }
+ printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);
+ }
+}
+
+void qser_sms_handler(QSER_SMS_MsgRef msgRef, void* contextPtr) {
+ printf("[%s-%d] sms handler, msgRef->sms_data = %s\n", __FUNCTION__, __LINE__, msgRef->sms_data);
+}
+
+int main(int argc, char *argv[])
+{
+ int cmdIdx = 0;
+ int ret = 0;
+
+ const char *lynq_libpath_sms = "/lib/liblynq-qser-sms.so";
+ void *dlHandle_sms = dlopen(lynq_libpath_sms, RTLD_NOW);
+ if (dlHandle_sms == NULL)
+ {
+ printf("dlopen dlHandle_sms failed: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+
+ print_help();
+ while(1)
+ {
+ printf("\nplease input cmd index(-1 exit): ");
+ scanf("%d", &cmdIdx);
+ if(cmdIdx == -1)
+ {
+ break;
+ }
+
+ switch(cmdIdx)
+ {
+ //"qser_sms_client_init"
+ case 0:
+ {
+ if(flag_init == 1)
+ {
+ printf("init is already\n");
+ break;
+ }
+ else{
+ //int token;
+ printf("input token\n");
+ //scanf("%d", &token);
+
+ qser_sms_client_init = (int(*)(sms_client_handle_type *ph_sms))dlsym(dlHandle_sms,"qser_sms_client_init");
+ if(NULL != qser_sms_client_init)
+ {
+ ret = qser_sms_client_init(&ph_sms);
+ if(ret == 0)
+ {
+ printf("Run qser_sms_client_init\n");
+ flag_init = 1;
+ }else{
+ printf("qser_sim_client_init error\n");
+ }
+ }else{
+ printf("qser_sim_client_init dlsym error\n");
+ }
+ break;
+ }
+ }
+ //"qser_sms_client_deinit"
+ case 1:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ qser_sms_client_deinit = (int (*)(sms_client_handle_type h_sms))dlsym(dlHandle_sms,"qser_sms_client_deinit");
+ if(NULL != qser_sms_client_deinit)
+ {
+ ret = qser_sms_client_deinit(h_sms);
+ if(ret == 0)
+ {
+ printf("sms deinit success");
+ }else{
+ printf("sms deinit error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_client_deinit dlsym error\n");
+ }
+ }
+ break;
+ }
+ //"qser_sms_send_sms"
+ case 2:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char telephony_num[SMS_BUF] = {};
+ char msg[MSG_BUF] = {};
+ QSER_sms_info_t pt_sms_info;
+ sprintf(telephony_num,"10086");
+ sprintf(msg,"hello");
+ strncpy(pt_sms_info.src_addr, telephony_num, SMS_BUF);
+ strncpy(pt_sms_info.sms_data, msg, MSG_BUF);
+ pt_sms_info.format = QSER_SMS_8BIT;
+ printf("[%s,%d] src_addr=%s, telephony_num = %s\n",__FUNCTION__,__LINE__, pt_sms_info.src_addr, telephony_num);
+ printf("[%s,%d] sms_data=%s, msg = %s\n",__FUNCTION__,__LINE__, pt_sms_info.sms_data, msg);
+
+ qser_sms_send_sms = (int (*)(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info))dlsym(dlHandle_sms,"qser_sms_send_sms");
+ if(NULL != qser_sms_send_sms)
+ {
+ ret = qser_sms_send_sms(h_sms, &pt_sms_info);
+ if(ret == 0)
+ {
+ printf("send sms success");
+ }else{
+ printf("send sms error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_send_sms dlsym error\n");
+ }
+ }
+ break;
+ }
+ //"qser_sms_addrxmsghandler"
+ case 3:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+
+ qser_sms_addrxmsghandler = (int(*)(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr))dlsym(dlHandle_sms,"qser_sms_addrxmsghandler");
+
+ if(NULL != qser_sms_addrxmsghandler)
+ {
+ ret = qser_sms_addrxmsghandler(qser_sms_handler, NULL);
+ if(ret == 0)
+ {
+ printf("qser_sms_addrxmsghandler success");
+ }else{
+ printf("qser_sms_addrxmsghandler error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_addrxmsghandler dlsym error\n");
+ }
+ }
+ break;
+ }
+ //"qser_sms_deletefromstorage"
+ case 4:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ QSER_sms_storage_info_t pt_sms_storage;
+ pt_sms_storage.storage_idx = 1;
+ qser_sms_deletefromstorage = (int (*)(sms_client_handle_type h_sms, QSER_sms_storage_info_t *pt_sms_storage))dlsym(dlHandle_sms,"qser_sms_deletefromstorage");
+ if(NULL != qser_sms_deletefromstorage)
+ {
+ ret = qser_sms_deletefromstorage(h_sms, &pt_sms_storage);
+ if(ret == 0)
+ {
+ printf("ret= %d\n",ret);
+ }else{
+ printf("del sms error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_deletefromstorage dlsym error\n");
+ }
+ }
+ break;
+ }
+ //"qser_sms_getsmscenteraddress"
+ case 5:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ QSER_sms_service_center_cfg_t get_sca_cfg;
+ qser_sms_getsmscenteraddress = (int (*)(sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *get_sca_cfg))dlsym(dlHandle_sms,"qser_sms_getsmscenteraddress");
+ if(NULL != qser_sms_getsmscenteraddress)
+ {
+ ret = qser_sms_getsmscenteraddress(h_sms, &get_sca_cfg);
+ if(ret == 0)
+ {
+ printf("get smsc success,service_center_addr = %s\n",get_sca_cfg.service_center_addr);
+ }else{
+ printf("get smsc error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_getsmscenteraddress dlsym error\n");
+ }
+ }
+ break;
+ }
+ //"qser_sms_setsmscenteraddress"
+ case 6:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ QSER_sms_service_center_cfg_t set_sca_cfg;
+ strncpy(set_sca_cfg.service_center_addr, "+8613800230500", 14);
+ qser_sms_setsmscenteraddress = (int (*)(sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *set_sca_cfg))dlsym(dlHandle_sms,"qser_sms_setsmscenteraddress");
+ if(NULL != qser_sms_setsmscenteraddress)
+ {
+ ret = qser_sms_setsmscenteraddress(h_sms, &set_sca_cfg);
+ if(ret == 0)
+ {
+ printf("set smsc success");
+ }else{
+ printf("set smsc error, ret = %d\n", ret);
+ }
+ }else{
+ printf("qser_sms_setsmscenteraddress dlsym error\n");
+ }
+ }
+ break;
+ }
+ default:
+ print_help();
+ break;
+ }
+ }
+
+ return 0;
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.h
new file mode 100755
index 0000000..500d946
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/files/lynq-qser-sms-demo.h
@@ -0,0 +1,168 @@
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITMSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONNUM_LEN 64
+#define STORAGSMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef uint32_t sms_client_handle_type;
+
+/** Maximum length of an SMS. */
+#define QSER_SMS_MAX_MT_MSG_LENGTH 1440
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_ADDR_LENGTH 252
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_SCA_TYPLENGTH 3
+
+typedef enum
+{
+ QSER_SMS_7BIT = 0,
+ QSER_SMS_8BIT = 1,
+ QSER_SMS_UCS2 = 2,
+ //<2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao, <[SMS] Segment 1==> CharSet to Alpha implementation.>
+ QSER_SMS_IRA = 3,
+ //>2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao
+
+}QSER_SMS_T;
+
+typedef enum
+{
+ QSER_SMS_MO = 0, ///< SMS mobile terminated message.
+ QSER_SMS_MT = 1, ///< SMS mobile originated message.
+ QSER_SMS_BROADCAST_MT = 2 ///< SMS Cell Broadcast message.
+}QSER_SMS_TYPT;
+
+typedef enum
+{
+ QSER_SMS_STORAGTYPNONE = -1, /**< Message no need to store. */
+ QSER_SMS_STORAGTYPUIM = 0, /**< Message store to UIM. */
+ QSER_SMS_STORAGTYPNV = 1, /**< Message store to NV. */
+ QSER_SMS_STORAGTYPDB = 2, /**< Message store to NV. */
+}QSER_SMS_STORAGTYPT;
+
+typedef enum
+{
+ QSER_SMS_MESSAGMODUNKNOWN = -1, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODCDMA = 0, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODGW = 1, /**< Message type GW. */
+}QSER_SMS_MODTYPT;
+
+typedef struct
+ {
+ uint8_t total_segments; /**< The number of long short message*/
+ uint8_t seg_number; /**< Current number.*/
+ uint8_t referencnumber; /**< referencnumber.*/
+}QSER_sms_user_data_head_t;
+
+typedef struct
+{
+ /* If sms is stored, it won't parse, you need read it by yourself */
+ QSER_SMS_STORAGTYPT storage; ///specify where stored this msg
+
+ QSER_SMS_T format;
+ QSER_SMS_TYPT type;
+ char src_addr[QSER_SMS_MAX_ADDR_LENGTH]; ///Telephone number string.
+ int sms_data_len;
+ char sms_data[QSER_SMS_MAX_MT_MSG_LENGTH]; ///SMS content, data format depends on format
+ char timestamp[21]; ///Message time stamp (in text mode). string format: "yy/MM/dd,hh:mm:ss+/-TimeZone"
+ uint8_t user_data_head_valid; //indicate whether long sms. TRUE-long sms; FALSE-short message;
+ QSER_sms_user_data_head_t user_data_head; //long sms user data head info.
+ QSER_SMS_MODTYPT mode; ///specify where stored this msg cdma or gw area
+ uint32_t storage_index; ///storage index, -1 means not store
+} QSER_sms_info_t;
+
+typedef struct
+{
+ QSER_SMS_STORAGTYPT storage;
+ QSER_SMS_MODTYPT mode;
+ uint32_t storage_idx;
+} QSER_sms_storage_info_t;
+
+typedef enum
+{
+ QSER_SMS_UNKNOWN = -1,
+ QSER_SMS_DISCARD = 0x00, /* Incoming messages for this route are discarded by the WMS service without
+ notifying QMI_WMS clients */
+ QSER_SMS_STORAND_NOTIFY = 0x01, /* Incoming messages for this route are stored to the specified device
+ memory, and new message notifications */
+ QSER_SMS_TRANSFER_ONLY = 0x02, /* Incoming messages for this route are transferred to the client, and the
+ client is expected to send ACK to the network */
+ QSER_SMS_TRANSFER_AND_ACK = 0x03, /* Incoming messages for this route are transferred to the client, and ACK is
+ sent to the network */
+}QSER_SMS_RECEPTION_ACTION_TYPT;
+
+#define QSER_WMS_MESSAGLENGTH_MAX 255
+
+typedef enum
+ {
+ QSER_WMS_MESSAGCDMA = 0x00, //- 0x00 -- MESSAGCDMA -- CDMA \n
+ QSER_WMS_MESSAGGW_PP = 0x06, //- 0x06 -- MESSAGGW_PP -- GW_PP
+}QSER_WMS_MESSAGTYPE;
+
+
+typedef struct
+ {
+ QSER_WMS_MESSAGTYPE format;
+ uint32_t raw_messaglen; /**< Must be set to # of elements in raw_message */
+ uint8_t raw_message[QSER_WMS_MESSAGLENGTH_MAX]; /**< Raw message data*/
+}QSER_wms_send_raw_message_data_t;
+
+typedef enum
+{
+ QSER_WMS_TL_CAUSCODADDR_VACANT = 0x00,
+ QSER_WMS_TL_CAUSCODADDR_TRANSLATION_FAILURE = 0x01,
+ QSER_WMS_TL_CAUSCODNETWORK_RESOURCSHORTAGE = 0x02,
+ QSER_WMS_TL_CAUSCODNETWORK_FAILURE = 0x03,
+ QSER_WMS_TL_CAUSCODINVALID_TELESERVICID = 0x04,
+ QSER_WMS_TL_CAUSCODNETWORK_OTHER = 0x05,
+ QSER_WMS_TL_CAUSCODNO_PAGRESPONSE = 0x20,
+ QSER_WMS_TL_CAUSCODDEST_BUSY = 0x21,
+ QSER_WMS_TL_CAUSCODNO_ACK = 0x22,
+ QSER_WMS_TL_CAUSCODDEST_RESOURCSHORTAGE = 0x23,
+ QSER_WMS_TL_CAUSCODSMS_DELIVERY_POSTPONED = 0x24,
+ QSER_WMS_TL_CAUSCODDEST_OUT_OF_SERV = 0x25,
+ QSER_WMS_TL_CAUSCODDEST_NOT_AT_ADDR = 0x26,
+ QSER_WMS_TL_CAUSCODDEST_OTHER = 0x27,
+ QSER_WMS_TL_CAUSCODRADIO_IF_RESOURCSHORTAGE = 0x40,
+ QSER_WMS_TL_CAUSCODRADIO_IF_INCOMPATABILITY = 0x41,
+ QSER_WMS_TL_CAUSCODRADIO_IF_OTHER = 0x42,
+ QSER_WMS_TL_CAUSCODENCODING = 0x60,
+ QSER_WMS_TL_CAUSCODSMS_ORIG_DENIED = 0x61,
+ QSER_WMS_TL_CAUSCODSMS_TERM_DENIED = 0x62,
+ QSER_WMS_TL_CAUSCODSUPP_SERV_NOT_SUPP = 0x63,
+ QSER_WMS_TL_CAUSCODSMS_NOT_SUPP = 0x64,
+ QSER_WMS_TL_CAUSCODMISSING_EXPECTED_PARAM = 0x65,
+ QSER_WMS_TL_CAUSCODMISSING_MAND_PARAM = 0x66,
+ QSER_WMS_TL_CAUSCODUNRECOGNIZED_PARAM_VAL = 0x67,
+ QSER_WMS_TL_CAUSCODUNEXPECTED_PARAM_VAL = 0x68,
+ QSER_WMS_TL_CAUSCODUSER_DATA_SIZERR = 0x69,
+ QSER_WMS_TL_CAUSCODGENERAL_OTHER = 0x6A,
+}QSER_WMS_TL_CAUSCODTYPE;
+
+
+
+typedef struct
+ {
+ uint16_t messagid; /* Message ID */
+ uint8_t causcodvalid; /**< Must be set to true if causcode is being passed */
+ QSER_WMS_TL_CAUSCODTYPE causcode;
+}QSER_wms_raw_send_resp_t;
+
+typedef struct
+ {
+ char service_center_addr[QSER_SMS_MAX_ADDR_LENGTH + 1]; /**< Address of the service center.*/
+ uint8_t service_center_addr_typvalid;
+ char service_center_addr_type[QSER_SMS_MAX_SCA_TYPLENGTH + 1]; /**< 129 if the SMSC address does not start with a "+" characte;
+ 145 if the SMSC address starts with a "+" character*/
+}QSER_sms_service_center_cfg_t;
+
+typedef QSER_sms_info_t QSER_SMS_Msg_t;
+typedef QSER_sms_info_t* QSER_SMS_MsgRef;
+typedef void (*QSER_SMS_RxMsgHandlerFunc_t)(QSER_SMS_MsgRef msgRef, void* contextPtr);
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/lynq-qser-sms-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/lynq-qser-sms-demo.bb
new file mode 100755
index 0000000..45430ac
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-sms-demo/lynq-qser-sms-demo.bb
@@ -0,0 +1,33 @@
+# Package summary
+SUMMARY = "lynq-qser-sms-demo"
+# License, for example MIT
+LICENSE = "MIT"
+# License checksum file is always required
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+SRC_URI = "file://lynq-qser-sms-demo.h file://lynq-qser-sms-demo.cpp"
+
+SRC-DIR = "${S}/../lynq-qser-sim-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'\"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+LOCAL_C_INCLUDES = "-I."
+
+LOCAL_LIBS = "-L. -ldl -lstdc++"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+S = "${WORKDIR}"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+
+ ${CXX} -Wall lynq-qser-sms-demo.cpp ${LOCAL_LIBS} ${LOCAL_C_INCLUDES} -o lynq-qser-sms-demo
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${S}/lynq-qser-sms-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/uci/files/uci.patch b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/uci/files/uci.patch
index c6e4720..2787896 100644
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/uci/files/uci.patch
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/uci/files/uci.patch
@@ -1,32 +1,3 @@
-diff --git a/libuci.c b/libuci.c
-index ae4c964..dcf3e8b 100644
---- a/libuci.c
-+++ b/libuci.c
-@@ -25,7 +25,7 @@
- #include <dlfcn.h>
- #include <glob.h>
- #include "uci.h"
--
-+#include <unistd.h>
- static const char *uci_errstr[] = {
- [UCI_OK] = "Success",
- [UCI_ERR_MEM] = "Out of memory",
-@@ -174,6 +174,15 @@ uci_get_errorstr(struct uci_context *ctx, char **dest, const char *prefix)
-
- int uci_list_configs(struct uci_context *ctx, char ***list)
- {
-+ int ret;
-+ if(access("/mnt/userdata/config", 0) != 0)
-+ {
-+ ret = system("cp -R /etc/config /mnt/userdata/");
-+ if(ret!=0)
-+ {
-+ printf("uci_list_configs: cp fail\n");
-+ }
-+ }
- UCI_HANDLE_ERR(ctx);
- UCI_ASSERT(ctx, list != NULL);
- UCI_ASSERT(ctx, ctx->backend && ctx->backend->list_configs);
diff --git a/uci.h b/uci.h
index d0374f2..8ed49d9 100644
--- a/uci.h
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/LICENSE
new file mode 100644
index 0000000..605b7ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek 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 MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek 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 MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/include/libauto/lynq_autosuspend.h b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/include/libauto/lynq_autosuspend.h
new file mode 100644
index 0000000..efd1219
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/include/libauto/lynq_autosuspend.h
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct time_info_t
+{
+ long sleep_start_time;
+ long wakeup_time;
+};
+
+int lynq_autosleep_enable(void);
+int lynq_autosleep_disable(void);
+int lynq_wait_wakeup_event(long *sleep_start_time, long * wakeup_time);
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_set_lpmode(int lp_mode);
+int release_wake_lock(char *name);
+int acquire_wake_lock(int lock, char *name);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq-autosuspend.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq-autosuspend.cpp
new file mode 100644
index 0000000..54c88fd
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq-autosuspend.cpp
@@ -0,0 +1,445 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+#include "include/libauto/lynq_autosuspend.h"
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+#include <sc_bsp.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define LOG_TAG "libautosuspend"
+// #include <liblog/lynq_deflog.h>
+#include <log/log.h>
+#define SERVER_CMD_PATH "/tmp/autosuspend.cmd.server"
+#define SERVER_DATA_PATH "/tmp/autosuspend.data.server"
+// #define CLIENT_PATH "/tmp/autosuspend.client"
+static int client_sock_fd;
+static int client_data_sock_fd;
+static bool libautosuspend_inited;
+bool feedback_flag = true; //add for after sleeping once calling lynq_wailt_wakeup_event does not return sleep time
+// static bool libautosuspend_enabled;
+// static pthread_mutex_t get_feedback_mutex = PTHREAD_MUTEX_INITIALIZER;
+// static pthread_cond_t get_feedback_cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t client_fd_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t client_data_fd_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t feedback_got_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t feedback_got_cond = PTHREAD_COND_INITIALIZER;
+
+static struct time_info_t time_info_client;
+static ssize_t Read(int fd, void *ptr, size_t nbytes)
+{
+ ssize_t n;
+
+ while((n = read(fd, ptr, nbytes)) == -1)
+ {
+ //printf("READ,%d\n",fd);
+ if (errno == EINTR)
+ {
+ printf("read error eintr\n");
+ continue;
+ }
+ else if(errno == EAGAIN || errno == EWOULDBLOCK)
+ {
+ printf("read time out\n");
+ return -2;
+ }
+ else
+ {
+ printf("read error\n");
+ return -1;
+ }
+ }
+ //sleep(2);
+ //printf("READ1,%d\n", fd);
+ return n;
+}
+static ssize_t Write(int fd, const void *ptr, size_t nbytes)
+{
+ ssize_t n;
+ while((n = write(fd, ptr, nbytes)) == -1)
+ {
+ if (errno == EINTR)
+ continue;
+ else if(errno == EPIPE)
+ {
+ printf("write error epipe\n");
+ return -1;
+ }
+ else
+ return -1;
+ }
+ return n;
+}
+static int Close(int fd)
+{
+ if (Close(fd) == -1)
+ {
+ printf("Close error\n");
+ return -1;
+ }
+ return 0;
+}
+static int connect_to_server(int *cfd, char *client_path, char *server_path)
+{
+ int rc;
+ struct sockaddr_un server_sockaddr;
+ struct sockaddr_un client_sockaddr;
+ printf("Start bind and connect to the service.\n");
+ /**************************************/
+ /* Create a UNIX domain stream socket */
+ /**************************************/
+ *cfd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (*cfd == -1) {
+ printf("SOCKET ERROR ");
+ return -1;
+ }
+ /***************************************/
+ /* Set up the UNIX sockaddr structure */
+ /* by using AF_UNIX for the family and */
+ /* giving it a filepath to bind to. */
+ /* */
+ /* Unlink the file so the bind will */
+ /* succeed, then bind to that file. */
+ /***************************************/
+ client_sockaddr.sun_family = AF_UNIX;
+ strcpy(client_sockaddr.sun_path, client_path);
+
+ unlink(client_sockaddr.sun_path);
+ rc = bind(*cfd, (struct sockaddr *) &client_sockaddr, sizeof(client_sockaddr));
+ if (rc == -1){
+ printf("BIND ERROR ");
+ Close(*cfd);
+ return -1;
+ }
+
+ /***************************************/
+ /* Set up the UNIX sockaddr structure */
+ /* for the server socket and connect */
+ /* to it. */
+ /***************************************/
+ server_sockaddr.sun_family = AF_UNIX;
+
+ strcpy(server_sockaddr.sun_path, server_path);
+ rc = connect(*cfd, (struct sockaddr *) &server_sockaddr, sizeof(client_sockaddr));
+ if(rc == -1){
+ printf("CONNECT ERROR ");
+ Close(*cfd);
+ return -3;
+ }
+ return 0;
+
+}
+static void *deal_get_feedback(void *sockfd)
+{
+ int rc;
+ int client_sock = *((int *)sockfd);
+ // pthread_mutex_lock(&feedback_got_mutex);
+
+ while (1)
+ {
+ // printf("deal_get_feedback thread wait.\n");
+ // pthread_cond_wait(&get_feedback_cond,&get_feedback_mutex);
+ printf("start get feedback from the service.\n");
+ pthread_mutex_lock(&feedback_got_mutex);
+ memset(&time_info_client,0,sizeof(struct time_info_t));
+ rc = Read(client_sock,&time_info_client,sizeof(struct time_info_t));
+ if(rc == -1)
+ {
+ printf("client read wakeup_feedback struct fail.\n");
+ Close(client_sock);
+ pthread_mutex_unlock(&feedback_got_mutex);
+ break ;
+ }
+ else if(rc == -2)
+ {
+ printf("client read wakeup_feedback struct timeout.\n");
+ pthread_mutex_unlock(&feedback_got_mutex);
+ continue;
+ }
+ printf("system sleep_start timestamps : %ld ms\n",time_info_client.sleep_start_time);
+ printf("system wakeup timestamps : %ld ms\n",time_info_client.wakeup_time);
+ // pthread_cond_broadcast(&feedback_got_cond);
+ pthread_mutex_unlock(&feedback_got_mutex);
+ usleep(10000); //给libautosuspend_get_feedback函数时间进入wait,不可删除,但可以减少
+ pthread_cond_broadcast(&feedback_got_cond);
+ usleep(10000); //希望多给libautosuspend_get_feedback函数拿到锁的机会,不可删除,但可以减少
+
+ }
+
+}
+static int libautosuspend_init()
+{
+ if (libautosuspend_inited)
+ {
+ return 0;
+ }
+ printf("Start libautosuspend_init.\n");
+ char client_cmd_path[40];
+ char client_data_path[40];
+ sprintf(client_cmd_path,"/tmp/autosuspend.%d.cmd.client",(int)getpid());
+ sprintf(client_data_path,"/tmp/autosuspend.%d.data.client",(int)getpid());
+ pthread_mutex_lock(&client_fd_mutex);
+ if(connect_to_server(&client_sock_fd,client_cmd_path,SERVER_CMD_PATH) < 0)
+ {
+ printf("cmd channel connect error.\n");
+ pthread_mutex_unlock(&client_fd_mutex);
+ return -1;
+ }
+ if(connect_to_server(&client_data_sock_fd,client_data_path,SERVER_DATA_PATH) < 0)
+ {
+ printf("data channel connect error.\n");
+ pthread_mutex_unlock(&client_fd_mutex);
+ return -1;
+ }
+ pthread_t feedback_tid;
+ pthread_create(&feedback_tid,NULL,deal_get_feedback,(void*)&client_data_sock_fd);
+ pthread_detach(feedback_tid);
+ libautosuspend_inited = true;
+ pthread_mutex_unlock(&client_fd_mutex);
+
+ return 0;
+
+}
+static int send_cmd(char * value,int len)
+{
+ int rc;
+ if(value == NULL)
+ {
+ return -1;
+ }
+
+ /************************************/
+ /* Copy the data to the buffer and */
+ /* send it to the server socket. */
+ /************************************/
+ // strcpy(buf, DATA);
+ printf("Sending data...\n");
+ rc = send(client_sock_fd, value, len, 0);
+ if (rc == -1) {
+ printf("SEND ERROR ");
+ Close(client_sock_fd);
+ return -2;
+ }
+ else {
+ printf("Data sent: %s\n",value);
+ }
+ // Close(client_sock);
+ return rc;
+}
+int lynq_autosleep_enable(void)
+{
+ char value[15]="enable";
+ char res[15];
+ if(libautosuspend_init() != 0)
+ {
+ return -1;
+ }
+ // if(libautosuspend_enabled)
+ // {
+ // return 0;
+ // }
+ pthread_mutex_lock(&client_fd_mutex);
+ int rc = send_cmd(value,strlen(value));
+ if(rc < 0)
+ {
+ printf("libautosuspend send enable cmd fail.\n");
+ pthread_mutex_unlock(&client_fd_mutex);
+ return -1;
+ }
+ // if(Read(client_sock_fd,res,sizeof(res)) <= 0)
+ // {
+ // printf("libautosuspend get respond fail.\n");
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ // printf("libautosuspend get respond : %s.\n",res);
+ // if(strcmp(res,"enabled") != 0)
+ // {
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ // libautosuspend_enabled = true;
+ pthread_mutex_unlock(&client_fd_mutex);
+ return 1;
+
+}
+int lynq_autosleep_disable(void)
+{
+ char value[15]="disable";
+ char res[15];
+ if(libautosuspend_init() != 0)
+ {
+ return -1;
+ }
+ // if(!libautosuspend_enabled)
+ // {
+ // return 0;
+ // }
+ pthread_mutex_lock(&client_fd_mutex);
+ int rc = send_cmd(value,strlen(value));
+ if(rc < 0)
+ {
+ printf("libautosuspend send disable cmd fail.\n");
+ pthread_mutex_unlock(&client_fd_mutex);
+ return -1;
+ }
+ // if(Read(client_sock_fd,res,sizeof(res)) <= 0)
+ // {
+ // printf("libautosuspend get respond fail.\n");
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ // printf("libautosuspend get respond : %s.\n",res);
+ // if(strcmp(res,"disabled") != 0)
+ // {
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ // libautosuspend_enabled = false;
+ pthread_mutex_unlock(&client_fd_mutex);
+ return 1;
+}
+int libautosuspend_get_feedback(struct time_info_t *time_info)
+{
+ // char value[15]="feedback";
+ // char res[15];
+ // if(!libautosuspend_enabled)
+ // {
+ // printf("system autosuspend disabled, can not get wakeup feedback.\n");
+ // return -1;
+ // }
+ printf("start get feedback from the service.\n");
+ memset(time_info,0,sizeof(struct time_info_t));
+ // if(timeout == NULL)
+ // {
+ // printf("client set timeout for receiving wakeup_feedback: NULL.\n");
+ // }
+ // else
+ // {
+ // struct timeval recv_timeout = {(*timeout),0};
+ // pthread_mutex_lock(&client_data_fd_mutex);
+ // if(setsockopt(client_data_sock_fd,SOL_SOCKET,SO_RCVTIMEO,(char*)&recv_timeout,sizeof(struct timeval)) == -1)
+ // {
+ // printf("client set timeout for receiving wakeup_feedback: error.\n");
+ // pthread_mutex_unlock(&client_data_fd_mutex);
+ // return -1;
+ // }
+
+ // printf("client set timeout for receiving wakeup_feedback: %d s.\n",(*timeout));
+ // pthread_mutex_unlock(&client_data_fd_mutex);
+
+ // }
+ // int rc = send_cmd(value,strlen(value));
+ // if(rc < 0)
+ // {
+ // printf("libautosuspend send feedback cmd fail.\n");
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ // if(Read(client_data_sock_fd,time_info,sizeof(struct time_info_t)) <= 0)
+ // {
+ // printf("libautosuspend_get_feedback fail.\n");
+ // pthread_mutex_unlock(&client_fd_mutex);
+ // return -1;
+ // }
+ printf("libautosuspend_get_feedback wait.\n");
+ pthread_mutex_lock(&feedback_got_mutex);
+ pthread_cond_wait(&feedback_got_cond,&feedback_got_mutex);
+ memcpy(time_info,&time_info_client,sizeof(struct time_info_t));
+ printf("libautosuspend_get_feedback success.\n");
+ pthread_mutex_unlock(&feedback_got_mutex);
+ // printf("[client] system sleep_start timestamps : %ld ms\n",time_info.sleep_start_time);
+ // printf("[client] system wakeup timestamps : %ld ms\n",time_info.wakeup_time);
+ return 0;
+}
+int lynq_wait_wakeup_event(long *sleep_start_time, long * wakeup_time)
+{
+ int *socket_timeout = NULL;
+ struct time_info_t time_info;
+ int ret = 0;
+ /*add for after sleeping once calling lynq_wailt_wakeup_event does not return sleep time start*/
+ if(feedback_flag == true)
+ {
+ if(libautosuspend_init() != 0)
+ {
+ return -1;
+ }
+ }
+ feedback_flag = false;
+ /*add for after sleeping once calling lynq_wailt_wakeup_event does not return sleep time end*/
+ memset(&time_info,0,sizeof(struct time_info_t));
+ if(sleep_start_time == NULL || wakeup_time == NULL )
+ {
+ printf("lynq_wait_wakeup_event input errors.\n");
+ return -1;
+ }
+ ret=libautosuspend_get_feedback(&time_info);
+ if(ret == 0)
+ {
+ *sleep_start_time = time_info.sleep_start_time;
+ *wakeup_time = time_info.wakeup_time;
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+
+}
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int acquire_wake_lock(int lock, char *name)
+{
+ int ret;
+ printf("Get param:%s \n", name);
+ ret = sc_pm_wakelock_lock(name);
+ if (ret)
+ {
+ printf("do_wakelock failed, err:%d", ret);
+ return ret;
+ }
+ printf("do_wakelock succeed\n");
+ return ret;
+}
+int release_wake_lock(char *name)
+{
+ int ret;
+ printf("Get param:%s \n", name);
+ ret = sc_pm_wakelock_unlock(name);
+ if (ret)
+ {
+ printf("do_wakeunlock failed, err:%d", ret);
+ return ret;
+ }
+ printf("do_wakeunlock succeed\n");
+ return ret;
+}
+int lynq_set_lpmode(int lp_mode)
+{
+ int ret;
+ printf("Get param:%d \n", lp_mode);
+ ret = sc_pm_set_lp_mode(lp_mode);
+ if (ret) {
+ printf("do_set_lpmode failed, err:%d", ret);
+ exit(1);
+ }
+ printf("do_set_lpmode succeed\n");
+ return ret;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq_autosuspend.h b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq_autosuspend.h
new file mode 100644
index 0000000..efd1219
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/lynq_autosuspend.h
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct time_info_t
+{
+ long sleep_start_time;
+ long wakeup_time;
+};
+
+int lynq_autosleep_enable(void);
+int lynq_autosleep_disable(void);
+int lynq_wait_wakeup_event(long *sleep_start_time, long * wakeup_time);
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_set_lpmode(int lp_mode);
+int release_wake_lock(char *name);
+int acquire_wake_lock(int lock, char *name);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/makefile
new file mode 100644
index 0000000..b97b48c
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-autosuspend/makefile
@@ -0,0 +1,74 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=c++11 \
+ -g -Os \
+ -flto \
+ -fPIC \
+ -fpermissive \
+
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+ LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+ LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
+
+
+
+$(warning ################# lynq autosuspend API ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/libauto \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llog \
+ -lcutils \
+ -lpthread \
+ -llynq-log \
+ -lbsp \
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-autosuspend.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/LICENSE
new file mode 100644
index 0000000..cb88533
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("Mobiletek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to Mobiletek Inc. and/or its licensors. Without
+the prior written permission of Mobiletek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of Mobiletek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+Mobiletek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("Mobiletek SOFTWARE")
+RECEIVED FROM Mobiletek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. Mobiletek 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 Mobiletek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE Mobiletek 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 Mobiletek
+SOFTWARE. Mobiletek SHALL ALSO NOT BE RESPONSIBLE FOR ANY Mobiletek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND Mobiletek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE Mobiletek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT Mobiletek'S OPTION, TO REVISE OR REPLACE THE
+Mobiletek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO Mobiletek FOR SUCH Mobiletek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h
new file mode 100644
index 0000000..54b663f
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_LOCK_NUM 128
+
+#define E_READ -2
+#define E_WRITE -3
+#define E_INIT -4
+
+typedef enum
+{
+ E_QL_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu
+. */
+ E_QL_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu.
+*/
+}qser_lpm_edge_t;
+
+typedef int qser_lpm_pin_t;
+
+
+typedef struct{
+ qser_lpm_pin_t wakeupin_pin;
+ qser_lpm_edge_t wakeupin_edge;
+}qser_lpm_wakeupin_data_t;
+
+typedef struct{
+ qser_lpm_pin_t wakeupout_pin;
+ qser_lpm_edge_t wakeupout_edge;
+}qser_lpm_wakeupout_data_t;
+
+
+typedef void (*qser_lpm_Handler_t)
+(
+ qser_lpm_edge_t lpm_edge
+);
+
+typedef struct{
+ qser_lpm_wakeupin_data_t wakeupin;
+ qser_lpm_wakeupout_data_t wakeupout;
+}qser_pm_cfg_t;
+
+
+typedef struct
+{
+ char lock_name[MAX_LOCK_NUM][64];
+} LOCK_TABLE;
+
+int read_lock_table(void);
+int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg);
+int qser_lpm_deinit(void);
+int qser_autosuspend_enable(char enable);
+int qser_wakelock_create(const char *name, size_t len);
+int qser_wakelock_lock(int fd);
+int qser_wakelock_unlock(int fd);
+int qser_wakelock_destroy(int fd);
+
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
new file mode 100755
index 0000000..b6fcdea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
@@ -0,0 +1,337 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include<unistd.h>
+
+
+
+#include <lynq_autosuspend.h>
+#include "lynq-qser-autosuspend.h"
+#include "liblog/lynq_deflog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+extern int lynq_autosleep_enable(void);
+extern int lynq_autosleep_disable(void);
+extern int release_wake_lock(char *name);
+extern int acquire_wake_lock(int lock, char *name);
+
+#define USER_LOG_TAG "LYNQ_QSER_AUTOSUSPEND"
+#define FILE_LOCK_TABLE "/tmp/.lock_table"
+
+
+LOCK_TABLE lock_status;
+
+
+int file_fd;
+int first_run = 0;
+
+
+int lock_table_init(void)
+{
+ int ret;
+ int err;
+
+ file_fd = open(FILE_LOCK_TABLE, O_RDWR| O_CREAT,0777);
+ if(file_fd < 0)
+ {
+ err = errno;
+ LYINFLOG("Error open lock_table file:%s\n", strerror(errno));
+ return -err;
+ }
+ memset(&lock_status, 0, sizeof(lock_status));
+ ret = write(file_fd, (char*)&lock_status, sizeof(lock_status));
+ if(ret <= 0)
+ {
+ LYINFLOG("write fail\n");
+ close(file_fd);
+ return -1;
+ }
+ sync();
+ close(file_fd);
+ return 0;
+}
+
+
+int read_lock_table(void)
+{
+ int err;
+ int ret;
+ int i;
+ LYLOGSET(LOG_INFO);
+ LYLOGEINIT(USER_LOG_TAG);
+
+ if(access(FILE_LOCK_TABLE,0) < 0)
+ {
+ ret = lock_table_init();
+ if(ret < 0)
+ {
+ return -2;
+ }
+ }
+
+ file_fd = open(FILE_LOCK_TABLE,O_RDWR);
+ if(file_fd < 0)
+ {
+ err = errno;
+ LYINFLOG("Error open lock_table file:%s\n", strerror(errno));
+ return -2;
+ }
+
+ memset(&lock_status, 0, sizeof(lock_status));
+ lseek(file_fd,0,SEEK_SET);
+ ret = read(file_fd,(unsigned char *)&lock_status,sizeof(lock_status));
+ LYINFLOG("read ret=%d\n", ret);
+ if(ret <= 0)
+ {
+ close(file_fd);
+ return -2;
+ }
+
+ for(i=0;i<MAX_LOCK_NUM;i++)
+ {
+ if(strlen(lock_status.lock_name[i]) != 0)
+ {
+ LYINFLOG("fd: %d lock_name:%s strlen:%d\n", i, lock_status.lock_name[i], strlen(lock_status.lock_name[i]));
+ }
+ }
+
+ close(file_fd);
+ return 0;
+}
+
+
+int save_lock_table(void)
+{
+ int err;
+ int ret;
+ file_fd = open(FILE_LOCK_TABLE,O_RDWR);
+ if(file_fd < 0)
+ {
+ err = errno;
+ LYINFLOG("Error open lock_table file:%s\n", strerror(errno));
+ return -3;
+ }
+ LYINFLOG("write lock_name[0]: %s\n", lock_status.lock_name[0]);
+ ret = write(file_fd, (unsigned char *)&lock_status, sizeof(lock_status));
+ LYINFLOG("write ret=%d\n", ret);
+ if(ret <= 0)
+ {
+ LYINFLOG("write fail\n");
+ close(file_fd);
+ return -3;
+ }
+ sync();
+ close(file_fd);
+
+ return 0;
+}
+
+
+int check_lock(char *name)
+{
+ int j;
+ int num;
+ for(j=0;j<MAX_LOCK_NUM;j++)
+ {
+ if(strcmp(lock_status.lock_name[j], name) == 0)
+ {
+ num = j;
+ break;
+ }
+ }
+
+ if(j < MAX_LOCK_NUM)
+ {
+ return num;
+ }
+
+ return -1;
+}
+
+
+int add_lock(char *name)
+{
+ int ret;
+ int i = 0;
+ int num;
+ int check_flag;
+
+ LYINFLOG("name:%s\n", name);
+ ret = read_lock_table();
+ LYINFLOG("read_lock_table ret = %d\n", ret);
+ if(ret <0)
+ {
+ return ret;
+ }
+
+ check_flag = check_lock(name);
+
+ if(check_flag < 0)
+ {
+ for(i=0;i<MAX_LOCK_NUM;i++)
+ {
+ if(strlen(lock_status.lock_name[i]) == 0)
+ {
+ strcpy(lock_status.lock_name[i], name);
+ LYINFLOG("lock_name[%d] %s\n", i, lock_status.lock_name[i]);
+ break;
+ }
+ }
+ if(i == MAX_LOCK_NUM)
+ {
+ return -1;
+ }
+ else
+ {
+ num = i;
+ }
+ }
+ else
+ {
+ num = check_flag;
+ }
+
+ LYINFLOG("num = %d\n", num);
+ ret = save_lock_table();
+ if(ret < 0)
+ {
+ return ret;
+ }
+ return num;
+}
+
+int delete_lock(int fd)
+{
+ int ret;
+ int i;
+ ret = read_lock_table();
+ memset(lock_status.lock_name[fd], 0, sizeof(lock_status.lock_name[fd]));
+ ret = save_lock_table();
+ return ret;
+}
+
+int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg)
+{
+ int ret;
+ ret = system("uci set lynq_uci.lynq_autosuspend.init='1'");
+ system("uci commit");
+ if(ret != 0)
+ {
+ LYINFLOG("uci set fail");
+ }
+ ret = system("./etc/init.d/lynq-autosuspend.sh restart");
+ if(ret != 0)
+ {
+ LYINFLOG("restart service fail");
+ }
+ return ret;
+}
+
+
+int qser_lpm_deinit(void)
+{
+ int ret;
+ system("uci set lynq_uci.lynq_autosuspend.init='0'");
+ system("uci commit");
+ if(ret != 0)
+ {
+ LYINFLOG("uci set fail");
+ }
+ system("./etc/init.d/lynq-autosuspend.sh restarts");
+ if(ret != 0)
+ {
+ LYINFLOG("restart service fail");
+ }
+ return 0;
+}
+
+int qser_autosuspend_enable(char enable)
+{
+ int ret;
+ if(enable == '0')
+ {
+ ret = lynq_autosleep_disable();
+
+ }
+ else if(enable == '1')
+ {
+ ret = lynq_autosleep_enable();
+ }
+ else
+ {
+ ret = -1;
+
+ }
+ return ret;
+
+}
+
+int qser_wakelock_create(const char *name, size_t len)
+{
+ int ret;
+ if(name == NULL)
+ {
+ return -1;
+ }
+ LYINFLOG("%s\n", name);
+ ret = add_lock(name);
+ return ret;
+}
+
+int qser_wakelock_lock(int fd)
+{
+
+ int ret;
+ if(fd < 0 || fd >= MAX_LOCK_NUM)
+ {
+ return -4;
+ }
+ ret = read_lock_table();
+ ret = acquire_wake_lock( 0, lock_status.lock_name[fd]);
+ return ret;
+}
+
+int qser_wakelock_unlock(int fd)
+{
+ int ret;
+ if(fd < 0 || fd >= MAX_LOCK_NUM)
+ {
+ return -4;
+ }
+ ret = read_lock_table();
+ if(strlen(lock_status.lock_name[fd]) == 0)
+ {
+ LYINFLOG("%d is null\n", fd);
+ return -1;
+ }
+ ret = release_wake_lock(lock_status.lock_name[fd]);
+ return ret;
+}
+
+int qser_wakelock_destroy(int fd)
+{
+ int ret;
+ if(fd < 0 || fd >= MAX_LOCK_NUM)
+ {
+ return -4;
+ }
+ ret = delete_lock(fd);
+ return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/makefile
new file mode 100644
index 0000000..510b40e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/makefile
@@ -0,0 +1,67 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -fPIC \
+ -fpermissive \
+
+
+
+$(warning ################# lynq qser autosuspend API ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/ \
+ -I$(LOCAL_PATH)/ \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+ -I$(ROOT)$(includedir)/libauto/ \
+
+
+
+LOCAL_LIBS := \
+ -L. \
+ -lstdc++ \
+ -lcutils \
+ -lutils \
+ -lpthread \
+ -llynq-autosuspend \
+ -llynq-log \
+
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-qser-autosuspend.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/LICENSE b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/LICENSE
new file mode 100755
index 0000000..cb88533
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("Mobiletek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to Mobiletek Inc. and/or its licensors. Without
+the prior written permission of Mobiletek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of Mobiletek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+Mobiletek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("Mobiletek SOFTWARE")
+RECEIVED FROM Mobiletek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. Mobiletek 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 Mobiletek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE Mobiletek 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 Mobiletek
+SOFTWARE. Mobiletek SHALL ALSO NOT BE RESPONSIBLE FOR ANY Mobiletek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND Mobiletek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE Mobiletek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT Mobiletek'S OPTION, TO REVISE OR REPLACE THE
+Mobiletek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO Mobiletek FOR SUCH Mobiletek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c
new file mode 100755
index 0000000..6c1b489
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c
@@ -0,0 +1,284 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <errno.h>
+#include <fcntl.h>
+
+
+#define FILE_LOCK_TABLE "/tmp/.lock_table"
+
+void *dlHandle_wakelock;
+
+int (*qser_lpm_deinit)(void);
+int (*qser_autosuspend_enable)(char enable);
+int (*qser_wakelock_create)(const char *value, size_t len);
+int (*qser_wakelock_lock)(int fd);
+int (*qser_wakelock_unlock)(int fd);
+int (*qser_wakelock_destroy)(int fd);
+
+#define MAX_LOCK_NUM 128
+
+typedef struct
+{
+ char lock_name[MAX_LOCK_NUM][64];
+} LOCK_TABLE;
+
+void init_autosuspend_func(void)
+{
+
+ const char *lynqLibPath_WakeLock = "/lib/liblynq-qser-autosuspend.so";
+
+
+ dlHandle_wakelock = dlopen(lynqLibPath_WakeLock, RTLD_NOW);
+ if (dlHandle_wakelock == NULL)
+ {
+ printf("dlopen lynqLibPath_WakeLock failed: %s", dlerror());
+ exit(EXIT_FAILURE);
+ }
+
+ qser_lpm_deinit = (int(*)(void))dlsym(dlHandle_wakelock, "qser_lpm_deinit");
+ if (qser_lpm_deinit == NULL)
+ {
+ printf("qser_lpm_deinit not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ qser_autosuspend_enable = (int(*)(char))dlsym(dlHandle_wakelock, "qser_autosuspend_enable");
+ if (qser_autosuspend_enable == NULL)
+ {
+ printf("qser_autosuspend_enable not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ qser_wakelock_create = (int(*)(const char *value, size_t len))dlsym(dlHandle_wakelock, "qser_wakelock_create");
+ if (qser_wakelock_create == NULL)
+ {
+ printf("qser_wakelock_create not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ qser_wakelock_lock = (int(*)(int))dlsym(dlHandle_wakelock, "qser_wakelock_lock");
+ if (qser_wakelock_lock == NULL)
+ {
+ printf("qser_wakelock_lock not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ qser_wakelock_unlock = (int(*)(int))dlsym(dlHandle_wakelock, "qser_wakelock_unlock");
+ if (qser_wakelock_unlock == NULL)
+ {
+ printf("qser_wakelock_unlock not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ qser_wakelock_destroy = (int(*)(int))dlsym(dlHandle_wakelock, "qser_wakelock_destroy");
+ if (qser_wakelock_destroy == NULL)
+ {
+ printf("qser_wakelock_unlock not defined or exported in %s", lynqLibPath_WakeLock);
+ exit(EXIT_FAILURE);
+ }
+
+ dlerror(); // Clear any previous dlerror
+
+ return;
+}
+
+
+int check_lock(void)
+{
+ int err;
+ int file_fd;
+ int i;
+ int ret;
+ LOCK_TABLE lock_status;
+ file_fd = open(FILE_LOCK_TABLE,O_RDWR);
+ if(file_fd < 0)
+ {
+ err = errno;
+ printf("Error open lock_table file:%s\n", strerror(errno));
+ return -2;
+ }
+
+ memset(&lock_status, 0, sizeof(lock_status));
+ lseek(file_fd,0,SEEK_SET);
+ ret = read(file_fd,(unsigned char *)&lock_status,sizeof(lock_status));
+ for(i=0;i<128;i++)
+ {
+ if(strlen(lock_status.lock_name[i]) != 0)
+ {
+ printf("fd: %d lock_name:%s strlen:%d\n", i, lock_status.lock_name[i], strlen(lock_status.lock_name[i]));
+ }
+ }
+ if(ret <= 0)
+ {
+ return -2;
+ }
+ close(file_fd);
+ return 0;
+
+}
+
+int main(int argc,char** argv)
+{
+
+ int num;
+ int ret;
+ int len;
+ init_autosuspend_func();
+ if(argc < 2)
+ {
+ printf("wrong input format, please -h \n");
+ return -1;
+ }
+ if(strcmp(argv[1],"-h") == 0)
+ {
+ printf(" -h --help\n");
+ printf(" -i --qseq_lpm_init\n");
+ printf(" -d --qser_lpm_deinit\n");
+ printf(" -e --qser_autosuspend_enable\n");
+ printf(" -cl [wakelock name] --qser_wakelock_create \n");
+ printf(" -al [wakelock num] --qser_wakelock_lock \n");
+ printf(" -rl [wakelock num] --qser_wakelock_unlock \n");
+ printf(" -dl [wakelock num] --qser_wakelock_destroy\n");
+ printf(" -ccl --check created locks\n");
+ printf(" -cll --check lockup locks\n");
+ }
+ else if(strcmp(argv[1],"-d") == 0)
+ {
+ ret = qser_lpm_deinit();
+ if(ret != 0)
+ {
+ printf("lpm deinit fail\n");
+ }
+ else
+ {
+ printf("lpm deinit success\n");
+ }
+ }
+ else if(strcmp(argv[1],"-e") == 0)
+ {
+ char num='1';
+ ret = qser_autosuspend_enable(num);
+ if(ret != 0)
+ {
+ printf("qser_autosuspend_enable fail\n");
+ }
+ else
+ {
+ printf("qser_autosuspend_enable success\n");
+ }
+ }
+ else if(strcmp(argv[1],"-cl") == 0)
+ {
+ if(argv[2] == NULL)
+ {
+ printf("name is null\n");
+ return -1;
+ }
+ len = strlen(argv[2]);
+ printf("len =%d\n", len);
+ ret = qser_wakelock_create(argv[2], len);
+ if(ret < 0)
+ {
+ printf("wakelock create fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("wakelock create success\n");
+ printf("fd=%d\n", ret);
+ }
+ }
+ else if (strcmp(argv[1],"-al") == 0)
+ {
+ if(argv[2] == NULL)
+ {
+ printf("fd is null\n");
+ return -1;
+ }
+ num = atoi(argv[2]);
+ ret = qser_wakelock_lock(num);
+ if(ret != 0)
+ {
+ printf("wakelock lock fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("wakelock lock success\n");
+ }
+ }
+
+ else if (strcmp(argv[1],"-rl") == 0)
+ {
+ if(argv[2] == NULL)
+ {
+ printf("fd is null\n");
+ return -1;
+ }
+ num = atoi(argv[2]);
+ ret = qser_wakelock_unlock(num);
+ if(ret != 0)
+ {
+ printf("wakelock unlock fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("wakelock unlock success\n");
+ }
+ }
+ else if(strcmp(argv[1],"-dl") == 0)
+ {
+ if(argv[2] == NULL)
+ {
+ printf("fd is null\n");
+ return -1;
+ }
+ num = atoi(argv[2]);
+ ret = qser_wakelock_destroy(num);
+ if(ret != 0)
+ {
+ printf("wakelock destroy fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("wakelock destroy success\n");
+ }
+ }
+ else if(strcmp(argv[1],"-ccl") == 0)
+ {
+ int ret;
+ ret = check_lock();
+ if(ret != 0)
+ {
+ printf("check lock fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("check lock success\n");
+ }
+ }
+ else if(strcmp(argv[1],"-cll") == 0)
+ {
+ int ret;
+ ret = system("cat /sys/power/wake_lock");
+ if(ret != 0)
+ {
+ printf("check created lock fail\n");
+ }
+ }
+ else
+ {
+ printf("wrong input format, please -h \n");
+ return -1;
+ }
+ return 0;
+
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/makefile b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/makefile
new file mode 100755
index 0000000..b3638ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/makefile
@@ -0,0 +1,42 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -g -Os \
+ -flto \
+ -fpermissive \
+ -fPIC \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -DZXW
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lpthread \
+
+SOURCES = $(wildcard *.c)
+
+EXECUTABLE = lynq-qser-autosuspend-demo
+
+OBJECTS=$(SOURCES:.c=.o)
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.c
+ $(CC) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
diff --git a/update_version.sh b/update_version.sh
index 31fdb2b..3d795eb 100644
--- 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="T106CN-ZS03.V2.01.01.02P50.AP.07.03"
-LYNQ_CAP_INSIDE_VERSION="CAP.07.03"
-LYNQ_CAP_VERSION="CAP.07.03"
+LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P50.AP.07.04"
+LYNQ_CAP_INSIDE_VERSION="CAP.07.04"
+LYNQ_CAP_VERSION="CAP.07.04"
COMMIT_ID="$(git rev-parse HEAD)"
LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""