Merge "[Feature][ZXW-59][AUTOSUSPEND]fix autosuspend demo address"
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 55c9ff9..c69bf24 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
@@ -268,6 +268,7 @@
lynq-qser-data-demo \
lynq-autosuspend \
lynq-atcid \
+ lynq-qser-autosuspend-demo \
"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/LICENSE b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/LICENSE
similarity index 100%
rename from cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/LICENSE
rename to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/LICENSE
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/lynq-qser-autosuspend-demo.cpp
similarity index 66%
rename from cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c
rename to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/lynq-qser-autosuspend-demo.cpp
index 6c1b489..4c661e0 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/lynq-qser-autosuspend-demo.c
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/lynq-qser-autosuspend-demo.cpp
@@ -7,86 +7,12 @@
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
-
+#include <include/lynq-qser-autosuspend.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)
{
@@ -106,17 +32,19 @@
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(ret <= 0)
+ {
+ close(file_fd);
+ return -2;
+ }
+ for(i=0;i<MAX_LOCK_NUM;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;
@@ -128,7 +56,7 @@
int num;
int ret;
int len;
- init_autosuspend_func();
+
if(argc < 2)
{
printf("wrong input format, please -h \n");
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/makefile
new file mode 100755
index 0000000..c51d5a0
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-autosuspend-demo/files/makefile
@@ -0,0 +1,53 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -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
+
+LOCAL_CFLAGS += -Werror=format-security
+
+$(warning ################# rock ROOT: $(ROOT),includedir:$(includedir),)
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/ \
+ -I$(ROOT)$(includedir)/ \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -lpthread \
+ -llynq-qser-autosuspend \
+
+
+
+SOURCES = lynq-qser-autosuspend-demo.cpp
+
+EXECUTABLE = lynq-qser-autosuspend-demo
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ $(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
+
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
index ab8d052..d1ec3ae 100644
--- 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
@@ -1,40 +1,31 @@
-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 \
- "
+#inherit externalsrc package
+#inherit externalsrc package systemd
+DESCRIPTION = "lynq-qser-autosuspend-demo"
+LICENSE = "CLOSED"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+SRC_URI = "file://lynq-qser-autosuspend-demo.cpp \
+ file://makefile \
+"
+DEPENDS += "liblynq-qser-autosuspend"
SRC-DIR = "${S}/../lynq-qser-autosuspend-demo"
+FILES_${PN} += "${bindir}/"
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}'"
-
+S = "${WORKDIR}"
#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"
+ oe_runmake all 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}"
+ oe_runmake all 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}
+ install -m 0755 ${S}/lynq-qser-autosuspend-demo ${D}${bindir}/
}
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
deleted file mode 100755
index b3638ea..0000000
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-qser-autosuspend-demo/makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-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)