Merge "[Bug-fix][T106BUG-16]fix can not get version"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-default/lynq-default.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-default/lynq-default.bb
new file mode 100755
index 0000000..15721f0
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-default/lynq-default.bb
@@ -0,0 +1,36 @@
+inherit externalsrc package
+
+DESCRIPTION = "lynq-default demo"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "liblynq-uci"
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/lynq-default"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+ 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+EXTRA_OEMAKE += "'LYNQ_CONFIG_VERSION = ${LYNQ_CONFIG_VERSION}' \
+ 'LYNQ_CONFIG_SW_VERSION = ${LYNQ_CONFIG_SW_VERSION}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if [ "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa53hf-neon-fp-armv8" ]; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE -mhard-float -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53"
+ else
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ fi
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${S}/lynq-default ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/packagegroups/packagegroup-lynq-t106.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/packagegroups/packagegroup-lynq-t106.bb
index 0602326..bb8a778 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/packagegroups/packagegroup-lynq-t106.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/packagegroups/packagegroup-lynq-t106.bb
@@ -12,5 +12,6 @@
liblynq-network \
liblynq-sms \
liblynq-sim \
+ lynq-default \
"
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-default/lynq_default.c b/cap/zx297520v3/src/lynq/packages/apps/lynq-default/lynq_default.c
new file mode 100755
index 0000000..ba3a4b4
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-default/lynq_default.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <strings.h>
+#include<stdlib.h>
+#include <include/lynq_uci.h>
+
+
+
+//#define USER_LOG_TAG "lynq_default"
+//#define LYNQ_SW_VERSION "T800v02.MP1_MR1.01b04.01"//needs to be modified if upgrade version
+//#define LYNQ_SW_INSIDE_VERSION "T800v02.MP1_MR1.01b04.04"//only for insde check
+
+//#define GET_DATA_LEN 64
+#define BUF_LEN 258
+#define LYNQ_UCI_RO_SECTION "lynq_version"
+#define LYNQ_UCI_RO_KEY_VERSION "LYNQ_SW_VERSION"
+#define LYNQ_UCI_RO_KEY_INSIDE_VERSION "LYNQ_SW_INSIDE_VERSION"
+
+
+int main(int argc, const char *argv[])
+{
+ //char data[GET_DATA_LEN] = "";
+ char buf[BUF_LEN] = "";
+ char buf_insde[BUF_LEN] = "";
+ int ret = 0;
+
+
+ //lynq_get_value(LYNQ_UCI_RO_FILE, LYNQ_UCI_RO_SECTION, LYNQ_UCI_RO_KEY, data);
+ //if(strncmp(LYNQ_SW_VERSION, data, sizeof(LYNQ_SW_VERSION))!=0)
+ //{
+ sprintf(buf,"%s.%s.%s=%s", LYNQ_UCI_RO_FILE, LYNQ_UCI_RO_SECTION, LYNQ_UCI_RO_KEY_VERSION, LYNQ_SW_VERSION);
+ sprintf(buf_insde,"%s.%s.%s=%s", LYNQ_UCI_RO_FILE, LYNQ_UCI_RO_SECTION, LYNQ_UCI_RO_KEY_INSIDE_VERSION, LYNQ_SW_INSIDE_VERSION);
+
+ lynq_uci_set(buf);
+ lynq_uci_set(buf_insde);
+ //}
+
+ return ret;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-default/makefile b/cap/zx297520v3/src/lynq/packages/apps/lynq-default/makefile
new file mode 100755
index 0000000..0486bb7
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-default/makefile
@@ -0,0 +1,47 @@
+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 += -DLYNQ_SW_INSIDE_VERSION=\"$(LYNQ_CONFIG_VERSION)\"
+LOCAL_CFLAGS += -DLYNQ_SW_VERSION=\"$(LYNQ_CONFIG_SW_VERSION)\"
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+
+
+
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lpthread \
+ -llynq-uci \
+
+SOURCES = $(wildcard *.c)
+
+EXECUTABLE = lynq-default
+
+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)