Merge "[Bugfix][API-496][TCAM_T800_SW_0255]Modify that the voltage will not drop to 0 after hanging up/playing audio and the default power on is not initialized" into GSW
diff --git a/meta-sdk/meta-sdk.tar.gz b/meta-sdk/meta-sdk.tar.gz
index e1b1f51..17cff7f 100644
--- a/meta-sdk/meta-sdk.tar.gz
+++ b/meta-sdk/meta-sdk.tar.gz
Binary files differ
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0005-connman-build-plugin-telephon.c.patch b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0005-connman-build-plugin-telephon.c.patch
index 98ddb3a..6759f6b 100644
--- a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0005-connman-build-plugin-telephon.c.patch
+++ b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0005-connman-build-plugin-telephon.c.patch
@@ -33,7 +33,7 @@
index 740e599..38becc1 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -328,6 +328,10 @@ AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
+@@ -349,6 +349,10 @@ AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
[enable_ofono=${enableval}])
AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0007-connman-set-ccmnix-interface-to-cellular-type.patch b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0007-connman-set-ccmnix-interface-to-cellular-type.patch
index d445ed9..8c3e9f6 100644
--- a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0007-connman-set-ccmnix-interface-to-cellular-type.patch
+++ b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0007-connman-set-ccmnix-interface-to-cellular-type.patch
@@ -52,10 +52,11 @@
FILE *f;
name = connman_inet_ifname(interface->index);
-@@ -127,7 +127,12 @@ static void read_uevent(struct interface_data *interface)
+@@ -128,7 +128,12 @@ static void read_uevent(struct interface_data *interface)
if (ether_blacklisted(name)) {
interface->service_type = CONNMAN_SERVICE_TYPE_UNKNOWN;
interface->device_type = CONNMAN_DEVICE_TYPE_UNKNOWN;
+ goto out;
- } else {
+ }else if (strncmp(name, "ccmni", 5) == 0){
+ interface->service_type = CONNMAN_SERVICE_TYPE_CELLULAR;
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0033-connman-fix-ipv6-tethering_V2.patch b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0033-connman-fix-ipv6-tethering_V2.patch
index f9ac28a..f06d3c9 100644
--- a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0033-connman-fix-ipv6-tethering_V2.patch
+++ b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0033-connman-fix-ipv6-tethering_V2.patch
@@ -228,1076 +228,4 @@
+ __connman_ipv6_tethering_setup();
return TRUE;
}
-
-diff --git a/src/tethering.c b/src/tethering.c
-index e358729..c3af44d 100644
---- a/src/tethering.c
-+++ b/src/tethering.c
-@@ -48,7 +48,7 @@
-
- #define BRIDGE_NAME "tether"
-
--#define DEFAULT_MTU 1500
-+#define DEFAULT_MTU 1500
-
- static char *private_network_primary_dns = NULL;
- static char *private_network_secondary_dns = NULL;
-@@ -60,38 +60,38 @@ static DBusConnection *connection;
- static GHashTable *pn_hash;
-
- struct connman_private_network {
-- char *owner;
-- char *path;
-- guint watch;
-- DBusMessage *msg;
-- DBusMessage *reply;
-- int fd;
-- char *interface;
-- int index;
-- guint iface_watch;
-- struct connman_ippool *pool;
-- char *primary_dns;
-- char *secondary_dns;
-+ char *owner;
-+ char *path;
-+ guint watch;
-+ DBusMessage *msg;
-+ DBusMessage *reply;
-+ int fd;
-+ char *interface;
-+ int index;
-+ guint iface_watch;
-+ struct connman_ippool *pool;
-+ char *primary_dns;
-+ char *secondary_dns;
- };
-
- static void radvd_onoff(bool onoff)
- {
-- if(onoff){
-- system("radvd -C /var/lib/connman/radvd.conf");
-- }else{
-- system("killall radvd");
-- }
-+ if(onoff){
-+ system("radvd -C /var/lib/connman/radvd.conf");
-+ }else{
-+ system("killall radvd");
-+ }
- }
-
- static int write_radvd_conf(char *prefix, int prefix_len,char *dnsaddr)
- {
-- FILE *fp=NULL;
-- fp=fopen("/var/lib/connman/radvd.conf","w");
-- if(fp==NULL)
-- return -1;
-- /*
-- interface tether
-- {
-+ FILE *fp=NULL;
-+ fp=fopen("/var/lib/connman/radvd.conf","w");
-+ if(fp==NULL)
-+ return -1;
-+ /*
-+ interface tether
-+ {
- AdvSendAdvert on;
- MinRtrAdvInterval 3;
- MaxRtrAdvInterval 5;
-@@ -105,26 +105,26 @@ static int write_radvd_conf(char *prefix, int prefix_len,char *dnsaddr)
- RDNSS 2409:894c:c36:54a3::bb{
- AdvRDNSSLifetime 3600;
- };
-- };
-- */
-- fprintf(fp,"interface %s\n",BRIDGE_NAME);
-- fprintf(fp,"{\n");
-- fprintf(fp," AdvSendAdvert on;\n");
-- fprintf(fp," MinRtrAdvInterval 3;\n");
-- fprintf(fp," MaxRtrAdvInterval 5;\n");
-- fprintf(fp," AdvManagedFlag off;\n");
-- fprintf(fp," AdvOtherConfigFlag off;\n");
-- fprintf(fp," AdvDefaultPreference high;\n");
-- fprintf(fp," prefix %s/%d{\n",prefix,prefix_len);
-- fprintf(fp," AdvValidLifetime 3600;\n");
-- fprintf(fp," AdvPreferredLifetime 3600;\n");
-- fprintf(fp," };\n");
-- fprintf(fp," RDNSS %s{\n",dnsaddr);
-- fprintf(fp," AdvRDNSSLifetime 3600;\n");
-- fprintf(fp," };\n");
-- fprintf(fp,"};\n");
-- fclose(fp);
-- return 0;
-+ };
-+ */
-+ fprintf(fp,"interface %s\n",BRIDGE_NAME);
-+ fprintf(fp,"{\n");
-+ fprintf(fp," AdvSendAdvert on;\n");
-+ fprintf(fp," MinRtrAdvInterval 3;\n");
-+ fprintf(fp," MaxRtrAdvInterval 5;\n");
-+ fprintf(fp," AdvManagedFlag off;\n");
-+ fprintf(fp," AdvOtherConfigFlag off;\n");
-+ fprintf(fp," AdvDefaultPreference high;\n");
-+ fprintf(fp," prefix %s/%d{\n",prefix,prefix_len);
-+ fprintf(fp," AdvValidLifetime 3600;\n");
-+ fprintf(fp," AdvPreferredLifetime 3600;\n");
-+ fprintf(fp," };\n");
-+ fprintf(fp," RDNSS %s{\n",dnsaddr);
-+ fprintf(fp," AdvRDNSSLifetime 3600;\n");
-+ fprintf(fp," };\n");
-+ fprintf(fp,"};\n");
-+ fclose(fp);
-+ return 0;
- }
- bool writeToFile(const char* filename, const char* value) {
- int fd = open(filename, O_WRONLY);
-@@ -143,534 +143,539 @@ bool writeToFile(const char* filename, const char* value) {
-
- int __connman_ipv6_tethering_setup()
- {
-- if(tethering_enabled && get_pdnstatus_is_connected())
-- {
-- radvd_onoff(false);
-- char prefix[INET6_ADDRSTRLEN + 1];
-- int prefix_len=0;
-- int index;
-- struct in6_addr src;
-- char addr_str[INET6_ADDRSTRLEN + 1];
-- index = connman_inet_ifindex(BRIDGE_NAME);
-- int ret = __connman_inet_get_interface_ll_address(index,AF_INET6,&src);
-- if(ret<0){
-- DBG("get interface link local address fail");
-- return -1;
-- }
-- inet_ntop(AF_INET6, &src, addr_str, INET6_ADDRSTRLEN);
-- DBG("ret %d address %s",ret,addr_str);
--
-- ret = get_ipv6_prefix_address(prefix,&prefix_len);
-- DBG("ret %d prefix %s %d",ret,prefix,prefix_len);
-- if(ret<0){
-- DBG("get interface prefix fail");
-- return -1;
-- }
-- //enable forwarding
-- writeToFile("/proc/sys/net/ipv6/conf/all/forwarding","1");
-- //set tether ip address
-- writeToFile("/proc/sys/net/ipv6/conf/tether/accept_ra","0");
-- char buffer[256];
-- sprintf(buffer,"ip -6 addr add %sbb/%d dev tether",prefix,prefix_len);
-- __connman_inet_add_fwmark_rule(1030, AF_INET6, 0);
-- system(buffer);
-- //write radvd conf
-- write_radvd_conf(prefix,prefix_len,addr_str);
-- //enable radvd
-- radvd_onoff(true);
-- }else{
-- radvd_onoff(false);
-- writeToFile("/proc/sys/net/ipv6/conf/all/forwarding","0");
-- __connman_inet_del_fwmark_rule(1030, AF_INET6, 0);
-- }
-+ int index;
-+ index = connman_inet_ifindex(BRIDGE_NAME);
-+ int table_num=1000+index;
-+
-+ if(tethering_enabled && get_pdnstatus_is_connected())
-+ {
-+ radvd_onoff(false);
-+ char prefix[INET6_ADDRSTRLEN + 1];
-+ int prefix_len=0;
-+
-+ struct in6_addr src;
-+ char addr_str[INET6_ADDRSTRLEN + 1];
-+
-+ int ret = __connman_inet_get_interface_ll_address(index,AF_INET6,&src);
-+ if(ret<0){
-+ DBG("get interface link local address fail");
-+ return -1;
-+ }
-+ inet_ntop(AF_INET6, &src, addr_str, INET6_ADDRSTRLEN);
-+ DBG("ret %d address %s",ret,addr_str);
-+
-+ ret = get_ipv6_prefix_address(prefix,&prefix_len);
-+ DBG("ret %d prefix %s %d",ret,prefix,prefix_len);
-+ if(ret<0){
-+ DBG("get interface prefix fail");
-+ return -1;
-+ }
-+ //enable forwarding
-+ writeToFile("/proc/sys/net/ipv6/conf/all/forwarding","1");
-+ //set tether ip address
-+ writeToFile("/proc/sys/net/ipv6/conf/tether/accept_ra","0");
-+ char buffer[256];
-+ sprintf(buffer,"ip -6 addr add %sbb/%d dev tether",prefix,prefix_len);
-+
-+ __connman_inet_add_fwmark_rule(table_num, AF_INET6, 0);
-+ system(buffer);
-+ //write radvd conf
-+ write_radvd_conf(prefix,prefix_len,addr_str);
-+ //enable radvd
-+ radvd_onoff(true);
-+ }else{
-+ radvd_onoff(false);
-+ writeToFile("/proc/sys/net/ipv6/conf/all/forwarding","0");
-+ __connman_inet_del_fwmark_rule(table_num, AF_INET6, 0);
-+ }
- }
-
-
-
- const char *__connman_tethering_get_bridge(void)
- {
-- int sk, err;
-- unsigned long args[3];
--
-- sk = socket(AF_INET, SOCK_STREAM, 0);
-- if (sk < 0)
-- return NULL;
--
-- args[0] = BRCTL_GET_VERSION;
-- args[1] = args[2] = 0;
-- err = ioctl(sk, SIOCGIFBR, &args);
-- close(sk);
-- if (err == -1) {
-- connman_error("Missing support for 802.1d ethernet bridging");
-- return NULL;
-- }
--
-- return BRIDGE_NAME;
-+ int sk, err;
-+ unsigned long args[3];
-+
-+ sk = socket(AF_INET, SOCK_STREAM, 0);
-+ if (sk < 0)
-+ return NULL;
-+
-+ args[0] = BRCTL_GET_VERSION;
-+ args[1] = args[2] = 0;
-+ err = ioctl(sk, SIOCGIFBR, &args);
-+ close(sk);
-+ if (err == -1) {
-+ connman_error("Missing support for 802.1d ethernet bridging");
-+ return NULL;
-+ }
-+
-+ return BRIDGE_NAME;
- }
-
- static void dhcp_server_debug(const char *str, void *data)
- {
-- connman_info("%s: %s\n", (const char *) data, str);
-+ connman_info("%s: %s\n", (const char *) data, str);
- }
-
- static void dhcp_server_error(GDHCPServerError error)
- {
-- switch (error) {
-- case G_DHCP_SERVER_ERROR_NONE:
-- connman_error("OK");
-- break;
-- case G_DHCP_SERVER_ERROR_INTERFACE_UNAVAILABLE:
-- connman_error("Interface unavailable");
-- break;
-- case G_DHCP_SERVER_ERROR_INTERFACE_IN_USE:
-- connman_error("Interface in use");
-- break;
-- case G_DHCP_SERVER_ERROR_INTERFACE_DOWN:
-- connman_error("Interface down");
-- break;
-- case G_DHCP_SERVER_ERROR_NOMEM:
-- connman_error("No memory");
-- break;
-- case G_DHCP_SERVER_ERROR_INVALID_INDEX:
-- connman_error("Invalid index");
-- break;
-- case G_DHCP_SERVER_ERROR_INVALID_OPTION:
-- connman_error("Invalid option");
-- break;
-- case G_DHCP_SERVER_ERROR_IP_ADDRESS_INVALID:
-- connman_error("Invalid address");
-- break;
-- }
-+ switch (error) {
-+ case G_DHCP_SERVER_ERROR_NONE:
-+ connman_error("OK");
-+ break;
-+ case G_DHCP_SERVER_ERROR_INTERFACE_UNAVAILABLE:
-+ connman_error("Interface unavailable");
-+ break;
-+ case G_DHCP_SERVER_ERROR_INTERFACE_IN_USE:
-+ connman_error("Interface in use");
-+ break;
-+ case G_DHCP_SERVER_ERROR_INTERFACE_DOWN:
-+ connman_error("Interface down");
-+ break;
-+ case G_DHCP_SERVER_ERROR_NOMEM:
-+ connman_error("No memory");
-+ break;
-+ case G_DHCP_SERVER_ERROR_INVALID_INDEX:
-+ connman_error("Invalid index");
-+ break;
-+ case G_DHCP_SERVER_ERROR_INVALID_OPTION:
-+ connman_error("Invalid option");
-+ break;
-+ case G_DHCP_SERVER_ERROR_IP_ADDRESS_INVALID:
-+ connman_error("Invalid address");
-+ break;
-+ }
- }
-
- static GDHCPServer *dhcp_server_start(const char *bridge,
-- const char *router, const char *subnet,
-- const char *start_ip, const char *end_ip,
-- unsigned int lease_time, const char *dns)
-+ const char *router, const char *subnet,
-+ const char *start_ip, const char *end_ip,
-+ unsigned int lease_time, const char *dns)
- {
-- GDHCPServerError error;
-- GDHCPServer *dhcp_server;
-- int index;
-+ GDHCPServerError error;
-+ GDHCPServer *dhcp_server;
-+ int index;
-
-- DBG("");
-+ DBG("");
-
-- index = connman_inet_ifindex(bridge);
-- if (index < 0)
-- return NULL;
-+ index = connman_inet_ifindex(bridge);
-+ if (index < 0)
-+ return NULL;
-
-- dhcp_server = g_dhcp_server_new(G_DHCP_IPV4, index, &error);
-- if (!dhcp_server) {
-- dhcp_server_error(error);
-- return NULL;
-- }
-+ dhcp_server = g_dhcp_server_new(G_DHCP_IPV4, index, &error);
-+ if (!dhcp_server) {
-+ dhcp_server_error(error);
-+ return NULL;
-+ }
-
-- g_dhcp_server_set_debug(dhcp_server, dhcp_server_debug, "DHCP server");
-+ g_dhcp_server_set_debug(dhcp_server, dhcp_server_debug, "DHCP server");
-
-- g_dhcp_server_set_lease_time(dhcp_server, lease_time);
-- g_dhcp_server_set_option(dhcp_server, G_DHCP_SUBNET, subnet);
-- g_dhcp_server_set_option(dhcp_server, G_DHCP_ROUTER, router);
-- g_dhcp_server_set_option(dhcp_server, G_DHCP_DNS_SERVER, dns);
-- g_dhcp_server_set_ip_range(dhcp_server, start_ip, end_ip);
-+ g_dhcp_server_set_lease_time(dhcp_server, lease_time);
-+ g_dhcp_server_set_option(dhcp_server, G_DHCP_SUBNET, subnet);
-+ g_dhcp_server_set_option(dhcp_server, G_DHCP_ROUTER, router);
-+ g_dhcp_server_set_option(dhcp_server, G_DHCP_DNS_SERVER, dns);
-+ g_dhcp_server_set_ip_range(dhcp_server, start_ip, end_ip);
-
-- g_dhcp_server_start(dhcp_server);
-+ g_dhcp_server_start(dhcp_server);
-
-- return dhcp_server;
-+ return dhcp_server;
- }
-
- static void dhcp_server_stop(GDHCPServer *server)
- {
-- if (!server)
-- return;
-+ if (!server)
-+ return;
-
-- g_dhcp_server_unref(server);
-+ g_dhcp_server_unref(server);
- }
-
- static void tethering_restart(struct connman_ippool *pool, void *user_data)
- {
-- DBG("pool %p", pool);
-- __connman_tethering_set_disabled();
-- __connman_tethering_set_enabled();
-+ DBG("pool %p", pool);
-+ __connman_tethering_set_disabled();
-+ __connman_tethering_set_enabled();
- }
-
- int __connman_tethering_set_enabled(void)
- {
-- int index;
-- int err;
-- const char *gateway;
-- const char *broadcast;
-- const char *subnet_mask;
-- const char *start_ip;
-- const char *end_ip;
-- const char *dns;
-- unsigned char prefixlen;
-- char **ns;
--
-- DBG("enabled %d", tethering_enabled + 1);
--
-- if (__sync_fetch_and_add(&tethering_enabled, 1) != 0)
-- return 0;
--
-- err = __connman_bridge_create(BRIDGE_NAME);
-- if (err < 0) {
-- __sync_fetch_and_sub(&tethering_enabled, 1);
-- return -EOPNOTSUPP;
-- }
--
-- index = connman_inet_ifindex(BRIDGE_NAME);
-- dhcp_ippool = __connman_ippool_create(index, 2, 252,
-- tethering_restart, NULL);
-- if (!dhcp_ippool) {
-- connman_error("Fail to create IP pool");
-- __connman_bridge_remove(BRIDGE_NAME);
-- __sync_fetch_and_sub(&tethering_enabled, 1);
-- return -EADDRNOTAVAIL;
-- }
--
-- gateway = __connman_ippool_get_gateway(dhcp_ippool);
-- broadcast = __connman_ippool_get_broadcast(dhcp_ippool);
-- subnet_mask = __connman_ippool_get_subnet_mask(dhcp_ippool);
-- start_ip = __connman_ippool_get_start_ip(dhcp_ippool);
-- end_ip = __connman_ippool_get_end_ip(dhcp_ippool);
--
-- err = __connman_bridge_enable(BRIDGE_NAME, gateway,
-- connman_ipaddress_calc_netmask_len(subnet_mask),
-- broadcast);
-- if (err < 0 && err != -EALREADY) {
-- __connman_ippool_unref(dhcp_ippool);
-- __connman_bridge_remove(BRIDGE_NAME);
-- __sync_fetch_and_sub(&tethering_enabled, 1);
-- return -EADDRNOTAVAIL;
-- }
--
-- ns = connman_setting_get_string_list("FallbackNameservers");
-- if (ns) {
-- if (ns[0]) {
-- g_free(private_network_primary_dns);
-- private_network_primary_dns = g_strdup(ns[0]);
-- }
-- if (ns[1]) {
-- g_free(private_network_secondary_dns);
-- private_network_secondary_dns = g_strdup(ns[1]);
-- }
--
-- DBG("Fallback ns primary %s secondary %s",
-- private_network_primary_dns,
-- private_network_secondary_dns);
-- }
--
-- dns = gateway;
-- if (__connman_dnsproxy_add_listener(index) < 0) {
-- connman_error("Can't add listener %s to DNS proxy",
-- BRIDGE_NAME);
-- dns = private_network_primary_dns;
-- DBG("Serving %s nameserver to clients", dns);
-- }
--
-- tethering_dhcp_server = dhcp_server_start(BRIDGE_NAME,
-- gateway, subnet_mask,
-- start_ip, end_ip,
-- 24 * 3600, dns);
-- if (!tethering_dhcp_server) {
-- __connman_bridge_disable(BRIDGE_NAME);
-- __connman_ippool_unref(dhcp_ippool);
-- __connman_bridge_remove(BRIDGE_NAME);
-- __sync_fetch_and_sub(&tethering_enabled, 1);
-- return -EOPNOTSUPP;
-- }
--
-- prefixlen = connman_ipaddress_calc_netmask_len(subnet_mask);
-- err = __connman_nat_enable(BRIDGE_NAME, start_ip, prefixlen);
-- if (err < 0) {
-- connman_error("Cannot enable NAT %d/%s", err, strerror(-err));
-- dhcp_server_stop(tethering_dhcp_server);
-- __connman_bridge_disable(BRIDGE_NAME);
-- __connman_ippool_unref(dhcp_ippool);
-- __connman_bridge_remove(BRIDGE_NAME);
-- __sync_fetch_and_sub(&tethering_enabled, 1);
-- return -EOPNOTSUPP;
-- }
-+ int index;
-+ int err;
-+ const char *gateway;
-+ const char *broadcast;
-+ const char *subnet_mask;
-+ const char *start_ip;
-+ const char *end_ip;
-+ const char *dns;
-+ unsigned char prefixlen;
-+ char **ns;
-+
-+ DBG("enabled %d", tethering_enabled + 1);
-+
-+ if (__sync_fetch_and_add(&tethering_enabled, 1) != 0)
-+ return 0;
-+
-+ err = __connman_bridge_create(BRIDGE_NAME);
-+ if (err < 0) {
-+ __sync_fetch_and_sub(&tethering_enabled, 1);
-+ return -EOPNOTSUPP;
-+ }
-+
-+ index = connman_inet_ifindex(BRIDGE_NAME);
-+ dhcp_ippool = __connman_ippool_create(index, 2, 252,
-+ tethering_restart, NULL);
-+ if (!dhcp_ippool) {
-+ connman_error("Fail to create IP pool");
-+ __connman_bridge_remove(BRIDGE_NAME);
-+ __sync_fetch_and_sub(&tethering_enabled, 1);
-+ return -EADDRNOTAVAIL;
-+ }
-+
-+ gateway = __connman_ippool_get_gateway(dhcp_ippool);
-+ broadcast = __connman_ippool_get_broadcast(dhcp_ippool);
-+ subnet_mask = __connman_ippool_get_subnet_mask(dhcp_ippool);
-+ start_ip = __connman_ippool_get_start_ip(dhcp_ippool);
-+ end_ip = __connman_ippool_get_end_ip(dhcp_ippool);
-+
-+ err = __connman_bridge_enable(BRIDGE_NAME, gateway,
-+ connman_ipaddress_calc_netmask_len(subnet_mask),
-+ broadcast);
-+ if (err < 0 && err != -EALREADY) {
-+ __connman_ippool_unref(dhcp_ippool);
-+ __connman_bridge_remove(BRIDGE_NAME);
-+ __sync_fetch_and_sub(&tethering_enabled, 1);
-+ return -EADDRNOTAVAIL;
-+ }
-+
-+ ns = connman_setting_get_string_list("FallbackNameservers");
-+ if (ns) {
-+ if (ns[0]) {
-+ g_free(private_network_primary_dns);
-+ private_network_primary_dns = g_strdup(ns[0]);
-+ }
-+ if (ns[1]) {
-+ g_free(private_network_secondary_dns);
-+ private_network_secondary_dns = g_strdup(ns[1]);
-+ }
-+
-+ DBG("Fallback ns primary %s secondary %s",
-+ private_network_primary_dns,
-+ private_network_secondary_dns);
-+ }
-+
-+ dns = gateway;
-+ if (__connman_dnsproxy_add_listener(index) < 0) {
-+ connman_error("Can't add listener %s to DNS proxy",
-+ BRIDGE_NAME);
-+ dns = private_network_primary_dns;
-+ DBG("Serving %s nameserver to clients", dns);
-+ }
-+
-+ tethering_dhcp_server = dhcp_server_start(BRIDGE_NAME,
-+ gateway, subnet_mask,
-+ start_ip, end_ip,
-+ 24 * 3600, dns);
-+ if (!tethering_dhcp_server) {
-+ __connman_bridge_disable(BRIDGE_NAME);
-+ __connman_ippool_unref(dhcp_ippool);
-+ __connman_bridge_remove(BRIDGE_NAME);
-+ __sync_fetch_and_sub(&tethering_enabled, 1);
-+ return -EOPNOTSUPP;
-+ }
-+
-+ prefixlen = connman_ipaddress_calc_netmask_len(subnet_mask);
-+ err = __connman_nat_enable(BRIDGE_NAME, start_ip, prefixlen);
-+ if (err < 0) {
-+ connman_error("Cannot enable NAT %d/%s", err, strerror(-err));
-+ dhcp_server_stop(tethering_dhcp_server);
-+ __connman_bridge_disable(BRIDGE_NAME);
-+ __connman_ippool_unref(dhcp_ippool);
-+ __connman_bridge_remove(BRIDGE_NAME);
-+ __sync_fetch_and_sub(&tethering_enabled, 1);
-+ return -EOPNOTSUPP;
-+ }
- #if 0
-- err = __connman_ipv6pd_setup(BRIDGE_NAME);
-- if (err < 0 && err != -EINPROGRESS)
-- DBG("Cannot setup IPv6 prefix delegation %d/%s", err,
-- strerror(-err));
-+ err = __connman_ipv6pd_setup(BRIDGE_NAME);
-+ if (err < 0 && err != -EINPROGRESS)
-+ DBG("Cannot setup IPv6 prefix delegation %d/%s", err,
-+ strerror(-err));
- #endif
-- __connman_ipv6_tethering_setup();
-+ __connman_ipv6_tethering_setup();
-
-- DBG("tethering started");
-+ DBG("tethering started");
-
-- return 0;
-+ return 0;
- }
-
- void __connman_tethering_set_disabled(void)
- {
-- int index;
-+ int index;
-
-- DBG("enabled %d", tethering_enabled - 1);
-+ DBG("enabled %d", tethering_enabled - 1);
-
-- if (__sync_fetch_and_sub(&tethering_enabled, 1) != 1)
-- return;
-+ if (__sync_fetch_and_sub(&tethering_enabled, 1) != 1)
-+ return;
-
-- __connman_ipv6pd_cleanup();
-+ __connman_ipv6pd_cleanup();
-
-- index = connman_inet_ifindex(BRIDGE_NAME);
-- __connman_dnsproxy_remove_listener(index);
-+ index = connman_inet_ifindex(BRIDGE_NAME);
-+ __connman_dnsproxy_remove_listener(index);
-
-- __connman_nat_disable(BRIDGE_NAME);
-+ __connman_nat_disable(BRIDGE_NAME);
-
-- dhcp_server_stop(tethering_dhcp_server);
-+ dhcp_server_stop(tethering_dhcp_server);
-
-- tethering_dhcp_server = NULL;
-+ tethering_dhcp_server = NULL;
-
-- __connman_bridge_disable(BRIDGE_NAME);
-+ __connman_bridge_disable(BRIDGE_NAME);
-
-- __connman_ippool_unref(dhcp_ippool);
-+ __connman_ippool_unref(dhcp_ippool);
-
-- __connman_bridge_remove(BRIDGE_NAME);
-+ __connman_bridge_remove(BRIDGE_NAME);
-
-- g_free(private_network_primary_dns);
-- private_network_primary_dns = NULL;
-- g_free(private_network_secondary_dns);
-- private_network_secondary_dns = NULL;
-- __connman_ipv6_tethering_setup();
-+ g_free(private_network_primary_dns);
-+ private_network_primary_dns = NULL;
-+ g_free(private_network_secondary_dns);
-+ private_network_secondary_dns = NULL;
-+ __connman_ipv6_tethering_setup();
-
-- DBG("tethering stopped");
-+ DBG("tethering stopped");
- }
-
- static void setup_tun_interface(unsigned int flags, unsigned change,
-- void *data)
-+ void *data)
- {
-- struct connman_private_network *pn = data;
-- unsigned char prefixlen;
-- DBusMessageIter array, dict;
-- const char *server_ip;
-- const char *peer_ip;
-- const char *subnet_mask;
-- int err;
--
-- DBG("index %d flags %d change %d", pn->index, flags, change);
--
-- if (flags & IFF_UP)
-- return;
--
-- subnet_mask = __connman_ippool_get_subnet_mask(pn->pool);
-- server_ip = __connman_ippool_get_start_ip(pn->pool);
-- peer_ip = __connman_ippool_get_end_ip(pn->pool);
-- prefixlen = connman_ipaddress_calc_netmask_len(subnet_mask);
--
-- if ((__connman_inet_modify_address(RTM_NEWADDR,
-- NLM_F_REPLACE | NLM_F_ACK, pn->index, AF_INET,
-- server_ip, peer_ip, prefixlen, NULL)) < 0) {
-- DBG("address setting failed");
-- return;
-- }
-+ struct connman_private_network *pn = data;
-+ unsigned char prefixlen;
-+ DBusMessageIter array, dict;
-+ const char *server_ip;
-+ const char *peer_ip;
-+ const char *subnet_mask;
-+ int err;
-+
-+ DBG("index %d flags %d change %d", pn->index, flags, change);
-+
-+ if (flags & IFF_UP)
-+ return;
-+
-+ subnet_mask = __connman_ippool_get_subnet_mask(pn->pool);
-+ server_ip = __connman_ippool_get_start_ip(pn->pool);
-+ peer_ip = __connman_ippool_get_end_ip(pn->pool);
-+ prefixlen = connman_ipaddress_calc_netmask_len(subnet_mask);
-+
-+ if ((__connman_inet_modify_address(RTM_NEWADDR,
-+ NLM_F_REPLACE | NLM_F_ACK, pn->index, AF_INET,
-+ server_ip, peer_ip, prefixlen, NULL)) < 0) {
-+ DBG("address setting failed");
-+ return;
-+ }
-
-- connman_inet_ifup(pn->index);
-+ connman_inet_ifup(pn->index);
-
-- err = __connman_nat_enable(BRIDGE_NAME, server_ip, prefixlen);
-- if (err < 0) {
-- connman_error("failed to enable NAT");
-- goto error;
-- }
-+ err = __connman_nat_enable(BRIDGE_NAME, server_ip, prefixlen);
-+ if (err < 0) {
-+ connman_error("failed to enable NAT");
-+ goto error;
-+ }
-
-- dbus_message_iter_init_append(pn->reply, &array);
-+ dbus_message_iter_init_append(pn->reply, &array);
-
-- dbus_message_iter_append_basic(&array, DBUS_TYPE_OBJECT_PATH,
-- &pn->path);
-+ dbus_message_iter_append_basic(&array, DBUS_TYPE_OBJECT_PATH,
-+ &pn->path);
-
-- connman_dbus_dict_open(&array, &dict);
-+ connman_dbus_dict_open(&array, &dict);
-
-- connman_dbus_dict_append_basic(&dict, "ServerIPv4",
-- DBUS_TYPE_STRING, &server_ip);
-- connman_dbus_dict_append_basic(&dict, "PeerIPv4",
-- DBUS_TYPE_STRING, &peer_ip);
-- if (pn->primary_dns)
-- connman_dbus_dict_append_basic(&dict, "PrimaryDNS",
-- DBUS_TYPE_STRING, &pn->primary_dns);
-+ connman_dbus_dict_append_basic(&dict, "ServerIPv4",
-+ DBUS_TYPE_STRING, &server_ip);
-+ connman_dbus_dict_append_basic(&dict, "PeerIPv4",
-+ DBUS_TYPE_STRING, &peer_ip);
-+ if (pn->primary_dns)
-+ connman_dbus_dict_append_basic(&dict, "PrimaryDNS",
-+ DBUS_TYPE_STRING, &pn->primary_dns);
-
-- if (pn->secondary_dns)
-- connman_dbus_dict_append_basic(&dict, "SecondaryDNS",
-- DBUS_TYPE_STRING, &pn->secondary_dns);
-+ if (pn->secondary_dns)
-+ connman_dbus_dict_append_basic(&dict, "SecondaryDNS",
-+ DBUS_TYPE_STRING, &pn->secondary_dns);
-
-- connman_dbus_dict_close(&array, &dict);
-+ connman_dbus_dict_close(&array, &dict);
-
-- dbus_message_iter_append_basic(&array, DBUS_TYPE_UNIX_FD, &pn->fd);
-+ dbus_message_iter_append_basic(&array, DBUS_TYPE_UNIX_FD, &pn->fd);
-
-- g_dbus_send_message(connection, pn->reply);
-+ g_dbus_send_message(connection, pn->reply);
-
-- return;
-+ return;
-
- error:
-- pn->reply = __connman_error_failed(pn->msg, -err);
-- g_dbus_send_message(connection, pn->reply);
-+ pn->reply = __connman_error_failed(pn->msg, -err);
-+ g_dbus_send_message(connection, pn->reply);
-
-- g_hash_table_remove(pn_hash, pn->path);
-+ g_hash_table_remove(pn_hash, pn->path);
- }
-
- static void remove_private_network(gpointer user_data)
- {
-- struct connman_private_network *pn = user_data;
-+ struct connman_private_network *pn = user_data;
-
-- __connman_nat_disable(BRIDGE_NAME);
-- connman_rtnl_remove_watch(pn->iface_watch);
-- __connman_ippool_unref(pn->pool);
-+ __connman_nat_disable(BRIDGE_NAME);
-+ connman_rtnl_remove_watch(pn->iface_watch);
-+ __connman_ippool_unref(pn->pool);
-
-- if (pn->watch > 0) {
-- g_dbus_remove_watch(connection, pn->watch);
-- pn->watch = 0;
-- }
-+ if (pn->watch > 0) {
-+ g_dbus_remove_watch(connection, pn->watch);
-+ pn->watch = 0;
-+ }
-
-- close(pn->fd);
-+ close(pn->fd);
-
-- g_free(pn->interface);
-- g_free(pn->owner);
-- g_free(pn->path);
-- g_free(pn->primary_dns);
-- g_free(pn->secondary_dns);
-- g_free(pn);
-+ g_free(pn->interface);
-+ g_free(pn->owner);
-+ g_free(pn->path);
-+ g_free(pn->primary_dns);
-+ g_free(pn->secondary_dns);
-+ g_free(pn);
- }
-
- static void owner_disconnect(DBusConnection *conn, void *user_data)
- {
-- struct connman_private_network *pn = user_data;
-+ struct connman_private_network *pn = user_data;
-
-- DBG("%s died", pn->owner);
-+ DBG("%s died", pn->owner);
-
-- pn->watch = 0;
-+ pn->watch = 0;
-
-- g_hash_table_remove(pn_hash, pn->path);
-+ g_hash_table_remove(pn_hash, pn->path);
- }
-
- static void ippool_disconnect(struct connman_ippool *pool, void *user_data)
- {
-- struct connman_private_network *pn = user_data;
-+ struct connman_private_network *pn = user_data;
-
-- DBG("block used externally");
-+ DBG("block used externally");
-
-- g_hash_table_remove(pn_hash, pn->path);
-+ g_hash_table_remove(pn_hash, pn->path);
- }
-
- int __connman_private_network_request(DBusMessage *msg, const char *owner)
- {
-- struct connman_private_network *pn;
-- char *iface = NULL;
-- char *path = NULL;
-- int index, fd, err;
--
-- if (DBUS_TYPE_UNIX_FD < 0)
-- return -EINVAL;
--
-- fd = connman_inet_create_tunnel(&iface);
-- if (fd < 0)
-- return fd;
--
-- path = g_strdup_printf("/tethering/%s", iface);
--
-- pn = g_hash_table_lookup(pn_hash, path);
-- if (pn) {
-- g_free(path);
-- g_free(iface);
-- close(fd);
-- return -EEXIST;
-- }
--
-- index = connman_inet_ifindex(iface);
-- if (index < 0) {
-- err = -ENODEV;
-- goto error;
-- }
-- DBG("interface %s", iface);
--
-- err = connman_inet_set_mtu(index, DEFAULT_MTU);
--
-- pn = g_try_new0(struct connman_private_network, 1);
-- if (!pn) {
-- err = -ENOMEM;
-- goto error;
-- }
--
-- pn->owner = g_strdup(owner);
-- pn->path = path;
-- pn->watch = g_dbus_add_disconnect_watch(connection, pn->owner,
-- owner_disconnect, pn, NULL);
-- pn->msg = msg;
-- pn->reply = dbus_message_new_method_return(pn->msg);
-- if (!pn->reply)
-- goto error;
--
-- pn->fd = fd;
-- pn->interface = iface;
-- pn->index = index;
-- pn->pool = __connman_ippool_create(pn->index, 1, 1, ippool_disconnect, pn);
-- if (!pn->pool) {
-- errno = -ENOMEM;
-- goto error;
-- }
--
-- pn->primary_dns = g_strdup(private_network_primary_dns);
-- pn->secondary_dns = g_strdup(private_network_secondary_dns);
--
-- pn->iface_watch = connman_rtnl_add_newlink_watch(index,
-- setup_tun_interface, pn);
--
-- g_hash_table_insert(pn_hash, pn->path, pn);
--
-- return 0;
-+ struct connman_private_network *pn;
-+ char *iface = NULL;
-+ char *path = NULL;
-+ int index, fd, err;
-+
-+ if (DBUS_TYPE_UNIX_FD < 0)
-+ return -EINVAL;
-+
-+ fd = connman_inet_create_tunnel(&iface);
-+ if (fd < 0)
-+ return fd;
-+
-+ path = g_strdup_printf("/tethering/%s", iface);
-+
-+ pn = g_hash_table_lookup(pn_hash, path);
-+ if (pn) {
-+ g_free(path);
-+ g_free(iface);
-+ close(fd);
-+ return -EEXIST;
-+ }
-+
-+ index = connman_inet_ifindex(iface);
-+ if (index < 0) {
-+ err = -ENODEV;
-+ goto error;
-+ }
-+ DBG("interface %s", iface);
-+
-+ err = connman_inet_set_mtu(index, DEFAULT_MTU);
-+
-+ pn = g_try_new0(struct connman_private_network, 1);
-+ if (!pn) {
-+ err = -ENOMEM;
-+ goto error;
-+ }
-+
-+ pn->owner = g_strdup(owner);
-+ pn->path = path;
-+ pn->watch = g_dbus_add_disconnect_watch(connection, pn->owner,
-+ owner_disconnect, pn, NULL);
-+ pn->msg = msg;
-+ pn->reply = dbus_message_new_method_return(pn->msg);
-+ if (!pn->reply)
-+ goto error;
-+
-+ pn->fd = fd;
-+ pn->interface = iface;
-+ pn->index = index;
-+ pn->pool = __connman_ippool_create(pn->index, 1, 1, ippool_disconnect, pn);
-+ if (!pn->pool) {
-+ errno = -ENOMEM;
-+ goto error;
-+ }
-+
-+ pn->primary_dns = g_strdup(private_network_primary_dns);
-+ pn->secondary_dns = g_strdup(private_network_secondary_dns);
-+
-+ pn->iface_watch = connman_rtnl_add_newlink_watch(index,
-+ setup_tun_interface, pn);
-+
-+ g_hash_table_insert(pn_hash, pn->path, pn);
-+
-+ return 0;
-
- error:
-- close(fd);
-- g_free(iface);
-- g_free(path);
-- if (pn)
-- g_free(pn->owner);
-- g_free(pn);
-- return err;
-+ close(fd);
-+ g_free(iface);
-+ g_free(path);
-+ if (pn)
-+ g_free(pn->owner);
-+ g_free(pn);
-+ return err;
- }
-
- int __connman_private_network_release(const char *path)
- {
-- struct connman_private_network *pn;
-+ struct connman_private_network *pn;
-
-- pn = g_hash_table_lookup(pn_hash, path);
-- if (!pn)
-- return -EACCES;
-+ pn = g_hash_table_lookup(pn_hash, path);
-+ if (!pn)
-+ return -EACCES;
-
-- g_hash_table_remove(pn_hash, path);
-- return 0;
-+ g_hash_table_remove(pn_hash, path);
-+ return 0;
- }
-
- int __connman_tethering_init(void)
- {
-- DBG("");
-+ DBG("");
-
-- tethering_enabled = 0;
-+ tethering_enabled = 0;
-
-- connection = connman_dbus_get_connection();
-- if (!connection)
-- return -EFAULT;
-+ connection = connman_dbus_get_connection();
-+ if (!connection)
-+ return -EFAULT;
-
-- pn_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
-- NULL, remove_private_network);
-+ pn_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
-+ NULL, remove_private_network);
-
-- return 0;
-+ return 0;
- }
-
- void __connman_tethering_cleanup(void)
- {
-- DBG("enabled %d", tethering_enabled);
--
-- __sync_synchronize();
-- if (tethering_enabled > 0) {
-- if (tethering_dhcp_server)
-- dhcp_server_stop(tethering_dhcp_server);
-- __connman_bridge_disable(BRIDGE_NAME);
-- __connman_bridge_remove(BRIDGE_NAME);
-- __connman_nat_disable(BRIDGE_NAME);
-- }
--
-- if (!connection)
-- return;
--
-- g_hash_table_destroy(pn_hash);
-- dbus_connection_unref(connection);
-+ DBG("enabled %d", tethering_enabled);
-+
-+ __sync_synchronize();
-+ if (tethering_enabled > 0) {
-+ if (tethering_dhcp_server)
-+ dhcp_server_stop(tethering_dhcp_server);
-+ __connman_bridge_disable(BRIDGE_NAME);
-+ __connman_bridge_remove(BRIDGE_NAME);
-+ __connman_nat_disable(BRIDGE_NAME);
-+ }
-+
-+ if (!connection)
-+ return;
-+
-+ g_hash_table_destroy(pn_hash);
-+ dbus_connection_unref(connection);
- }
+
\ No newline at end of file
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0034-connman-change-default-rule.patch b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/0034-connman-change-default-rule.patch
old mode 100755
new mode 100644
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/apmode.patch b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/apmode.patch
deleted file mode 100644
index 27510f1..0000000
--- a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman/apmode.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/plugins/wifi.c b/plugins/wifi.c
-index 09869ad..84ce176 100644
---- a/plugins/wifi.c
-+++ b/plugins/wifi.c
-@@ -735,7 +735,7 @@ static void wifi_newlink(unsigned flags, unsigned change, void *user_data)
- DBG("interface down");
- }
-
-- if ((wifi->flags & IFF_LOWER_UP) != (flags & IFF_LOWER_UP)) {
-+ if (((wifi->flags & IFF_LOWER_UP) != (flags & IFF_LOWER_UP))||(wifi->index==connman_inet_ifindex("ap0"))) {
- if (flags & IFF_LOWER_UP) {
- DBG("carrier on");
-
diff --git a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman_%.bbappend b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman_%.bbappend
index 61c5b78..37f4891 100644
--- a/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman_%.bbappend
+++ b/meta/meta-mediatek-ivt/recipes-connectivity/connman/connman_%.bbappend
@@ -1,7 +1,6 @@
FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
SRC_URI += "\
- file://apmode.patch \
file://0004-connman-add-telephony-plugin.patch \
file://0005-connman-build-plugin-telephon.c.patch \
file://0006-connman-disable-cellular-network-from-auto-connect.patch \
diff --git a/meta/meta-mediatek-ivt/recipes-core/busybox/busybox/ring_buf.patch b/meta/meta-mediatek-ivt/recipes-core/busybox/busybox/ring_buf.patch
index bb41e9a..76c6618 100755
--- a/meta/meta-mediatek-ivt/recipes-core/busybox/busybox/ring_buf.patch
+++ b/meta/meta-mediatek-ivt/recipes-core/busybox/busybox/ring_buf.patch
@@ -15,9 +15,9 @@
//umask(0); - why??
write_pidfile(CONFIG_PID_FILE_PATH "/syslogd.pid");
-+ G.logFileSize = 60*1024*1024;
-+ G.logFileRotate = 0;
++ G.logFileSize = 10*1024*1024;
++ G.logFileRotate = 10;
+
do_syslogd();
/* return EXIT_SUCCESS; */
- }
\ No newline at end of file
+ }
diff --git a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_ifconfig_cmd.patch b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_ifconfig_cmd.patch
new file mode 100755
index 0000000..86cee4d
--- /dev/null
+++ b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_ifconfig_cmd.patch
@@ -0,0 +1,445 @@
+--- connman-1.41/src/manager.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/src/manager_new.c 2022-08-20 17:16:50.031688400 +0800
+@@ -29,6 +29,13 @@
+
+ #include <connman/agent.h>
+
++#include <stdio.h>
++#include <unistd.h>
++#include <sys/socket.h>
++#include <net/if.h>
++#include <net/if_arp.h>
++#include <sys/ioctl.h>
++
+ #include "connman.h"
+
+ static bool connman_state_idle;
+@@ -69,12 +76,61 @@
+ return reply;
+ }
+
++struct dev_info {
++ const char * dev_name;
++ char identifier[128];
++ char group[16];
++ int index;
++};
++
++void device_enum_callback (int index, void *user_data) {
++ struct dev_info * dev = (struct dev_info*)user_data;
++ unsigned short type;
++ int sock_mac;
++ struct ifreq ifr_mac;
++
++ DBG("index:%d, ptr %p", index, dev);
++ if (dev == NULL) {
++ return;
++ }
++
++ if (g_strcmp0(dev->dev_name, connman_inet_ifname(index)) == 0) {
++ type = __connman_ipconfig_get_type_from_index(index);
++ DBG("index:%d, type %d", index, type);
++ if ( type == ARPHRD_ETHER || type == ARPHRD_EETHER) {
++ sock_mac = socket( AF_INET, SOCK_STREAM, 0 );
++
++ if( sock_mac == -1) {
++ DBG("bad sock mac");
++ return;
++ }
++ strcpy(ifr_mac.ifr_name, dev->dev_name);
++ if( (ioctl( sock_mac, SIOCGIFHWADDR, &ifr_mac)) >= 0) {
++ sprintf(dev->identifier, "ethernet_%02x%02x%02x%02x%02x%02x_cable",
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[0],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[1],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[2],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[3],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[4],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[5]);
++ strcpy(dev->group, "Wired");
++ dev->index = index;
++ }
++
++ close( sock_mac );
++ }
++ }
++}
++
+ static DBusMessage *set_property(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+ {
+ DBusMessageIter iter, value;
+ const char *name;
+ int type;
++ struct dev_info dev;
++ struct connman_service * service_ptr;
++ int err = 0;
+
+ DBG("conn %p", conn);
+
+@@ -108,14 +164,105 @@
+ if (type != DBUS_TYPE_BOOLEAN)
+ return __connman_error_invalid_arguments(msg);
+
+- dbus_message_iter_get_basic(&value, &sessionmode);
+-
++ dbus_message_iter_get_basic(&value, &sessionmode);
+ } else
+ return __connman_error_invalid_property(msg);
+
+ return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
+ }
+
++static DBusMessage *set_ipconfig(DBusConnection *conn,
++ DBusMessage *msg, void *data)
++{
++ DBusMessageIter iter, value;
++ const char *name;
++ int type;
++ struct dev_info dev;
++ struct connman_service * service_ptr;
++ int err = 0;
++
++ DBG("conn %p", conn);
++ memset(&dev, 0, sizeof (dev));
++
++ if (!dbus_message_iter_init(msg, &iter))
++ return __connman_error_invalid_arguments(msg);
++
++ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
++ return __connman_error_invalid_arguments(msg);
++
++ dbus_message_iter_get_basic(&iter, &name);
++ dbus_message_iter_next(&iter);
++
++ if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT)
++ return __connman_error_invalid_arguments(msg);
++
++ dbus_message_iter_recurse(&iter, &value);
++
++ type = dbus_message_iter_get_arg_type(&value);
++
++ if (!g_str_equal(name, "")) {
++ dev.dev_name = name;
++ DBG("%s, %s", name, dev.dev_name);
++ __connman_ipconfig_foreach(&device_enum_callback, &dev);
++ if (dev.identifier[0] == '\0') {
++ return __connman_error_invalid_arguments(msg);
++ }
++
++ service_ptr = __connman_service_lookup_from_index(dev.index);
++
++ DBG("servcie+ptr %p", service_ptr);
++ if (service_ptr != NULL) {
++ DBG("return EEXIST");
++ return __connman_error_failed(msg, -EEXIST);
++ }
++ struct connman_ipconfig *ipconfig, *new_ipconfig;
++ enum connman_ipconfig_method old_method, new_method;
++
++ int index;
++ const char *service_identifier = dev.identifier;
++ const char* servcie_name = dev.group;
++
++ old_method = __connman_ipconfig_get_method(ipconfig);
++ index = __connman_ipconfig_get_index(ipconfig);
++
++ new_ipconfig = __connman_ipconfig_create(index,
++ CONNMAN_IPCONFIG_TYPE_IPV4);
++ if (!new_ipconfig)
++ return __connman_error_invalid_arguments(msg);
++
++ if (1) {
++ err = __connman_ipconfig_set_config(new_ipconfig, &value);
++ if (err < 0) {
++ __connman_ipconfig_unref(new_ipconfig);
++ return __connman_error_invalid_arguments(msg);
++ }
++
++ new_method = __connman_ipconfig_get_method(new_ipconfig);
++ }
++
++ GKeyFile *keyfile;
++
++ keyfile = g_key_file_new();
++ if (!keyfile)
++ return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
++
++ if (servcie_name)
++ g_key_file_set_string(keyfile, service_identifier,
++ "Name", servcie_name);
++
++ if (new_ipconfig)
++ __connman_ipconfig_save(new_ipconfig, keyfile,
++ service_identifier, "IPv4.");
++
++ __connman_storage_save_service(keyfile, service_identifier);
++
++ g_key_file_free(keyfile);
++ } else
++ return __connman_error_invalid_property(msg);
++
++ return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
++}
++
+ static void append_technology_structs(DBusMessageIter *iter, void *user_data)
+ {
+ __connman_technology_list_struct(iter);
+@@ -582,7 +729,10 @@
+ register_peer_service) },
+ { GDBUS_METHOD("UnregisterPeerService",
+ GDBUS_ARGS({ "specification", "a{sv}" }), NULL,
+- unregister_peer_service) },
++ unregister_peer_service) },
++ { GDBUS_METHOD("SetIPConfig",
++ GDBUS_ARGS({ "name", "s" }, { "value", "v" }),
++ NULL, set_ipconfig) },
+ { },
+ };
+
+--- connman-1.41/client/commands.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/client/commands_new.c 2022-08-20 18:37:54.452762100 +0800
+@@ -45,6 +45,11 @@
+ #include "agent.h"
+ #include "vpnconnections.h"
+
++#include <sys/socket.h>
++#include <net/if.h>
++#include <net/if_arp.h>
++#include <sys/ioctl.h>
++
+ static DBusConnection *connection;
+ static GHashTable *service_hash;
+ static GHashTable *vpnconnection_hash;
+@@ -980,6 +985,12 @@
+ struct connman_option *options;
+ };
+
++struct ipconfig_options {
++ char *service_name;
++ char *ipconfig_cmd;
++ struct config_append append;
++};
++
+ static void config_append_ipv4(DBusMessageIter *iter,
+ void *user_data)
+ {
+@@ -999,6 +1010,59 @@
+ append->values = i;
+ }
+
++static int ipconfig_return(DBusMessageIter *iter, int errnum,
++ const char *error, void *user_data)
++{
++ struct ipconfig_options * config = user_data;
++
++ char * path;
++ int sock_mac;
++ struct ifreq ifr_mac;
++ char identifier[64];
++
++// printf("ipconfig_return %d %s\n", errnum, error);
++ if (errnum == -EEXIST || (error && strstr(error, "-17") != NULL)) {
++// printf("exits service\n");
++ sock_mac = socket( AF_INET, SOCK_STREAM, 0 );
++
++ if( sock_mac == -1) {
++ return -1;
++ }
++
++ strcpy(ifr_mac.ifr_name, config->service_name);
++ if( (ioctl( sock_mac, SIOCGIFHWADDR, &ifr_mac)) >= 0) {
++ sprintf(identifier, "ethernet_%02x%02x%02x%02x%02x%02x_cable",
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[0],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[1],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[2],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[3],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[4],
++ (unsigned char)ifr_mac.ifr_hwaddr.sa_data[5]);
++ }
++
++ close( sock_mac );
++
++ path = g_strdup_printf("/net/connman/service/%s", identifier);
++ //printf("service name %s\n", identifier);
++ __connmanctl_dbus_set_property_dict(connection,
++ path, "net.connman.Service",
++ config_return, g_strdup(identifier),
++ "IPv4.Configuration", DBUS_TYPE_STRING,
++ config_append_ipv4, &config->append);
++ }
++ else if (error)
++ fprintf(stderr, "Error %s: %s\n", config->service_name, error);
++ else if (config->ipconfig_cmd) {
++ system(config->ipconfig_cmd);
++ g_free(config->ipconfig_cmd);
++ }
++
++ g_free(config->service_name);
++ g_free(user_data);
++
++ return 0;
++}
++
+ static void config_append_ipv6(DBusMessageIter *iter, void *user_data)
+ {
+ struct config_append *append = user_data;
+@@ -1327,6 +1391,78 @@
+ return result;
+ }
+
++static int cmd_ipconfig(char *args[], int num, struct connman_option *options)
++{
++ int result = 0, res = 0, index = 2, oldindex = 0;
++ int c;
++ char *service_name, *path;
++ char **opt_start;
++ struct config_append append;
++ struct ipconfig_options *ipconfig_ptr;
++
++ service_name = args[1];
++ if (!service_name)
++ return -EINVAL;
++// printf("ifconfig name %s\n", service_name);
++
++ while (index < num && args[index]) {
++ c = parse_args(args[index], options);
++ opt_start = &args[index + 1];
++ append.opts = opt_start;
++ append.values = 0;
++ ipconfig_ptr = g_new0(struct ipconfig_options, 1);
++ ipconfig_ptr->service_name = g_strdup(service_name);
++ ipconfig_ptr->ipconfig_cmd = NULL;
++ ipconfig_ptr->append.opts = opt_start;
++ ipconfig_ptr->append.values = 0;
++
++ res = 0;
++
++ oldindex = index;
++ path = g_strdup_printf("/");
++
++ switch (c) {
++ case 'i':
++ {
++ if (num > 4 && strcmp(args[2], "--ipv4") == 0 && strcmp(args[3], "manual") == 0) {
++ if (num > 5)
++ ipconfig_ptr->ipconfig_cmd = g_strdup_printf("ifconfig %s %s netmask %s", service_name, args[4], args[5]);
++ else
++ ipconfig_ptr->ipconfig_cmd = g_strdup_printf("ifconfig %s %s", service_name, args[4]);
++ }
++ res = __connmanctl_dbus_method_call_with_name(connection,
++ "net.connman", path, "net.connman.Manager", "SetIPConfig",
++ ipconfig_return, ipconfig_ptr,
++ service_name, DBUS_TYPE_STRING,
++ config_append_ipv4, &append);
++
++// printf("res is %d\n", res);
++ index += append.values;
++ break;
++ }
++
++ default:
++ res = -EINVAL;
++ break;
++ }
++
++ g_free(path);
++
++ if (res < 0) {
++ if (res == -EINPROGRESS)
++ result = -EINPROGRESS;
++ else
++ printf("Error '%s': %s\n", args[oldindex],
++ strerror(-res));
++ } else
++ index += res;
++
++ index++;
++ }
++
++ return result;
++}
++
+ static DBusHandlerResult monitor_changed(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+ {
+@@ -2825,6 +2961,8 @@
+ lookup_service_arg },
+ { "config", "<service>", config_options, cmd_config,
+ "Set service configuration options", lookup_config },
++ { "ifconfig", "<interface>", config_options, cmd_ipconfig,
++ "Set interface configuration options", lookup_config },
+ { "monitor", "[off]", monitor_options, cmd_monitor,
+ "Monitor signals from interfaces", lookup_monitor },
+ { "agent", "on|off", NULL, cmd_agent,
+--- connman-1.41/client/dbus_helpers.h 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/client/dbus_helpers_new.h 2022-08-20 17:17:32.301009500 +0800
+@@ -49,6 +49,14 @@
+ void * user_data, connmanctl_dbus_append_func_t append_fn,
+ void *append_data);
+
++int __connmanctl_dbus_method_call_with_name(DBusConnection *connection,
++ const char *service, const char *path,
++ const char *interface, const char *method,
++ connmanctl_dbus_method_return_func_t cb, void * user_data,
++ const char *property, int type,
++ connmanctl_dbus_append_func_t append_fn,
++ void *append_data);
++
+ int __connmanctl_dbus_set_property(DBusConnection *connection,
+ const char *path, const char *interface,
+ connmanctl_dbus_method_return_func_t cb, void * user_data,
+--- connman-1.41/client/dbus_helpers.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/client/dbus_helpers_new.c 2022-08-20 17:54:29.303478800 +0800
+@@ -289,6 +289,52 @@
+ return send_method_call(connection, message, cb, user_data);
+ }
+
++int __connmanctl_dbus_method_call_with_name(DBusConnection *connection,
++ const char *service, const char *path,
++ const char *interface, const char *method,
++ connmanctl_dbus_method_return_func_t cb, void * user_data,
++ const char *property, int type,
++ connmanctl_dbus_append_func_t append_fn,
++ void *append_data)
++{
++ DBusMessage *message;
++ DBusMessageIter iter, variant, dict;
++
++ message = dbus_message_new_method_call(service, path, interface,
++ method);
++
++ if (!message)
++ return -ENOMEM;
++
++ //printf("set property path:%s,interface:%s\n", path, interface);
++ if (!message)
++ return -ENOMEM;
++
++ dbus_message_iter_init_append(message, &iter);
++ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &property);
++ dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
++ DBUS_TYPE_ARRAY_AS_STRING
++ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
++ DBUS_TYPE_STRING_AS_STRING
++ DBUS_TYPE_VARIANT_AS_STRING
++ DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
++ &variant);
++
++ dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
++ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
++ DBUS_TYPE_STRING_AS_STRING
++ DBUS_TYPE_VARIANT_AS_STRING
++ DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
++ &dict);
++
++ append_fn(&dict, append_data);
++
++ dbus_message_iter_close_container(&variant, &dict);
++ dbus_message_iter_close_container(&iter, &variant);
++
++ return send_method_call(connection, message, cb, user_data);
++}
++
+ int __connmanctl_dbus_set_property(DBusConnection *connection,
+ const char *path, const char *interface,
+ connmanctl_dbus_method_return_func_t cb, void * user_data,
diff --git a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_ap_sta.patch b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_ap_sta.patch
index 855cbf1..d8b7e76 100755
--- a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_ap_sta.patch
+++ b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_ap_sta.patch
@@ -1,14 +1,14 @@
---- connman-1.35/plugins/wifi.c 2022-04-30 14:31:30.777805400 +0800
-+++ connman-1.35/plugins/wifi_new.c 2022-05-12 17:54:35.727120400 +0800
-@@ -153,6 +153,7 @@
+--- connman-1.41/plugins/wifi.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/plugins/wifi_new.c 2022-05-12 09:03:27.544623700 +0800
+@@ -164,6 +164,7 @@
int servicing;
int disconnect_code;
int assoc_code;
+ bool interface_create_flag;
};
- static GList *iface_list = NULL;
-@@ -784,6 +785,7 @@
+ struct wifi_network {
+@@ -808,6 +809,7 @@
else
iface_list = g_list_append(iface_list, wifi);
@@ -16,9 +16,64 @@
return 0;
}
-@@ -1471,13 +1473,13 @@
+@@ -816,6 +818,7 @@
{
+ GSList *list;
+
++ DBG("cy-remove_networks device %p, wifi %p", device, wifi);
+ for (list = wifi->networks; list; list = list->next) {
+ struct connman_network *network = list->data;
+
+@@ -1420,11 +1423,21 @@
+ {
+ struct wifi_data *wifi = connman_device_get_data(device);
+ struct autoscan_params *autoscan;
++ struct wifi_data *wifi2;
++ GList *list;
+
+ DBG("");
+
++ for (list = iface_list; list; list = list->next) {
++ wifi2 = list->data;
++
++ DBG("cy-wifi %p network %p interface %p", wifi2,
++ wifi2->network, wifi2->interface);
++ }
+ if (!wifi)
+ return;
++ else
++ return;
+
+ if (wifi->p2p_device)
+ return;
+@@ -1535,10 +1548,10 @@
+ if (wifi->p2p_device)
+ return;
+
+- if (!wifi->autoscan)
+- setup_autoscan(wifi);
++ // if (!wifi->autoscan)
++ // setup_autoscan(wifi);
+
+- start_autoscan(wifi->device);
++ // start_autoscan(wifi->device);
+ }
+
+ static void interface_create_callback(int result,
+@@ -1548,14 +1561,24 @@
struct wifi_data *wifi = user_data;
+ char *bgscan_range_max;
+ long value;
++ struct wifi_data *wifi2=NULL;
++
++ GList *list;
++
++ for (list = iface_list; list; list = list->next) {
++ wifi2 = list->data;
++
++ DBG("cy-wifi %p network %p interface %p", wifi2,
++ wifi2->network, wifi2->interface);
++ }
- DBG("result %d ifname %s, wifi %p", result,
+ DBG("cy-result %d ifname %s, wifi %p, %s", result,
@@ -34,8 +89,8 @@
wifi->interface = interface;
g_supplicant_interface_set_data(interface, wifi);
-@@ -1495,7 +1497,8 @@
- const char *driver = connman_option_get_string("wifi");
+@@ -1591,7 +1614,8 @@
+ const char *driver = connman_setting_get_string("wifi");
int ret;
- DBG("device %p %p", device, wifi);
@@ -44,7 +99,7 @@
index = connman_device_get_index(device);
if (!wifi || index < 0)
-@@ -1505,6 +1508,13 @@
+@@ -1601,14 +1625,24 @@
return -EINPROGRESS;
interface = connman_inet_ifname(index);
@@ -58,14 +113,68 @@
ret = g_supplicant_interface_create(interface, driver, NULL,
interface_create_callback,
wifi);
-@@ -3103,21 +3113,21 @@
+ g_free(interface);
+
+- if (ret < 0)
++ if (ret < 0) {
++ DBG("cy-return not in progress %d", ret);
+ return ret;
++ }
+
++ DBG("cy-return -EINPROGRESS");
+ return -EINPROGRESS;
+ }
+
+@@ -2632,13 +2666,13 @@
+ }
+ wifi->disconnecting = false;
+
+- start_autoscan(device);
++ // start_autoscan(device);
+
+ break;
+
+ case G_SUPPLICANT_STATE_INACTIVE:
+ connman_network_set_associating(network, false);
+- start_autoscan(device);
++ // start_autoscan(device);
+
+ break;
+
+@@ -2674,8 +2708,8 @@
+ case G_SUPPLICANT_STATE_SCANNING:
+ wifi->connected = false;
+
+- if (old_connected)
+- start_autoscan(device);
++ // if (old_connected)
++ // start_autoscan(device);
+ break;
+ case G_SUPPLICANT_STATE_COMPLETED:
+ wifi->connected = true;
+@@ -3344,31 +3378,31 @@
+ if (!ap)
return NULL;
+- ret = connman_technology_get_wifi_tethering(technology,
+- &ssid, &passphrase,
+- &freq);
+- if (ret == false)
+- return NULL;
++ // ret = connman_technology_get_wifi_tethering(technology,
++ // &ssid, &passphrase,
++ // &freq);
++ // if (ret == false)
++ // return NULL;
+
ap->mode = G_SUPPLICANT_MODE_MASTER;
- ap->ssid = ssid;
- ap->ssid_len = strlen(ssid);
- ap->scan_ssid = 0;
-- ap->freq = 2412;
+- if (freq)
+- ap->freq = freq;
+- else
+- ap->freq = 2412;
-
- if (!passphrase || strlen(passphrase) == 0) {
- ap->security = G_SUPPLICANT_SECURITY_NONE;
@@ -80,7 +189,10 @@
+ // ap->ssid = ssid;
+ // ap->ssid_len = strlen(ssid);
+ // ap->scan_ssid = 0;
-+ // ap->freq = 2412;
++ // if (freq)
++ // ap->freq = freq;
++ // else
++ // ap->freq = 2412;
+
+ // if (!passphrase || strlen(passphrase) == 0) {
+ // ap->security = G_SUPPLICANT_SECURITY_NONE;
@@ -95,7 +207,7 @@
return ap;
}
-@@ -3179,8 +3189,8 @@
+@@ -3430,8 +3464,8 @@
if (g_supplicant_interface_set_apscan(interface, 2) < 0)
connman_error("Failed to set interface ap_scan property");
@@ -106,7 +218,13 @@
}
static void sta_remove_callback(int result,
-@@ -3235,13 +3245,23 @@
+@@ -3480,18 +3514,28 @@
+ for (list = iface_list; list; list = list->next) {
+ wifi = list->data;
+
+- DBG("wifi %p network %p pending_network %p", wifi,
++ DBG("cy-wifi %p network %p pending_network %p", wifi,
+ wifi->network, wifi->pending_network);
interface = wifi->interface;
@@ -133,7 +251,7 @@
if (wifi->ap_supported == WIFI_AP_NOT_SUPPORTED) {
DBG("%s does not support AP mode (detected)", ifname);
continue;
-@@ -3256,6 +3276,7 @@
+@@ -3506,6 +3550,7 @@
if (wifi->network && available)
continue;
@@ -141,7 +259,7 @@
info = g_try_malloc0(sizeof(struct wifi_tethering_info));
if (!info)
-@@ -3288,9 +3309,11 @@
+@@ -3538,9 +3583,11 @@
if (berr < 0)
goto failed;
@@ -156,9 +274,17 @@
if (err >= 0) {
DBG("tethering wifi %p ifname %s", wifi, ifname);
return 0;
---- connman-1.35/gsupplicant/supplicant.c 2017-08-11 02:56:43.000000000 +0800
-+++ connman-1.35/gsupplicant/supplicant_new.c 2022-05-12 15:36:33.433705200 +0800
-@@ -3869,6 +3869,15 @@
+--- connman-1.41/gsupplicant/supplicant.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/gsupplicant/supplicant_new.c 2022-05-11 18:01:51.174203200 +0800
+@@ -3638,6 +3638,7 @@
+ if (!path)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
++ SUPPLICANT_DBG("cy- msg %s", path);
+ if (!dbus_message_iter_init(message, &iter))
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+@@ -4005,6 +4006,15 @@
DBUS_TYPE_STRING, &data->bridge);
config_file = g_hash_table_lookup(config_file_table, data->ifname);
@@ -174,3 +300,18 @@
if (config_file) {
SUPPLICANT_DBG("[%s] ConfigFile %s", data->ifname, config_file);
+--- connman-1.41/src/technology.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/src/technology_new.c 2022-05-11 19:23:17.729723700 +0800
+@@ -261,9 +261,9 @@
+ if (!bridge)
+ return -EOPNOTSUPP;
+
+- if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
+- (!ident || !passphrase))
+- return -EINVAL;
++ // if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
++ // (!ident || !passphrase))
++ // return -EINVAL;
+
+ for (tech_drivers = technology->driver_list; tech_drivers;
+ tech_drivers = g_slist_next(tech_drivers)) {
diff --git a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_netmask.patch b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_netmask.patch
new file mode 100644
index 0000000..a3bc18d
--- /dev/null
+++ b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman/lynq_wifi_netmask.patch
@@ -0,0 +1,147 @@
+--- connman-1.41/src/ippool.c 2022-01-28 22:48:01.000000000 +0800
++++ connman-1.41/src/ippool_new.c 2022-07-01 19:19:49.209647300 +0800
+@@ -321,6 +321,132 @@
+ g_free(info);
+ }
+
++static struct connman_ippool *__connman_ippool_create_special(int index,
++ unsigned int start,
++ unsigned int range,
++ ippool_collision_cb_t collision_cb,
++ void *user_data)
++{
++ struct connman_ippool *pool;
++ struct address_info *info;
++ uint32_t block;
++ FILE * fp;
++ char *buff, *p;
++ int i,len,mask_cnt,mask_range,mask;
++
++ DBG("");
++
++ fp = fopen("/etc/config/wifi_network", "rb");
++ if (NULL == fp) {
++ return NULL;
++ }
++
++ buff = malloc(1024);
++ len = fread(buff, 1, 1024, fp);
++ fclose(fp);
++ buff[len] = '\0';
++ connman_error("read cnt: %d\n", len);
++
++ connman_error("read: %s\n", buff);
++
++ p = NULL;
++ for(i=0; i<len; i++) {
++ if (buff[i] == '/') {
++ if (p != NULL) {
++ p = NULL;
++ break;
++ }
++ connman_error("left: %s\n", buff + i);
++ buff[i] = '\0';
++ p=buff + i + 1;
++ connman_warn("find %s\n",p);
++ }
++ else if (buff[i] == ' ') {
++ buff[i] = '\0';
++ if (p != NULL && p == buff + i) {
++ p++;
++ }
++ }
++ }
++
++ if (p == NULL) {
++ free(buff);
++ return NULL;
++ }
++
++ block = ntohl(inet_addr(buff));
++ mask_cnt = atoi(p);
++ i = mask_cnt - 24;
++ mask_range = 0xff >> i;
++ sprintf(buff, "255.255.255.%d", (mask_range<<i));
++ connman_warn("netmask %s\n",buff);
++ mask = ntohl(inet_addr(buff));
++
++ free(buff);
++ if (mask_cnt < 24 || mask_cnt >= 32) {
++ return NULL;
++ }
++
++ if (start + range > mask_range ) {
++ range = mask_range - start - 1;
++ }
++
++ /*
++ * The range is at max 255 and we don't support overlapping
++ * blocks.
++ */
++ if (start + range > 254) {
++ connman_error("IP pool does not support pool size larger than 254");
++ return NULL;
++ }
++
++ if (block == 0) {
++ connman_warn("Could not find a free IP block");
++ return NULL;
++ }
++
++ pool = g_try_new0(struct connman_ippool, 1);
++ if (!pool)
++ return NULL;
++
++ info = g_try_new0(struct address_info, 1);
++ if (!info) {
++ g_free(pool);
++ return NULL;
++ }
++
++ last_block = block;
++
++ info->index = index;
++ info->start = block;
++ info->end = block + range;
++
++ pool->info = info;
++ pool->collision_cb = collision_cb;
++ pool->user_data = user_data;
++
++ info->pool = pool;
++
++ if (range == 0)
++ range = 1;
++
++ pool->gateway = get_ip(info->start + 1);
++ pool->broadcast = get_ip(info->start + mask_range);
++ pool->subnet_mask = get_ip(mask);
++ pool->start_ip = get_ip(block + start);
++ pool->end_ip = get_ip(block + start + range);
++ connman_warn("gateway %s\n",pool->gateway);
++ connman_warn("broadcast %s\n",pool->broadcast);
++ connman_warn("subnet_mask %s\n",pool->subnet_mask);
++ connman_warn("start_ip %s\n",pool->start_ip);
++ connman_warn("end_ip %s\n",pool->end_ip);
++
++
++ allocated_blocks = g_slist_prepend(allocated_blocks, info);
++
++ return pool;
++}
++
+ struct connman_ippool *__connman_ippool_create(int index,
+ unsigned int start,
+ unsigned int range,
+@@ -333,6 +459,11 @@
+
+ DBG("");
+
++ pool = __connman_ippool_create_special(index, start, range, collision_cb, user_data);
++ if (pool != NULL) {
++ return pool;
++ }
++
+ /*
+ * The range is at max 255 and we don't support overlapping
+ * blocks.
diff --git a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman_%.bbappend b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman_%.bbappend
index 76c88a5..48244d8 100755
--- a/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman_%.bbappend
+++ b/meta/meta-mediatek-mt2735/recipes-connectivity/connman/connman_%.bbappend
@@ -2,5 +2,7 @@
SRC_URI += "\
file://lynq_wifi_ap_sta.patch \
+ file://lynq_wifi_netmask.patch \
+ file://lynq_ifconfig_cmd.patch \
"
diff --git a/meta/meta-mediatek-mt2735/recipes-core/initial/files/init_mount_nand b/meta/meta-mediatek-mt2735/recipes-core/initial/files/init_mount_nand
index 812850b..a5627f4 100755
--- a/meta/meta-mediatek-mt2735/recipes-core/initial/files/init_mount_nand
+++ b/meta/meta-mediatek-mt2735/recipes-core/initial/files/init_mount_nand
@@ -97,21 +97,22 @@
init_log() {
mnt_folder log /log
- if [ -e /dev/mmcblk1p1 ]; then
- if [ ! -e /run/media/mmcblk1p1 ]; then
- mkdir -p /run/media/mmcblk1p1
- fi
- mount -t exfat /dev/mmcblk1p1 /run/media/mmcblk1p1
- rm -rf /var/log
- ln -sf /run/media/mmcblk1p1 /var/log
+ if [ -e /dev/mmcblk0 ]; then
+ #mkfs -t ext4 /dev/mmcblk0
+ if [ -e /media ]; then
+ mount -t ext4 /dev/mmcblk0 /media
+ mount --bind /media /var/log
+ else
+ mount -t ext4 /dev/mmcblk0 /var/log
+ fi
else
- allink=`ls -al /var | grep 'log ->' 2>&1`
+ #allink=`ls -al /var | grep 'log ->' 2>&1`
if [ ! "$allink" == "" ]; then
#echo "=== /var/log is already link, unlink it ===" > /dev/kmsg
unlink /var/log
mkdir /var/log
fi
- mnt_bind_folder /log /var/log
+ #mnt_bind_folder /log /var/log
fi
# link /var/log --> /data/local for MET
diff --git a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/cyw955572fcipa_rev2.52.txt b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/cyw955572fcipa_rev2.52.txt
index 769f177..8891dad 100755
--- a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/cyw955572fcipa_rev2.52.txt
+++ b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/cyw955572fcipa_rev2.52.txt
@@ -1,11 +1,11 @@
#
NVRAMRev=$Rev$
sromrev=11
-boardrev=0x1252
+boardrev=0x1254
boardtype=0x0884
boardflags=0x00400001
boardflags2=0x00800000
-boardflags3=0x40000100
+boardflags3=0x40002100
#boardnum=57410
macaddr=00:90:4c:2d:80:01
@@ -26,7 +26,7 @@
agbg1=2
aga0=2
aga1=2
-extpagain5g=2
+extpagain5g=2
extpagain2g=2
rxgains2gelnagaina0=0
rxgains2gtrisoa0=13
@@ -54,26 +54,39 @@
rxgains5ghtrelnabypa1=0
#RSSI related
-rssicorrnorm_c0=-4,12
-rssicorrnorm_c1=0,0
-rssicorrnorm5g_c0=13,16,14,9,16,12,4,15,13,4,6,12
-rssicorrnorm5g_c1=6,8,11,6,10,10,6,11,12,6,6,10
-rssicorrnorm6g_c0=13,16,14,9,16,12,4,15,13,4,6,12
-rssicorrnorm6g_c1=6,8,11,6,10,10,6,11,12,6,6,10
+rssicorrnorm_c0=0,0
+rssicorrnorm_c1=1,0
+rssicorrnorm5g_c0=13,14,17,9,10,13,8,14,12,6,7,11
+rssicorrnorm5g_c1=13,15,16,10,13,13,10,14,12,7,8,11
+low_pwr_rssi_bias_5g_c0=0,-8,-12,0,-8,-12,0,0,-12,0,-8,-12
+low_pwr_rssi_bias_5g_c1=0,-6,-8,0,-6,-8,0,-6,-8,0,-6,-8
+rssicorrnorm6g_c0=15,9,18,16,18,16,36,34,40,52,52,60
+rssicorrnorm6g_c1=8,6,12,12,10,16,26,30,30,46,46,52
rssi_cal_freq_grp_2g= 0x08,0x01,0x91,0x2a,0x23,0xb3,0xc4
rssi_delta_5gl=-6 4 -8 -8 -6 4 -8 -8 -6 4 -8 -8 -3 6 -3 -4 -3 6 -3 -4 -3 6 -3 -4
rssi_delta_5gml=-1 3 -1 -3 -1 3 -1 -3 -1 3 -1 -3 -1 2 0 -2 -1 2 0 -2 -1 2 0 -2
rssi_delta_5gmu=0 3 -1 -2 0 3 -1 -2 0 3 -1 -2 0 2 0 -2 0 2 0 -2 0 2 0 -2
rssi_delta_5gh=2 4 2 -1 2 4 2 -1 2 4 2 -1 0 0 2 -2 0 0 2 -2 0 0 2 -2
-rssi_delta_6gunii5=-6 4 -8 -8 -6 4 -8 -8 -6 4 -8 -8 -3 6 -3 -4 -3 6 -3 -4 -3 6 -3 -4
-rssi_delta_6gunii6=-1 3 -1 -3 -1 3 -1 -3 -1 3 -1 -3 -1 2 0 -2 -1 2 0 -2 -1 2 0 -2
-rssi_delta_6gunii7=0 3 -1 -2 0 3 -1 -2 0 3 -1 -2 0 2 0 -2 0 2 0 -2 0 2 0 -2
-rssi_delta_6gunii8=2 4 2 -1 2 4 2 -1 2 4 2 -1 0 0 2 -2 0 0 2 -2 0 0 2 -2
+rssi_delta_6gunii5=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+rssi_delta_6gunii6=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+rssi_delta_6gunii7=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+rssi_delta_6gunii8=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
rssi_cal_rev=1
rxgaincal_rssical=1
+gain_cal_temp=25
+rxgain_tempcoeff2g_sub=40,40,40,40,40,40,40,40,40,40
+rxgain_tempcoeff5gl=20,20
+rxgain_tempcoeff5gml=20,20
+rxgain_tempcoeff5gmu=20,20
+rxgain_tempcoeff5gh=20,20
+rxgain_tempcoeff2g_sub_elnaoff=40,40,40,40,40,40,40,40,40,40
+rxgain_tempcoeff5gl_elnaoff=20,20
+rxgain_tempcoeff5gml_elnaoff=20,20
+rxgain_tempcoeff5gmu_elnaoff=20,20
+rxgain_tempcoeff5gh_elnaoff=20,20
rssi_cal_freq_grp_2g= 0x08,0x01,0x91,0x2a,0x23,0xb3,0xc4
-rssi_delta_2gb0=8,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0
-rssi_delta_2gb1=12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+rssi_delta_2gb0=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+rssi_delta_2gb1=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
rssi_delta_2gb2=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
rssi_delta_2gb3=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
rssi_delta_2gb4=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
@@ -112,16 +125,31 @@
fdss_interp_en=0
fdss_level_2g=4,4
+#FIXME: fdss level for 6G made same as 5G for now
+fdss_level_6g=9,9
+
+#LPB related
+leg_preamble_boost=12,12,0
+lpb_comp=10
+
#PAPRR Related
paprdis=0
paprrmcsgain2g=128,128,128,128,128,0,0,0,0,0,0,0
-paprrmcsgamma2g=400,400,550,650,700,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgamma2g=600,450,600,650,700,-1,-1,-1,-1,-1,-1,-1
paprrmcsgain5g20=128,128,128,128,128,0,0,0,0,0,0,0
-paprrmcsgamma5g20=400,400,550,650,700,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgamma5g20=700,450,600,650,700,-1,-1,-1,-1,-1,-1,-1
paprrmcsgain5g40=128,128,128,128,128,0,0,0,0,0,0,0
-paprrmcsgamma5g40=450,450,550,600,700,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgamma5g40=1200,450,550,600,700,-1,-1,-1,-1,-1,-1,-1
paprrmcsgain5g80=128,128,128,128,128,0,0,0,0,0,0,0
-paprrmcsgamma5g80=500,500,550,650,650,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgamma5g80=1200,500,550,650,650,-1,-1,-1,-1,-1,-1,-1
+#PAPR params for 6G
+#FIXME: papr params 6G made same as 5G for now
+paprrmcsgain6g20=128,128,128,128,128,0,0,0,0,0,0,0
+paprrmcsgamma6g20=400,400,550,650,700,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgain6g40=128,128,128,128,128,0,0,0,0,0,0,0
+paprrmcsgamma6g40=450,450,550,600,700,-1,-1,-1,-1,-1,-1,-1
+paprrmcsgain6g80=128,128,128,128,128,0,0,0,0,0,0,0
+paprrmcsgamma6g80=500,500,550,650,650,-1,-1,-1,-1,-1,-1,-1
#Tempsense Related
tempthresh=255
@@ -134,27 +162,35 @@
#------------- TSSI Related -------------
tssipos2g=1
tssipos5g=1
-AvVmid_c0=6,85,4,105,5,95,5,95,5,95,5,95,5,95
-AvVmid_c1=6,75,5,90,5,90,5,95,4,105,4,105,4,105
-#AvVmid_c0_2g=4,93,1,159,1,166,1,153,1,153
-#AvVmid_c1_2g=4,90,1,155,1,158,1,147,1,151
+#FIXME: AvVmid for UNII-7/8 made same as UNII-6 for now
+AvVmid_c0=6,85,4,105,5,95,5,95,5,95,5,95,5,95,5,95,5,95
+AvVmid_c1=6,75,5,90,5,90,5,95,4,105,4,105,4,105,4,105,4,105
+
+#limit Tx gain index
+txidxcap2g=10
+txidxcap5g=10
+txidxcap6g=0
# SINGLE RANGE TPC/TSSI
#2G OFDM
-pa2ga0=-68,6060,-630
-pa2ga1=-90,6044,-633
+#pa2ga0=-106,6424,-703
+pa2ga0=-129,5802,-662
+#pa2ga1=-120,6301,-702
+pa2ga1=-120,5960,-669
+
#2G CCK
-pa2ga2=-60,6528,-679
-pa2ga3=-108,6327,-704
+pa2ga2=-100,6347,-701
+pa2ga3=-112,6411,-721
+
#5G High pwr
-pa5ga0=-167,6421,-774,-158,6255,-748,-159,6293,-748,-152,6273,-740
-pa5ga1=-152,6565,-773,-162,6493,-771,-168,6319,-760,-184,6306,-777
+pa5ga0=-200,6256,-774,-177,6168,-750,-184,6098,-747,-171,5929,-707
+pa5ga1=-186,6086,-743,-162,6493,-771,-184,6140,-756,-188,5943,-734
#5G Low pwr
pa5ga2=-239,4574,-587,-233,5017,-643,-225,5518,-705,-231,5352,-684
pa5ga3=-229,5269,-675,-239,4366,-560,-234,4693,-603,-225,5414,-693
-#PA Params 6G UNII-5 and UNII-6
-pa6ga0=-156,6022,-729,-117,6545,-751
-pa6ga1=-152,6464,-777,-168,6317,-773
+#PA Params 6G UNII-5,6,7,8
+pa6ga0=-150,6336,-746,-119,6732,-773,-166,6212,-767,-154,5988,-742
+pa6ga1=-175,6181,-746,-173,6265,-759,-194,5830,-737,-186,6190,-766
# Max power and offsets
@@ -162,46 +198,74 @@
maxp2ga1=78
maxp5ga0=72,72,72,72
maxp5ga1=72,72,72,72
-#Max Power on 6G UNII-5 and UNII-6
-maxp6ga0=72,72
-maxp6ga1=72,72
+#Max Power on 6G UNII-5/6 and UNII-7/8
+maxp6ga0=66,62
+maxp6ga1=66,62
subband5gver=0x4
paparambwver=3
-cckpwroffset0=-1
-cckpwroffset1=1
-pdoffset40ma0=0x2120
-pdoffset80ma0=0x0110
-pdoffset40ma1=0x1312
-pdoffset80ma1=0x0101
+cckpwroffset0=1
+cckpwroffset1=2
+
+pdoffset20ma0=0xf010
+pdoffset20ma1=0x1200
+pdoffset40ma0=0x0120
+pdoffset80ma0=0xf010
+pdoffset40ma1=0x2210
+pdoffset80ma1=0x2200
+pdoffset6g20ma0=0x10ff
+pdoffset6g20ma0_group1=0xed40
+pdoffset6g20ma1=0x3201
+pdoffset6g20ma1_group1=0xfe30
+pdoffset6g40ma0=0x35e2
+pdoffset6g40ma0_group1=0x1272
+pdoffset6g40ma1=0x4335
+pdoffset6g40ma1_group1=0x2363
+pdoffset6g80ma0=0x4112
+pdoffset6g80ma0_group1=0x1023
+pdoffset6g80ma1=0x5333
+pdoffset6g80ma1_group1=0x1112
+
cckbw202gpo=0
cckbw20ul2gpo=0
-mcsbw202gpo=0xDC422220
-mcsbw402gpo=0xDC422220
-dot11agofdmhrbw202gpo=0x4222
-ofdmlrbw202gpo=0x2220
-mcsbw205glpo=0xCC400000
-mcsbw405glpo=0xCC400000
-mcsbw805glpo=0xCC400000
+mcsbw202gpo=0x86622222
+mcsbw402gpo=0x86422222
+dot11agofdmhrbw202gpo=0x4444
+ofdmlrbw202gpo=0x2222
+mcsbw205glpo=0x64222222
+mcsbw405glpo=0x65322222
+mcsbw805glpo=0x76322222
mcsbw1605glpo=0
-mcsbw205gmpo=0xCC400000
-mcsbw405gmpo=0xCC400000
-mcsbw805gmpo=0xCC400000
+mcsbw205gmpo=0x64222222
+mcsbw405gmpo=0x65322222
+mcsbw805gmpo=0x76322222
mcsbw1605gmpo=0
-mcsbw205ghpo=0xCC400000
-mcsbw405ghpo=0xCC400000
-mcsbw805ghpo=0xCC400000
+mcsbw205ghpo=0x64222222
+mcsbw405ghpo=0x65322222
+mcsbw805ghpo=0x76322222
+# ppr offsets for UNII-5/6 of 6GHz band
+mcsbw206glpo=0x87522222
+mcsbw406glpo=0x87522222
+mcsbw806glpo=0x87522222
+# ppr offsets for UNII-7/8 of 6GHz band
+mcsbw206gmpo=0x87522222
+mcsbw406gmpo=0x98622222
+mcsbw806gmpo=0x98622222
-powoffs2gtna0=1,1,1,2,2,2,2,2,1,1,1,1,1,0
-powoffs2gtna1=1,1,1,2,2,2,2,2,1,1,1,1,1,0
-mcs1024qam2gpo=0xFFFF
-mcs1024qam5glpo=0xFFFFFF
-mcs1024qam5gmpo=0xFFFFFF
-mcs1024qam5ghpo=0xFFFFFF
-mcs1024qam5gx1po=0xFFFFFF
-mcs1024qam5gx2po=0xFFFFFF
+powoffs2gtna0=-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3
+powoffs2gtna1=-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2
+mcs1024qam2gpo=0xCCCC
+mcs1024qam5glpo=0xBABAA9
+mcs1024qam5gmpo=0xBABAA9
+mcs1024qam5ghpo=0xBABAA9
+mcs1024qam5gx1po=0xBABAA9
+mcs1024qam5gx2po=0xBABAA9
mcs8poexp=0
mcs9poexp=0
mcs10poexp=0
+# 1024QAM rates' offset for 6GHz UNII-5/6
+mcs1024qam6glpo=0xBBBBAA
+# 1024QAM rates' offset for 6GHz UNII-7/8
+mcs1024qam6gmpo=0xBBBBAA
#UL-OFDMA PPR's accros RU's
#currently programmed same PPR accross RU's
@@ -270,8 +334,10 @@
olpc_thresh5g=36
olpc_anchor5g=40
disable_olpc_2g=0
-olpc_thresh2g=36
-olpc_anchor2g=40
+olpc_thresh2g=56
+olpc_anchor2g=60
+olpc_thresh6g=44
+olpc_anchor6g=56
#LTE Coex Related
ltecxmux=0
@@ -309,7 +375,8 @@
btc_mode=1
# --- PAPD Cal related params ----
-txwbpapden=0 # 0:NBPAPD 1:WBPAPD
+# 0:NBPAPD 1:WBPAPD
+txwbpapden=1
# NB PAPD Cal params
# 0x5Gc02Gc0,5Gc12Gc1
nb_eps_offset=0x01db01da,0x01db01da
@@ -321,7 +388,7 @@
papdgainctrl5g=1
pacalshift2g=5,5
pacalshift5g=4,3
-nb_eps_stopidx=63
+eps_stopidx=63
# two-core specific variables for each of UNII-5/6/7/8 bands
# u5c0,u5c1,u6c0,u6c1,u7c0,u7c1,u8c0,u8c1
nb_txattn_6g=0,0,0,0,0,0,0,0
@@ -330,29 +397,78 @@
nb_bbmult_6g=80,80,80,80,80,80,80,80
nb_eps_offset_6g=475,475,475,475,475,475,475,475
papdgainctrl6g=1
-pacalshift6g20=4,5,4,5,4,4,4,4
-pacalshift6g40=3,4,3,4,4,4,4,4
-pacalshift6g80=5,5,5,5,4,4,4,4
+pacalshift6g20=3,4,4,4,4,4,4,4
+pacalshift6g40=3,4,4,3,4,4,4,4
+pacalshift6g80=4,3,4,3,4,4,4,4
# WB papd cal params
# c02g,c05g20,c05g40,c05g80,c12g,c15g20,c15g40,c15g80
-wb_txattn=0,0,0,0,0,0,0,0
+wb_txattn=0,1,1,1,0,1,1,1
wb_rxattn=0,0,0,0,0,0,0,0
-wb_tia_gain_mode=2,0,0,0,2,0,0,0
-wb_eps_offset=472,465,465,465,472,465,465,465
-wb_papdcalidx=10,0,0,0,10,0,0,0
-wb_bbmult=64,54,54,54,64,54,54,54
-wb_calref_db=26,26,26,26,26,26,26,26
-wb_txbuf_offset=43,43,43,43,43,43,43,43
+wb_tia_gain_mode=2,2,2,2,2,2,2,2
+wb_eps_offset=472,467,467,467,472,467,467,467
+wb_papdcalidx=10,10,10,10,10,10,10,10
+wb_bbmult=64,80,80,80,64,80,80,80
+wb_calref_db=26,24,24,24,26,24,24,24
+wb_txbuf_offset=43,42,39,39,43,42,39,39
wb_frac_del=255,255,255,255,255,255,255,255
wb_g_frac_bits=10,10,10,10,10,10,10,10
+# WB 6G cal params
+# u5c0,u5c1,u6c0,u6c1,u7c0,u7c1,u8c0,u8c1
+wb_txattn_6g20=1,1,1,1,1,1,1,1
+wb_txattn_6g40=1,1,1,1,1,1,1,1
+wb_txattn_6g80=1,1,1,1,1,1,1,1
+wb_rxattn_6g20=0,0,0,0,0,0,0,0
+wb_rxattn_6g40=0,0,0,0,0,0,0,0
+wb_rxattn_6g80=0,0,0,0,0,0,0,0
+wb_tia_gain_mode_6g20=2,2,2,2,6,6,6,6
+wb_tia_gain_mode_6g40=3,3,3,3,6,6,6,6
+wb_tia_gain_mode_6g80=4,4,4,4,6,6,6,6
+wb_papdcalidx_6g20=10,10,10,10,30,32,30,32
+wb_papdcalidx_6g40=25,25,25,25,30,32,30,32
+wb_papdcalidx_6g80=27,28,27,28,30,32,30,32
+wb_bbmult_6g20=66,64,70,64,76,76,76,86
+wb_bbmult_6g40=76,76,68,76,80,80,76,86
+wb_bbmult_6g80=76,80,66,80,84,84,84,80
+wb_eps_offset_6g20=467,469,467,467,472,473,471,470
+wb_eps_offset_6g40=463,463,462,463,471,472,471,470
+wb_eps_offset_6g80=464,465,464,466,471,472,468,472
+wb_calref_db_6g20=26,26,26,26,27,27,29,28
+wb_calref_db_6g40=30,30,32,30,27,27,29,28
+wb_calref_db_6g80=32,30,34,30,27,27,29,28
+
+#2nd LUT parameters
+wb_multipapd_en=1
+wb_PapdLutSel_idx_6g20=42,42,42,42,42,42,39,42
+wb_PapdLutSel_idx_6g40=42,42,42,42,42,42,42,45
+wb_PapdLutSel_idx_6g80=42,42,42,42,39,39,41,44
+wb_eps_index_offset_6g20=0,0,0,4,2,7,3,5
+wb_eps_index_offset_6g40=10,7,9,3,2,8,0,8
+wb_eps_index_offset_6g80=12,7,5,5,2,4,3,8
+wb_papdcalidx_6g20_lut1=10,10,10,10,30,32,30,32
+wb_papdcalidx_6g40_lut1=25,25,25,25,30,32,32,32
+wb_papdcalidx_6g80_lut1=27,28,27,28,30,10,10,32
+wb_bbmult_6g20_lut1=54,50,55,35,52,45,56,66
+wb_bbmult_6g40_lut1=28,42,32,45,70,42,50,45
+wb_bbmult_6g80_lut1=35,50,50,50,50,30,40,50
+wb_calref_db_6g20_lut1=30,26,30,30,30,30,32,28
+wb_calref_db_6g40_lut1=30,30,32,30,27,30,35,28
+wb_calref_db_6g80_lut1=28,30,30,30,30,30,32,28
+
+# 2g/5G 2nd PAPD LUT parameters applicable for -40degc
+wb_eps_offset_lut1=22,10,10,7,22,10,10,7
+wb_calref_db_lut1=23,19,19,19,23,19,19,19
+wb_papdcalidx_lut1=10,10,10,10,10,10,10,10
+wb_bbmult_lut1=25,40,40,40,25,40,40,40
+wb_PapdLutSel_idx_2g5g=53,52,53,52,53,52,53,52
+
# energy detect threshold
-ed_thresh2g=-63
-ed_thresh5g=-63
+ed_thresh2g=-65
+ed_thresh5g=-68
# energy detect threshold for EU
-eu_edthresh2g=-63
-eu_edthresh5g=-63
+eu_edthresh2g=-65
+eu_edthresh5g=-68
btldopu=0
@@ -366,6 +482,10 @@
#Enable LHL PS mode
lhl_ps_mode=3
+#Disable FastLPO
+fastlpo_dis=1
+fastlpo_pcie_dis=1
+
#Enable lesi and bphymrc
lesimode=1,1,1
bphymrc=1
@@ -384,6 +504,7 @@
tvpm_monitor_period=3
#temperature throttling, aggressive setting
tvpm_txc_txdc_burst=130,35,5
+tvpm_txc_txdc_init_step=50
##Dynamic Desense Params for 2 ant hybrid coex
#btcdyn_flags=3
@@ -395,3 +516,44 @@
#btcdyn_dsns_rows=2
#btcdyn_dsns_row1=5,-4,0,-50,-70
#btcdyn_dsns_row0=5,12,0,-50,-65
+
+
+ppr_hitemp_offset=70,10
+# idx 0: PPR temp thresh, default 150
+# idx 1: PPR temp thresh hysteresis, default 15
+cckbw202gpo_ht=0x6666
+# CCK high temp offset, 0.5dBm/step, rate(11,5.5,2,1Mbps)
+ofdmbw202gpo_ht=0x66666666
+# 2G OFDM temp offset, 0.5dBm/step, rate(54,48,36,24,18,12,9,6Mbps)
+mcsbw202gpo_ht=0x66666666
+# 2G BW20 VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw202gpo_1024qam_ht=0x66
+# 2G BW20 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+ofdmbw205gpo_ht=0x66666666
+# 5G OFDM temp offset, 0.5dBm/step, rate(54,48,36,24,18,12,9,6Mbps)
+mcsbw205gpo_ht=0x66666666
+# 5G BW20 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw205gpo_1024qam_ht=0x66
+# 5G BW20 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+mcsbw405gpo_ht=0x66666666
+# 5G BW40 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw405gpo_1024qam_ht=0x66
+# 5G BW40 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+mcsbw805gpo_ht=0x66666666
+# 5G BW80 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw805gpo_1024qam_ht=0x66
+# 5G BW80 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+ofdmbw206gpo_ht=0x66666666
+# 6G OFDM temp offset, 0.5dBm/step, rate(54,48,36,24,18,12,9,6Mbps)
+mcsbw206gpo_ht=0x66666666
+# 6G BW20 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw206gpo_1024qam_ht=0x66
+# 6G BW20 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+mcsbw406gpo_ht=0x66666666
+# 6G BW40 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw406gpo_1024qam_ht=0x66
+# 6G BW40 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
+mcsbw806gpo_ht=0x66666666
+# 6G BW80 HE/VHT/HT temp offset, 0.5dBm/step, rate(C9,C8,M7,M6,M5,M4,M3,M2-0)
+mcsbw806gpo_1024qam_ht=0x66
+# 6G BW80 HE/VHT temp offset, 0.5dBm/step, rate(C11,C10)
diff --git a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/firmware_pcie.trxse b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/firmware_pcie.trxse
index a58997b..b4f6f80 100755
--- a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/firmware_pcie.trxse
+++ b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/firmware_pcie.trxse
Binary files differ
diff --git a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/w870_rtecdc_mfg.trxs b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/w870_rtecdc_mfg.trxs
index eaeaa2b..7c31483 100755
--- a/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/w870_rtecdc_mfg.trxs
+++ b/meta/meta-mediatek-mt2735/recipes-kernel/modules/files/wifi/wg870/w870_rtecdc_mfg.trxs
Binary files differ
diff --git a/meta/meta-mediatek-mt2735/recipes-lynq/liblynq-network/liblynq-network.bb b/meta/meta-mediatek-mt2735/recipes-lynq/liblynq-network/liblynq-network.bb
index 67011b4..33f9346 100755
--- a/meta/meta-mediatek-mt2735/recipes-lynq/liblynq-network/liblynq-network.bb
+++ b/meta/meta-mediatek-mt2735/recipes-lynq/liblynq-network/liblynq-network.bb
@@ -16,6 +16,7 @@
'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
FILES_${PN} = "${base_libdir}/*.so "
+FILES_${PN} += "/data/ril/network"
FILES_${PN}-dev = "/test \
${includedir}"
@@ -48,7 +49,8 @@
if [ -d "${WORKONSRC}" ] ; then
install -d ${D}${includedir}/lynq_network
- cp -arf ${S}/include/lynq_network ${D}${includedir}/lynq_network
+ cp -arf ${S}/include/lynq_network ${D}${includedir}/lynq_network
+ install -d ${D}/data/ril/network
fi
}
diff --git a/meta/poky/meta/recipes-connectivity/connman/connman.inc b/meta/poky/meta/recipes-connectivity/connman/connman.inc
old mode 100755
new mode 100644
index 961a5da..f7e4749
--- a/meta/poky/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/poky/meta/recipes-connectivity/connman/connman.inc
@@ -15,7 +15,7 @@
inherit autotools pkgconfig systemd update-rc.d bluetooth update-alternatives
-DEPENDS = "dbus glib-2.0 ppp readline"
+DEPENDS = "dbus glib-2.0 ppp readline libmnl"
INC_PR = "r20"
@@ -159,6 +159,7 @@
${sysconfdir} ${sharedstatedir} ${localstatedir} \
${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
${datadir}/dbus-1/system-services/* \
+ ${datadir}/dbus-1/system.d/connman.conf \
${sysconfdir}/tmpfiles.d/connman_resolvconf.conf"
FILES_${PN}-dev += "${libdir}/connman/*/*.la"
@@ -173,7 +174,7 @@
provides a DBus API for managing VPN connections. All the different \
VPN technogies are implemented using plug-ins."
FILES_${PN}-vpn += "${sbindir}/connman-vpnd \
- ${sysconfdir}/dbus-1/system.d/connman-vpn-dbus.conf \
+ ${datadir}/dbus-1/system.d/connman-vpn-dbus.conf \
${datadir}/dbus-1/system-services/net.connman.vpn.service \
${systemd_unitdir}/system/connman-vpn.service"
diff --git a/meta/poky/meta/recipes-connectivity/connman/connman_1.35.bb b/meta/poky/meta/recipes-connectivity/connman/connman_1.35.bb
deleted file mode 100644
index ff21181..0000000
--- a/meta/poky/meta/recipes-connectivity/connman/connman_1.35.bb
+++ /dev/null
@@ -1,22 +0,0 @@
-require connman.inc
-
-SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
- file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
- file://0001-connman.service-stop-systemd-resolved-when-we-use-co.patch \
- file://connman \
- file://no-version-scripts.patch \
- file://includes.patch \
- file://0001-session-Keep-track-of-addr-in-fw_snat-session.patch \
- file://0001-giognutls-Fix-a-crash-using-wispr-over-TLS.patch \
- file://0001-inet-Add-prefixlen-to-iproute_default_function.patch \
- file://0002-inet-Implement-subnet-route-creation-deletion-in-ipr.patch \
- file://0003-inet-Implement-APIs-for-creating-and-deleting-subnet.patch \
- file://0004-session-Use-subnet-route-creation-and-deletion-APIs.patch \
- "
-SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch \
- "
-
-SRC_URI[md5sum] = "bae37b45ee9b3db5ec8115188f8a7652"
-SRC_URI[sha256sum] = "66d7deb98371545c6e417239a9b3b3e3201c1529d08eedf40afbc859842cf2aa"
-
-RRECOMMENDS_${PN} = "connman-conf"
diff --git a/meta/poky/meta/recipes-connectivity/connman/connman_1.41.bb b/meta/poky/meta/recipes-connectivity/connman/connman_1.41.bb
new file mode 100644
index 0000000..fba966f
--- /dev/null
+++ b/meta/poky/meta/recipes-connectivity/connman/connman_1.41.bb
@@ -0,0 +1,11 @@
+require connman.inc
+
+SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
+ "
+SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch \
+ "
+
+SRC_URI[md5sum] = "7f0a05fef485d3679cd73c8808f763f9"
+SRC_URI[sha256sum] = "79fb40f4fdd5530c45aa8e592fb16ba23d3674f3a98cf10b89a6576f198de589"
+
+RRECOMMENDS_${PN} = "connman-conf"
diff --git a/src/bsp/hsm/src/build/rules.mk b/src/bsp/hsm/src/build/rules.mk
index 05e41b0..b978e96 100644
--- a/src/bsp/hsm/src/build/rules.mk
+++ b/src/bsp/hsm/src/build/rules.mk
@@ -12,7 +12,7 @@
%.elf : $(OBJS) $(OBJDIR)/$(ARCH_LD_FILE)
$(foreach INCDIR, $(ALL_INCDIRS), $(shell $(BUILD_SYSTEM)/scripts/update_prebuilt_folder.sh $(INCDIR) $(HEADER_DIR)))
@ echo -ne '\tLD ' && echo $(OBJDIR)/$(notdir $@) | sed "s/.*hsm-[0-9].[0-9].[0-9]\///"
- @ $(LD) $(addprefix $(OBJDIR)/, $(filter %.o,$(notdir $^))) $(LD_FLAGS) -o $(OUTDIR)/$(notdir $@)
+ @ $(LD) $(addprefix $(OBJDIR)/, $(filter %.o,$(notdir $^))) $(PWD)/src/driver/platform/mt2735/efuse.a $(LD_FLAGS) -o $(OUTDIR)/$(notdir $@)
%.bin: %.elf | config
@ echo -ne '\tBIN ' && echo $(OUTDIR)/$(notdir $@) | sed "s/.*hsm-[0-9].[0-9].[0-9]\///"
diff --git a/src/bsp/hsm/src/middleware/libraries/include/aes_sha_task.h b/src/bsp/hsm/src/middleware/libraries/include/aes_sha_task.h
index b48af9b..3d95e71 100644
--- a/src/bsp/hsm/src/middleware/libraries/include/aes_sha_task.h
+++ b/src/bsp/hsm/src/middleware/libraries/include/aes_sha_task.h
@@ -70,6 +70,7 @@
CRYPTO_SECCOUNTERINCREMENT = 0x09,
CRYPTO_SECCOUNTERREAD = 0x0A,
CRYPTO_RANDOMGENERATE = 0x0B,
+ CRYPTO_PLATFORMIDGET = 0x0C,
};
enum Crypto_VerifyResultType
diff --git a/src/bsp/hsm/src/middleware/libraries/services/optee/trng_task.c b/src/bsp/hsm/src/middleware/libraries/services/optee/trng_task.c
index eb2f0d3..bd2b0e2 100644
--- a/src/bsp/hsm/src/middleware/libraries/services/optee/trng_task.c
+++ b/src/bsp/hsm/src/middleware/libraries/services/optee/trng_task.c
@@ -52,6 +52,7 @@
//#include <crypto_test.h>
#include <crypto_rng.h>
#include <crypto_common.h>
+#include <efuse_devinfo.h>
void trng_task_init(void);
@@ -137,6 +138,23 @@
return 1;
}
+static int32_t crypto_get_platform_id(job_struct *pjob)
+{
+ TRNG_FLOW(" == PLATFORMID ==\r\n");
+
+ uint8_t *outputPtr = (uint8_t *)pjob->outputPtr;
+ int ret = -1;
+
+ int Len = pjob->outputLength;
+ if (Len < 4)
+ return ret;
+ Len = 4;
+ ret = read_efuse(0, outputPtr, Len);
+ __SHOW_VAL("PLATFORMID output", outputPtr, Len);
+
+ return ret;
+}
+
void trng_cmd_handler(job_struct *pjob)
{
switch (pjob->service)
@@ -151,6 +169,15 @@
*(uint8_t*)pjob->retValPtr = MBOX_SERV_FEEDBACK_MAGIC_NUM;
break;
+ case CRYPTO_PLATFORMIDGET:
+ TRNG_FLOW("--> CRYPTO_PLATFORMIDGET\r\n");
+
+ crypto_get_platform_id(pjob);
+
+ // Write jobId & result to MBOX
+// WriteBackJobId(pJobRsv->jobId);
+ *(uint8_t*)pjob->retValPtr = MBOX_SERV_FEEDBACK_MAGIC_NUM;
+ break;
default:
break;
diff --git a/src/bsp/hsm/src/middleware/libraries/services/trustonic/trng_task.c b/src/bsp/hsm/src/middleware/libraries/services/trustonic/trng_task.c
index 64dd371..a39c69c 100644
--- a/src/bsp/hsm/src/middleware/libraries/services/trustonic/trng_task.c
+++ b/src/bsp/hsm/src/middleware/libraries/services/trustonic/trng_task.c
@@ -263,6 +263,7 @@
switch(pJobRsv->jobPrimitiveInfo.primitiveInfo.service)
{
case CRYPTO_RANDOMGENERATE:
+ case CRYPTO_PLATFORMIDGET:
LOGE("--> CRYPTO_RANDOMGENERATE\r\n");
// Check if paras is valid?
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/include/pkcs11.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/include/pkcs11.h
index a580990..bc580f2 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/include/pkcs11.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/include/pkcs11.h
@@ -1137,6 +1137,10 @@
CK_FLAGS flags,
CK_SLOT_ID_PTR slot,
CK_VOID_PTR rsv);
+ CK_RV (*C_GetPlatformId)(
+ CK_SESSION_HANDLE session,
+ CK_BYTE_PTR out,
+ CK_ULONG len);
};
/* Optional init_args structure for C_Initialize */
@@ -1560,6 +1564,11 @@
CK_BYTE_PTR out,
CK_ULONG_PTR out_len);
+CK_RV C_GetPlatformId(
+ CK_SESSION_HANDLE session,
+ CK_BYTE_PTR out,
+ CK_ULONG len);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_api.c b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_api.c
index 20e8008..c86edda 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_api.c
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_api.c
@@ -91,6 +91,7 @@
REGISTER_CK_FUNCTION(C_GetFunctionStatus),
REGISTER_CK_FUNCTION(C_CancelFunction),
REGISTER_CK_FUNCTION(C_WaitForSlotEvent),
+ REGISTER_CK_FUNCTION(C_GetPlatformId),
};
/*
@@ -2343,4 +2344,32 @@
rv = ck_utils(session, mechanism, in, in_len, out, &out_size);
return rv;
-}
\ No newline at end of file
+}
+
+CK_RV C_GetPlatformId(CK_SESSION_HANDLE session,
+ CK_BYTE_PTR out,
+ CK_ULONG len)
+{
+ CK_RV rv;
+ printf("cy-C_GetPlatformId\n");
+
+ if (!lib_inited)
+ return CKR_CRYPTOKI_NOT_INITIALIZED;
+
+ rv = ck_get_platform_id(session, out, len);
+
+ switch (rv) {
+ case CKR_ARGUMENTS_BAD:
+ case CKR_ATTRIBUTE_READ_ONLY:
+ case CKR_ATTRIBUTE_TYPE_INVALID:
+ case CKR_ATTRIBUTE_VALUE_INVALID:
+ case CKR_GENERAL_ERROR:
+ case CKR_OK:
+ break;
+ default:
+ assert(!rv);
+ }
+
+ return rv;
+}
+
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.c b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.c
index 987b502..6d3d8d2 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.c
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.c
@@ -1045,4 +1045,26 @@
release_serial_object(&obj);
free(ctrl);
return rv;
-}
\ No newline at end of file
+}
+
+CK_RV ck_get_platform_id(CK_SESSION_HANDLE session,
+ CK_BYTE_PTR out,
+ CK_ULONG len)
+{
+ CK_RV rv;
+ uint32_t ctrl;
+ size_t ctrl_size;
+ void *out_buf = out;
+ size_t out_size = len;
+
+ /* params = [session-handle] */
+ ctrl = session;
+ ctrl_size = sizeof(ctrl);
+
+ rv = ck_invoke_ta_in_out(ck_session2sks_ctx(session),
+ SKS_CMD_GET_PLATFORM_ID,
+ &ctrl, ctrl_size, NULL, 0,
+ out_buf, &out_size);
+ return rv;
+}
+
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.h
index 467db93..643800e 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/host/src/pkcs11_processing.h
@@ -153,4 +153,9 @@
CK_ULONG in_len,
CK_BYTE_PTR out,
CK_ULONG_PTR out_len);
+
+CK_RV ck_get_platform_id(CK_SESSION_HANDLE session,
+ CK_BYTE_PTR out,
+ CK_ULONG len);
+
#endif /*__PKCS11_PROCESSING_H*/
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/mtk_crypto.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/mtk_crypto.h
index e2e1d96..405871c 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/mtk_crypto.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/mtk_crypto.h
@@ -73,6 +73,7 @@
CRYPTO_SECCOUNTERINCREMENT = 0x09,
CRYPTO_SECCOUNTERREAD = 0x0A,
CRYPTO_RANDOMGENERATE = 0x0B,
+ CRYPTO_PLATFORMIDGET = 0x0C,
};
enum Crypto_VerifyResultType
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/sks_ta.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/sks_ta.h
index bdf8965..dc9898a 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/sks_ta.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/include/sks_ta.h
@@ -690,6 +690,7 @@
#define SKS_CMD_UTILS 0x00000035
+#define SKS_CMD_GET_PLATFORM_ID 0x00000036
/*
* Command return codes
* SKS_CKR_<x> relates cryptoki CKR_<x> in meaning if not in value.
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/entry.c b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/entry.c
index ea0f035..c24149f 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/entry.c
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/entry.c
@@ -388,6 +388,10 @@
rc = entry_utils(teesess, ctrl, p1_in, p2_out);
break;
+ case SKS_CMD_GET_PLATFORM_ID:
+ rc = entry_get_platform_id(teesess, ctrl, p1_in, p2_out);
+ break;
+
default:
EMSG("Command ID 0x%x is not supported", cmd);
return TEE_ERROR_NOT_SUPPORTED;
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.c b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.c
index 73a850a..a94a1f1 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.c
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.c
@@ -1459,6 +1459,7 @@
if (!ctrl || !out)
return SKS_BAD_PARAM;
+ EMSG(" entry_generate_random enter!! \n");
rv = mtk_generate_random(out);
return rv;
@@ -1876,4 +1877,20 @@
TEE_Free(proc_params);
return rv;
-}
\ No newline at end of file
+}
+
+uint32_t entry_get_platform_id(uintptr_t teesess, TEE_Param *ctrl,
+ TEE_Param *in, TEE_Param *out)
+{
+ uint32_t rv = SKS_OK;
+ EMSG(" entry_get_platform_id enter!! \n");
+
+
+ if (!ctrl || !out)
+ return SKS_BAD_PARAM;
+
+ rv = mtk_get_platform_id(out);
+
+ return rv;
+}
+
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.h
index dc7525f..c8d60f7 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing.h
@@ -67,6 +67,9 @@
uint32_t entry_utils(uintptr_t teesess,
TEE_Param *ctrl, TEE_Param *in, TEE_Param *out);
+uint32_t entry_get_platform_id(uintptr_t teesess, TEE_Param *ctrl,
+ TEE_Param *in, TEE_Param *out);
+
/*
* Util
*/
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.c b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.c
index 4ed627c..8cd0050 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.c
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.c
@@ -1699,3 +1699,28 @@
return res;
}
+
+uint32_t mtk_get_platform_id(TEE_Param *out)
+{
+ job_struct _job = {0};
+
+ if (out == NULL)
+ return SKS_BAD_PARAM;
+
+ _job.outputPtr = (uint8_t *)out->memref.buffer;
+ _job.outputLength = out->memref.size;
+
+ //_job.service = CRYPTO_RANDOMGENERATE;
+ _job.service = CRYPTO_PLATFORMIDGET;
+ _job.family = CRYPTO_ALGOFAM_RNG;
+ _job.mode = CRYPTO_ALGOMODE_NOT_SET;
+
+ SKS_HSM_DEBUG(" ==> _job.outputLength: %d\n", _job.outputLength);
+
+ Send_job(&_job);
+
+ __SHOW_VAL("TRNG val", _job.outputPtr, _job.outputLength);
+
+ return SKS_OK;
+}
+
diff --git a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.h b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.h
index f27b4be..56d2434 100644
--- a/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.h
+++ b/src/bsp/trustzone/optee/source/mt2xxx/optee_services/secure_key_services/ta/src/processing_mtk_hsm.h
@@ -132,4 +132,6 @@
extern uint32_t mtk_dump_hsm_log(void);
+extern uint32_t mtk_get_platform_id(TEE_Param *out);
+
#endif // __PROCESSING_MTK_HSM_H
diff --git a/src/connectivity/gps/2.0/mtk_mnld/mnld_entity/src/mnld.c b/src/connectivity/gps/2.0/mtk_mnld/mnld_entity/src/mnld.c
index d5cd3b1..b8141df 100755
--- a/src/connectivity/gps/2.0/mtk_mnld/mnld_entity/src/mnld.c
+++ b/src/connectivity/gps/2.0/mtk_mnld/mnld_entity/src/mnld.c
@@ -80,7 +80,7 @@
extern char chip_id[100];
#endif
-int log_dbg_level = L_DEBUG;
+int log_dbg_level = L_ERROR;
extern client_list g_hal_basic_client_list;
extern client_list g_hal_ext_client_list;
diff --git a/src/kernel/linux/v4.19/arch/arm64/configs/auto2735evb_defconfig b/src/kernel/linux/v4.19/arch/arm64/configs/auto2735evb_defconfig
index cb84b4f..335e5da 100644
--- a/src/kernel/linux/v4.19/arch/arm64/configs/auto2735evb_defconfig
+++ b/src/kernel/linux/v4.19/arch/arm64/configs/auto2735evb_defconfig
@@ -807,3 +807,7 @@
#dongyu@2022.7.12 modify for RTC/PCF85063 start
CONFIG_RTC_DRV_PCF85063=y
#dongyu@2022.7.12 modify for RTC/PCF85063 end
+
+#you.chen@2022-07-16 for emmc health
+CONFIG_MMC_HEALTH=y
+
diff --git a/src/kernel/linux/v4.19/drivers/mmc/core/block.c b/src/kernel/linux/v4.19/drivers/mmc/core/block.c
index 87cfd13..e5566bd 100644
--- a/src/kernel/linux/v4.19/drivers/mmc/core/block.c
+++ b/src/kernel/linux/v4.19/drivers/mmc/core/block.c
@@ -139,6 +139,11 @@
/* debugfs files (only in main mmc_blk_data) */
struct dentry *status_dentry;
struct dentry *ext_csd_dentry;
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+ struct dentry *health_dentry;
+#endif
+//you.chen@2022-07-16 for emmc health end
};
/* Device type for RPMB character devices */
@@ -1079,6 +1084,14 @@
ext_csd = mq_rq->drv_op_data;
ret = mmc_get_ext_csd(card, ext_csd);
break;
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+ case MMC_DRV_OP_GET_HEALTH:
+ ext_csd = mq_rq->drv_op_data;
+ ret = mmc_get_health(card, ext_csd);
+ break;
+#endif
+//you.chen@2022-07-16 for emmc health end
default:
pr_err("%s: unknown driver specific operation\n",
md->disk->disk_name);
@@ -3074,6 +3087,96 @@
.llseek = default_llseek,
};
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+#define HEALTH_STR_LEN 14
+static int mmc_health_open(struct inode *inode, struct file *filp)
+{
+ struct mmc_card *card = inode->i_private;
+ struct mmc_blk_data *md = dev_get_drvdata(&card->dev);
+ struct mmc_queue *mq = &md->queue;
+ struct request *req;
+ char *buf;
+ u8 *ext_csd;
+ int err;
+ ssize_t n;
+ unsigned int amount, health;
+
+ //printk("cy-health open\n");
+ buf = kmalloc(EXT_CSD_STR_LEN + 1, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ /* Ask the block layer for the EXT CSD */
+ req = blk_get_request(mq->queue, REQ_OP_DRV_IN, 0);
+ if (IS_ERR(req)) {
+ err = PTR_ERR(req);
+ goto out_free;
+ }
+ req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_HEALTH;
+ req_to_mmc_queue_req(req)->drv_op_data = &ext_csd;
+ //printk("cy- blk_execute_rq begin\n");
+ blk_execute_rq(mq->queue, NULL, req, 0);
+ //printk("cy- blk_execute_rq end\n");
+ err = req_to_mmc_queue_req(req)->drv_op_result;
+ //printk("cy-blk_put_request begin\n");
+ blk_put_request(req);
+ //printk("cy-blk_put_request end\n");
+ if (err) {
+ pr_err("FAILED %d\n", err);
+ goto out_free;
+ }
+
+ memcpy(&amount, ext_csd + 64, 4);
+ memcpy(&health, ext_csd + 184, 4);
+ if (health > 100) {
+ pr_err("Health [%d] large than 100\n", health);
+ health = 100;
+ }
+
+ n = sprintf(buf, "%010u-%03u", amount*100, health);
+
+ if (n != HEALTH_STR_LEN) {
+ printk("cy-bad count %d , %d\n", (int)n , HEALTH_STR_LEN);
+ err = -EINVAL;
+ kfree(ext_csd);
+ goto out_free;
+ }
+
+ filp->private_data = buf;
+ kfree(ext_csd);
+ return 0;
+
+out_free:
+ kfree(buf);
+ return err;
+}
+
+static ssize_t mmc_health_read(struct file *filp, char __user *ubuf,
+ size_t cnt, loff_t *ppos)
+{
+ char *buf = filp->private_data;
+
+ //printk("cy-mmc_ext_csd_read\n");
+ return simple_read_from_buffer(ubuf, cnt, ppos,
+ buf, HEALTH_STR_LEN);
+}
+
+static int mmc_health_release(struct inode *inode, struct file *file)
+{
+ kfree(file->private_data);
+ return 0;
+}
+
+static const struct file_operations mmc_dbg_health_fops = {
+ .open = mmc_health_open,
+ .read = mmc_health_read,
+ .release = mmc_health_release,
+ .llseek = default_llseek,
+};
+#endif
+//you.chen@2022-07-16 for emmc health end
+
static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
{
struct dentry *root;
@@ -3099,6 +3202,15 @@
return -EIO;
}
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+ if (mmc_card_mmc(card)) {
+ md->health_dentry=
+ debugfs_create_file("health", S_IRUSR, root, card,
+ &mmc_dbg_health_fops);
+ }
+#endif
+//you.chen@2022-07-16 for emmc health end
return 0;
}
@@ -3117,6 +3229,15 @@
debugfs_remove(md->ext_csd_dentry);
md->ext_csd_dentry = NULL;
}
+
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+ if (!IS_ERR_OR_NULL(md->health_dentry)) {
+ debugfs_remove(md->health_dentry);
+ md->health_dentry= NULL;
+ }
+#endif
+//you.chen@2022-07-16 for emmc health end
}
#else
diff --git a/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.c b/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.c
index 873b2aa..fa04e2f 100644
--- a/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.c
+++ b/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.c
@@ -381,6 +381,60 @@
}
EXPORT_SYMBOL_GPL(mmc_get_ext_csd);
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+int mmc_get_health(struct mmc_card *card, u8 **new_health)
+{
+ int err;
+ u8 *ext_csd;
+
+ struct mmc_host *host = card->host;
+ struct mmc_command cmd = {};
+
+
+ if (!card || !new_health)
+ return -EINVAL;
+
+
+ /*
+ * As the ext_csd is so large and mostly unused, we don't store the
+ * raw block in mmc_card.
+ */
+ ext_csd = kzalloc(512, GFP_KERNEL);
+ if (!ext_csd)
+ return -ENOMEM;
+
+ mmc_retune_hold(host);
+
+ cmd.opcode = 62;
+ cmd.arg = 0x96C9D71C;
+ cmd.flags = MMC_CMD_AC;
+ cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B;
+ cmd.busy_timeout = 1000;
+
+ err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
+ if (err)
+ {
+ //printk("cy2-return error 62\n");
+ mmc_retune_release(host);
+ return err;
+ }
+
+ err = mmc_send_cxd_data(card, card->host, 63, ext_csd,
+ 512);
+ if (err)
+ kfree(ext_csd);
+ else
+ *new_health = ext_csd;
+
+ mmc_retune_release(host);
+ //printk("cy2-return\n");
+ return err;
+}
+EXPORT_SYMBOL_GPL(mmc_get_health);
+#endif
+//you.chen@2022-07-16 for emmc health end
+
int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp)
{
struct mmc_command cmd = {};
diff --git a/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.h b/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.h
index a1390d4..0bd4025 100644
--- a/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.h
+++ b/src/kernel/linux/v4.19/drivers/mmc/core/mmc_ops.h
@@ -33,6 +33,11 @@
int mmc_interrupt_hpi(struct mmc_card *card);
int mmc_can_ext_csd(struct mmc_card *card);
int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+int mmc_get_health(struct mmc_card *card, u8 **new_heath);
+#endif
+//you.chen@2022-07-16 for emmc health end
int mmc_switch_status(struct mmc_card *card);
int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
diff --git a/src/kernel/linux/v4.19/drivers/mmc/core/queue.h b/src/kernel/linux/v4.19/drivers/mmc/core/queue.h
index 9bf3c92..32ab77f 100644
--- a/src/kernel/linux/v4.19/drivers/mmc/core/queue.h
+++ b/src/kernel/linux/v4.19/drivers/mmc/core/queue.h
@@ -59,6 +59,11 @@
MMC_DRV_OP_BOOT_WP,
MMC_DRV_OP_GET_CARD_STATUS,
MMC_DRV_OP_GET_EXT_CSD,
+//you.chen@2022-07-16 for emmc health begin
+#ifdef CONFIG_MMC_HEALTH
+ MMC_DRV_OP_GET_HEALTH,
+#endif
+//you.chen@2022-07-16 for emmc health end
};
struct mmc_queue_req {
diff --git a/src/kernel/linux/v4.19/drivers/mmc/host/Kconfig b/src/kernel/linux/v4.19/drivers/mmc/host/Kconfig
index cae1c5a..43ea78c 100644
--- a/src/kernel/linux/v4.19/drivers/mmc/host/Kconfig
+++ b/src/kernel/linux/v4.19/drivers/mmc/host/Kconfig
@@ -952,3 +952,10 @@
If you have a controller with this interface, say Y or M here.
If unsure, say N.
+
+config MMC_HEALTH
+ tristate "SD/MMC Card Health Interface support"
+ depends on MMC_MTK
+ help
+ This selects the card health Interface.
+
diff --git a/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c b/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
index 592a388..54336d3 100755
--- a/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
+++ b/src/kernel/linux/v4.19/drivers/net/phy/marvell-88q.c
@@ -134,6 +134,7 @@
SUPPORTED_1000baseT_Full | SUPPORTED_100baseT_Full;
phydev->state = PHY_NOLINK;
phydev->autoneg = AUTONEG_DISABLE;
+ phy_write(phydev, MII_ADDR_C45 | 0x038033, 0x6801);
phy_write(phydev, MII_ADDR_C45 | 0x010000, 0x840);
phy_write(phydev, MII_ADDR_C45 | 0x03FE1B, 0x48);
phy_write(phydev, MII_ADDR_C45 | 0x01FFE4, 0x6B6);
@@ -150,6 +151,8 @@
phy_write(phydev, MII_ADDR_C45 | 0x078032, 0x2020);
phy_write(phydev, MII_ADDR_C45 | 0x078031, 0xA28);
phy_write(phydev, MII_ADDR_C45 | 0x078031, 0xC28);
+ phy_write(phydev, MII_ADDR_C45 | 0x03803A, 0xDA44);
+ phy_write(phydev, MII_ADDR_C45 | 0x038039, 0x2C0B);
phy_write(phydev, MII_ADDR_C45 | 0x038027, 0x1);//TC10 sleep/wakeup capability support
q2110_timing_init(phydev);
diff --git a/src/lynq/framework/lynq-ril-service/src/main.cpp b/src/lynq/framework/lynq-ril-service/src/main.cpp
index bf6f28e..043068f 100755
--- a/src/lynq/framework/lynq-ril-service/src/main.cpp
+++ b/src/lynq/framework/lynq-ril-service/src/main.cpp
@@ -61,6 +61,29 @@
NULL
};
+/**
+ * @brief success return 1 else return 0
+ *
+ * @return int
+ */
+static int lynq_check_modem_state(void)
+{
+ FILE *fp;
+ char buffer[64]={};
+ fp = popen("cat /sys/kernel/ccci/boot","r");
+ fgets(buffer,sizeof(buffer),fp);
+ if(buffer[4] == '4')
+ {
+ pclose(fp);
+ return 1;
+ }
+ else
+ {
+ pclose(fp);
+ return 0;
+ }
+}
+
int main(int argc, char **argv) {
/*lei add for gsw
reason:Socket sending failed at GSW
@@ -117,6 +140,15 @@
android::startGdbusLoop();
RLOGD("RIL_Init RIL_register completed");
printf("DemoApp launch done!\n");
+ if(!lynq_check_modem_state())
+ {
+ system("uci set lynq_uci.sdk_ready=1");
+ }
+ else
+ {
+ sleep(2);
+ system("uci set lynq_uci.sdk_ready=0");
+ }
while (true) {
sleep(UINT32_MAX);
}
diff --git a/src/lynq/framework/lynq-ril-service/src/ril.cpp b/src/lynq/framework/lynq-ril-service/src/ril.cpp
index e970e9b..2d202f7 100755
--- a/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -178,6 +178,7 @@
char *at_buf_ext[MAX_AT_CMD];
int sockfd = 0;
int imei_cnt = 0;
+bool sdk_ready = true;
/*lei add*/
#if RILC_LOG
static char printBuf[PRINTBUF_SIZE];
@@ -4249,6 +4250,31 @@
}
}
}
+ /*lei add for sdk ready 2022/8/17*/
+ else
+ {
+ if(sdk_ready == true)
+ {
+ p.setDataPosition(0);
+ if(p.dataAvail() > 0)
+ {
+ p.readInt32(&resp_type);
+ p.readInt32(&request);
+ p.readInt32(&slot_id);
+ p.readInt32(&error1);
+ if(!error1)
+ {
+ system("uci set lynq_uci.sdk_ready=0");
+ }
+ else
+ {
+ system("uci set lynq_uci.sdk_ready=2");
+ }
+ }
+ sdk_ready = false;
+ }
+ }
+ /*lei add for sdk ready 2022/8/17*/
break;
}
/*lei add for AT+CGSN 2022/8/4*/
diff --git a/src/lynq/lib/liblynq-call/lynq_call.cpp b/src/lynq/lib/liblynq-call/lynq_call.cpp
index 0775118..b90b44b 100755
--- a/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -1146,6 +1146,10 @@
int lynq_call(int* handle,char addr[])
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1227,6 +1231,10 @@
}
int lynq_call_answer()
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1252,6 +1260,10 @@
}
int lynq_call_hungup(int* handle)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1294,6 +1306,10 @@
}
int lynq_call_hungup_all()
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1319,6 +1335,10 @@
}
int lynq_wait_incoming_call(int *handle)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
waitIncomingCall();
*handle = lynqIncomingCallId;
LYINFLOG("lynq incoming call id:%d",lynqIncomingCallId);
@@ -1327,12 +1347,20 @@
int lynq_set_auto_answercall(const int mode)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
global_call_auto_answer = mode;
LYINFLOG("auto answer call mode =%d",mode);
return 0;
}
int lynq_get_current_call_state(int *handle, int *call_state,int *toa,int *direction,char addr[])
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
int lynq_call_id = 0;
LYINFLOG("lynq_get_current_call_state begin ");
if(handle==NULL)
@@ -1366,6 +1394,10 @@
int lynq_set_mute_mic(const int enable)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(!judge_mic(enable)){
return LYNQ_E_CONFLICT;
}
@@ -1373,6 +1405,10 @@
}
int lynq_get_mute_mic(int *status)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
return lynq_get_common_request(54,status);//RIL_REQUEST_GET_MUTE
}
@@ -1401,6 +1437,10 @@
int lynq_switch_waiting_or_holding_and_active(void)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1427,6 +1467,10 @@
int lynq_hangup_waiting_or_background(void)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1453,6 +1497,10 @@
int lynq_hangup_foreground_resume_background(void)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
Parcel p;
lynq_client_t client;
int resp_type = -1;
@@ -1479,6 +1527,10 @@
int lynq_set_DTMF(const char callnum)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(!judge_dtmf(callnum))
{
return LYNQ_E_CONFLICT;
@@ -1806,6 +1858,10 @@
void* lynq_start_rtp_cmd(void *arg)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
int* rtp_mode= (int*) arg;
char cmd[384];
LYINFLOG("lynq_start_rtp_cmd: rtp_mode is %d",(*rtp_mode));
@@ -1849,6 +1905,10 @@
/*set*/
int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
int ret;
int i;
@@ -1954,6 +2014,10 @@
/*get*/
LYNQ_Audio_Mode lynq_get_voice_audio_mode()
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(g_rtp_thread_valid[0])
{
return AUDIO_MODE_RTP;
@@ -1965,6 +2029,10 @@
}
int lynq_get_remote_rtp_ip(char* ip, const int ip_length)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(ip==NULL)
{
LYERRLOG("ip is NULL");
@@ -1982,6 +2050,10 @@
}
int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port)
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(port==NULL)
{
return 1;
@@ -1998,6 +2070,10 @@
}
int lynq_get_rtp_param(int* clock_rate, int* channels, int* latency)//only for client mode
{
+ if(g_lynq_call_init_flag == 0)
+ {
+ return -1;
+ }
if(clock_rate == NULL || channels ==NULL || latency ==NULL)
{
LYERRLOG("input parameter is NULL");
diff --git a/src/lynq/lib/liblynq-data/lynq_data.cpp b/src/lynq/lib/liblynq-data/lynq_data.cpp
index c34f484..fc0c4a2 100755
--- a/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -23,8 +23,7 @@
#define USER_LOG_TAG "LYNQ_DATA"
#define LYNQ_DATA_UCI_BUF 258
-#define LYNQ_DATA_UCI_APN_SECTION "lynq_apn_info"
-#define LYNQ_DATA_UCI_APN_KEY "insertId"
+
@@ -921,35 +920,17 @@
/*Warren add for T800 platform 2021/11/19 end*/
/*Typethree add for T800 platform 2022/04/21 start*/
-int insert_apn_char(char *agc, char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier)
+
+int insert_apn_char(char *agc, char *id,char *mcc, char *mnc, char *apn, char *apntype, char *user, char *password, char *normalprotocol, char *roamingprotocol, char *carrier)
{
- int ret = 0;
- int fact_apn_id=0;
- int tmp_id_num = 0;
- char tmp_ID[16]="";
- char apn_info_buf[LYNQ_DATA_UCI_BUF]="";
- char apn_info_outbuf[LYNQ_DATA_UCI_BUF];
char strtmp[10][32];
-
- sprintf(apn_info_buf,"%s.%s.%s",LYNQ_UCI_FILE,LYNQ_DATA_UCI_APN_SECTION,LYNQ_DATA_UCI_APN_KEY);
- ret = lynq_uci_get(apn_info_buf,apn_info_outbuf);
- if (ret != UCI_OK)
+ if (id == NULL)
{
- LYERRLOG("Description APN failed to allocate an ID :ret = -1");
- return -1;
+ sprintf(strtmp[0], "id=;");
}
- tmp_id_num = atoi(apn_info_outbuf);
- fact_apn_id = -tmp_id_num;
- tmp_id_num = tmp_id_num + 1;
-
- apn_info_buf[LYNQ_DATA_UCI_BUF]="";
- sprintf(apn_info_buf,"%s.%s.%s=%d",LYNQ_UCI_FILE,LYNQ_DATA_UCI_APN_SECTION,LYNQ_DATA_UCI_APN_KEY,tmp_id_num);
-
- ret = lynq_uci_set(apn_info_buf);
- if (ret != UCI_OK)
+ else
{
- LYERRLOG("Description APN failed to allocate an ID :ret = -2");
- return -1;
+ sprintf(strtmp[0], "id=%s;", id);
}
if (mcc == NULL)
{
@@ -961,7 +942,7 @@
}
if (mnc == NULL)
{
- sprintf(strtmp[12], "mnc=;");
+ sprintf(strtmp[2], "mnc=;");
}
else
{
@@ -1023,7 +1004,7 @@
{
sprintf(strtmp[9], "carrier=%s;", carrier);
}
- sprintf(agc, "id=%d;%s%s%s%s%s%s%s%s%s",fact_apn_id, strtmp[1], strtmp[2], strtmp[3], strtmp[4], strtmp[5], strtmp[6], strtmp[7], strtmp[8], strtmp[9]);
+ sprintf(agc, "%s%s%s%s%s%s%s%s%s%s",strtmp[0], strtmp[1], strtmp[2], strtmp[3], strtmp[4], strtmp[5], strtmp[6], strtmp[7], strtmp[8], strtmp[9]);
return 0;
}
@@ -1226,19 +1207,15 @@
Parcel p;
if (cmd == 0) // insert apn db
{
- res = insert_apn_char(argc, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
- if (res != UCI_OK)
- {
- LYERRLOG("Description APN failed to allocate an ID");
- return -1;
- }
+ res = insert_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
+
client.uToken = Global_uToken;
client.request = 2000 + 193; // RIL_REQUEST_MODIFY_APN
client.paramLen = 2;
bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
sprintf(client.param, "%d %s", cmd, argc);
}
- else if (cmd == 1)
+ else if (cmd == 1) //delete apn db
{
if (NULL == id)
{
@@ -1251,7 +1228,7 @@
bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
sprintf(client.param, "%d %s", cmd, argc);
}
- else if (cmd == 2)
+ else if (cmd == 2) //query apn db
{
query_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
client.uToken = Global_uToken;
@@ -1260,7 +1237,7 @@
bzero(client.param, LYNQ_REQUEST_PARAM_BUF);
sprintf(client.param, "%d %s", cmd, argc);
}
- else if (cmd == 3)
+ else if (cmd == 3) //modify apn db
{
modify_apn_char(argc, id, mcc, mnc, apn, apntype, user, password, normalprotocol, roamingprotocol, carrier);
client.uToken = Global_uToken;
diff --git a/src/lynq/lib/liblynq-fota/include/iot_rock.h b/src/lynq/lib/liblynq-fota/include/iot_rock.h
index 3fe2427..aa7236d 100755
--- a/src/lynq/lib/liblynq-fota/include/iot_rock.h
+++ b/src/lynq/lib/liblynq-fota/include/iot_rock.h
@@ -26,16 +26,20 @@
#define PATCH_MD1IMG (4)
#define PATCH_MD1DSP (5)
#define PATCH_VBMETA (6)
-#define PATCH_BL33 (7)
-#define FULL_SYSTEM (8)
-#define FULL_BOOT (9)
-#define FULL_TEE (10)
-#define FULL_MD1IMG (11)
-#define FULL_MD1DSP (12)
-#define FULL_VBMETA (13)
-#define FULL_BL33 (14)
+#define PATCH_OEMAPP (7)
+#define PATCH_OEMAPP2 (8)
+#define PATCH_BL33 (9)
+#define FULL_SYSTEM (10)
+#define FULL_BOOT (11)
+#define FULL_TEE (12)
+#define FULL_MD1IMG (13)
+#define FULL_MD1DSP (14)
+#define FULL_VBMETA (15)
+#define FULL_OEMAPP (16)
+#define FULL_OEMAPP2 (17)
+#define FULL_BL33 (18)
-#define MAX_OTA_ROLE (14)
+#define MAX_OTA_ROLE (18)
@@ -70,6 +74,8 @@
unsigned int md1img; //md1img 差分包大小
unsigned int md1dsp; //md1dsp 差分包大小
unsigned int vbmeta; //vbmeta 差分包大小
+ unsigned int oemapp;
+ unsigned int oemapp2;
unsigned int bl33; //bl33 差分包大小
unsigned int full_sys; //system 整包大小
unsigned int full_boot; //boot
@@ -77,7 +83,9 @@
unsigned int full_md1img; // 整包大小
unsigned int full_md1dsp; //md1dsp 整包大小
unsigned int full_vbmeta; //vbmeta 整包大小
- unsigned int full_bl33; //bl33 整包大小
+ unsigned int full_oemapp;
+ unsigned int full_oemapp2;
+ unsigned int full_bl33; //bl33 整包大小
} DELTA_HEAD;
typedef struct {
@@ -113,7 +121,7 @@
//#define DELTA_HEARD_SIZE (4*5)
-#define DELTA_HEARD_SIZE (4*7 + 4*7)
+#define DELTA_HEARD_SIZE (4*9 + 4*9)
#define DELTA_FULL_HEARD_SIZE 8
diff --git a/src/lynq/lib/liblynq-fota/rock_ua/rock_ua.c b/src/lynq/lib/liblynq-fota/rock_ua/rock_ua.c
index d31a0d9..718255c 100755
--- a/src/lynq/lib/liblynq-fota/rock_ua/rock_ua.c
+++ b/src/lynq/lib/liblynq-fota/rock_ua/rock_ua.c
@@ -57,6 +57,12 @@
#define DEV_VBMETA_A "/dev/disk/by-partlabel/vbmeta_a"
#define DEV_VBMETA_B "/dev/disk/by-partlabel/vbmeta_b"
+#define DEV_OEMAPP_A "/dev/disk/by-partlabel/oemapp_a"
+#define DEV_OEMAPP_B "/dev/disk/by-partlabel/oemapp_b"
+
+#define DEV_OEMAPP2_A "/dev/disk/by-partlabel/oemapp2_a"
+#define DEV_OEMAPP2_B "/dev/disk/by-partlabel/oemapp2_b"
+
#define DEV_BL2 "/dev/disk/by-partlabel/bl2"
#define DEV_BL33 "/dev/disk/by-partlabel/bl33"
@@ -93,7 +99,7 @@
-int fd_system_a,fd_system_b,fd_boot_a,fd_boot_b,fd_tee_a,fd_tee_b,fd_bl2,fd_bl33,fd_delta,fd_curr,fd_log,fd_update_status,fd_md1img_a,fd_md1img_b,fd_fota_status,fd_md1dsp_a,fd_md1dsp_b,fd_vbmeta_a,fd_vbmeta_b;
+int fd_system_a,fd_system_b,fd_boot_a,fd_boot_b,fd_tee_a,fd_tee_b,fd_bl2,fd_bl33,fd_delta,fd_curr,fd_log,fd_update_status,fd_md1img_a,fd_md1img_b,fd_fota_status,fd_md1dsp_a,fd_md1dsp_b,fd_vbmeta_a,fd_vbmeta_b,fd_oemapp_a,fd_oemapp_b,fd_oemapp2_a,fd_oemapp2_b;
int fd_write,fd_read;
static unsigned int delta_offset = 0;
@@ -613,8 +619,8 @@
read(fd_delta, (unsigned char*)&da_head, sizeof(da_head));
- rock_trace(&ctx, "da_head.sys:%d,da_head.boot:%d,da_head.tee:%d,da_head.md1img=%d,da_head.md1dsp=%d,da_head.vbmeta=%d,da_head.bl33=%d\n", da_head.sys, da_head.boot,da_head.tee,da_head.md1img,da_head.md1dsp,da_head.vbmeta,da_head.bl33);
- rock_trace(&ctx, "da_head.fullsys:%d,da_head.fullboot:%d,da_head.fulltee:%d,da_head.fullmd1img=%d,da_head.fullmd1dsp=%d,da_head.fullvbmeta=%d,da_head.fullbl33=%d\n", da_head.full_sys, da_head.full_boot,da_head.full_tee, da_head.full_md1img,da_head.full_md1dsp,da_head.full_vbmeta,da_head.full_bl33);
+ rock_trace(&ctx, "da_head.sys:%d,da_head.boot:%d,da_head.tee:%d,da_head.md1img=%d,da_head.md1dsp=%d,da_head.vbmeta=%d,da_head.oemapp=%d,da_head.oemapp2=%d,da_head.bl33=%d\n", da_head.sys, da_head.boot,da_head.tee,da_head.md1img,da_head.md1dsp,da_head.vbmeta,da_head.oemapp,da_head.oemapp2,da_head.bl33);
+ rock_trace(&ctx, "da_head.fullsys:%d,da_head.fullboot:%d,da_head.fulltee:%d,da_head.fullmd1img=%d,da_head.fullmd1dsp=%d,da_head.fullvbmeta=%d,da_head.full_oemapp=%d,da_head.full_oemapp2=%d,da_head.fullbl33=%d\n", da_head.full_sys, da_head.full_boot,da_head.full_tee, da_head.full_md1img,da_head.full_md1dsp,da_head.full_vbmeta,da_head.full_oemapp,da_head.full_oemapp2,da_head.full_bl33);
if (da_head.sys>0) {
@@ -635,6 +641,12 @@
if (da_head.vbmeta>0) {
fota_status.update_status[PATCH_VBMETA - 1].need_update = 1;
}
+ if (da_head.oemapp>0) {
+ fota_status.update_status[PATCH_OEMAPP - 1].need_update = 1;
+ }
+ if (da_head.oemapp2>0) {
+ fota_status.update_status[PATCH_OEMAPP2 - 1].need_update = 1;
+ }
if (da_head.bl33>0) {
fota_status.update_status[PATCH_BL33 - 1].need_update = 1;
}
@@ -660,10 +672,16 @@
if (da_head.full_vbmeta>0) {
fota_status.update_status[FULL_VBMETA - 1].need_update = 1;
}
+ if (da_head.full_oemapp>0) {
+ fota_status.update_status[FULL_OEMAPP - 1].need_update = 1;
+ }
+ if (da_head.full_oemapp2>0) {
+ fota_status.update_status[FULL_OEMAPP2 - 1].need_update = 1;
+ }
fota_status.switch_slot = WAIT;
save_fota_status();
- delta_size = da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.bl33;
+ delta_size = da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp + da_head.oemapp2 + da_head.bl33;
if ((da_head.sys>0) && (up_info.ota_run <= PATCH_SYSTEM))
@@ -1423,11 +1441,246 @@
}
+ if ((da_head.oemapp>0) && (up_info.ota_run <= PATCH_OEMAPP))
+ {
+
+ now_patch = PATCH_OEMAPP;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta;
+
+
+ if (up_info.ota_run == PATCH_OEMAPP)
+ {
+ ctx.first_run = 0;
+
+ }else{
+ ctx.first_run = 1;
+ }
+
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_b");
+ }
+// if(current_slot==SLOT_B) {
+ fd_oemapp_a = mtk_device_wrap_open(DEV_OEMAPP_A,O_RDWR);
+ if (fd_oemapp_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp_a;
+// }else{
+ fd_oemapp_b = mtk_device_wrap_open(DEV_OEMAPP_B,O_RDWR);
+ if (fd_oemapp_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp_b;
+// }
+
+ if(current_slot==SLOT_B){
+ fd_read = fd_oemapp_b;
+ fd_write = fd_oemapp_a;
+ } else {
+ fd_read = fd_oemapp_a;
+ fd_write = fd_oemapp_b;
+ }
+
+
+ fota_status.ota_run = PATCH_OEMAPP;
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = WAIT;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = WAIT;
+ fota_status.update_status[PATCH_OEMAPP-1].update_result= WAIT;
+
+ save_fota_status();
+
+ up_info.ota_run = PATCH_OEMAPP;
+
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+
+ LYVERBLOG("+[UA]: Start upgrading oemapp.\n");
+ status = iot_patch(&ctx);
+ LYVERBLOG("+[UA]: oemapp upgrade result:%d\n",status);
+
+ up_info.ota_run = 0;
+ //fota_status.ota_run = 0;
+ fota_status.update_status[PATCH_OEMAPP-1].update_result= status;
+ fota_status.update_result= status;
+
+ if((status == 0)||(status ==1))
+ {
+
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = PASS;
+
+ }else if(status == E_ROCK_INVALID_DELTA) {
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = ERROR;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = WAIT;
+ }else if((status == E_ROCK_DELTA_MISMATCH)||(status == E_ROCK_DELTA_CHUNK_MISMATCH)) {
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = ERROR;
+
+ }else{
+
+ //fota_status.update_status[PATCH_OEMAPP -1].check_delta = PASS;
+ //fota_status.update_status[PATCH_OEMAPP -1].check_rom = WAIT;
+ }
+
+ save_fota_status();
+
+
+ if ((status != 0) &&(status != 1))
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+
+
+ }
+
+ if ((da_head.oemapp2>0) && (up_info.ota_run <= PATCH_OEMAPP2))
+ {
+
+ now_patch = PATCH_OEMAPP2;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp;
+
+
+ if (up_info.ota_run == PATCH_OEMAPP2)
+ {
+ ctx.first_run = 0;
+
+ }else{
+ ctx.first_run = 1;
+ }
+
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_b");
+ }
+// if(current_slot==SLOT_B) {
+ fd_oemapp2_a = mtk_device_wrap_open(DEV_OEMAPP2_A,O_RDWR);
+ if (fd_oemapp2_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp2_a;
+// }else{
+ fd_oemapp2_b = mtk_device_wrap_open(DEV_OEMAPP2_B,O_RDWR);
+ if (fd_oemapp2_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp2_b;
+// }
+
+ if(current_slot==SLOT_B){
+ fd_read = fd_oemapp2_b;
+ fd_write = fd_oemapp2_a;
+ } else {
+ fd_read = fd_oemapp2_a;
+ fd_write = fd_oemapp2_b;
+ }
+
+
+ fota_status.ota_run = PATCH_OEMAPP2;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = WAIT;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = WAIT;
+ fota_status.update_status[PATCH_OEMAPP2-1].update_result= WAIT;
+
+ save_fota_status();
+
+ up_info.ota_run = PATCH_OEMAPP2;
+
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+
+ LYVERBLOG("+[UA]: Start upgrading oemapp2.\n");
+ status = iot_patch(&ctx);
+ LYVERBLOG("+[UA]: oemapp2 upgrade result:%d\n",status);
+
+ up_info.ota_run = 0;
+ //fota_status.ota_run = 0;
+ fota_status.update_status[PATCH_OEMAPP2-1].update_result= status;
+ fota_status.update_result= status;
+
+ if((status == 0)||(status ==1))
+ {
+
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = PASS;
+
+ }else if(status == E_ROCK_INVALID_DELTA) {
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = ERROR;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = WAIT;
+ }else if((status == E_ROCK_DELTA_MISMATCH)||(status == E_ROCK_DELTA_CHUNK_MISMATCH)) {
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = ERROR;
+
+ }else{
+
+ //fota_status.update_status[PATCH_OEMAPP2 -1].check_delta = PASS;
+ //fota_status.update_status[PATCH_OEMAPP2 -1].check_rom = WAIT;
+ }
+
+ save_fota_status();
+
+
+ if ((status != 0) &&(status != 1))
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+
+
+ }
+
if ((da_head.bl33>0) && (up_info.ota_run <= PATCH_BL33))
{
now_patch = PATCH_BL33;
- delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp + da_head.oemapp2;
+
if (up_info.ota_run == PATCH_BL33)
{
@@ -1448,13 +1701,13 @@
}
fd_curr = fd_bl33;
- fota_status.ota_run = PATCH_BL33;
+ fota_status.ota_run = PATCH_BL33;
fota_status.update_status[PATCH_BL33-1].check_delta = WAIT;
- fota_status.update_status[PATCH_BL33-1].check_rom = WAIT;
- fota_status.update_status[PATCH_BL33-1].update_result= WAIT;
+ fota_status.update_status[PATCH_BL33-1].check_rom = WAIT;
+ fota_status.update_status[PATCH_BL33-1].update_result= WAIT;
save_fota_status();
-
+
up_info.ota_run = PATCH_BL33;
lseek(fd_update_status,0,SEEK_SET);
@@ -1464,7 +1717,7 @@
LYVERBLOG("+[UA]: Start upgrading bl33.\n");
status = iot_patch(&ctx);
LYVERBLOG("+[UA]: bl33 upgrade result:%d\n",status);
-
+
up_info.ota_run = 0;
//fota_status.ota_run = 0;
@@ -1475,7 +1728,7 @@
fota_status.update_status[PATCH_BL33-1].check_delta = PASS;
fota_status.update_status[PATCH_BL33-1].check_rom = PASS;
-
+
}else if(status == E_ROCK_INVALID_DELTA) {
fota_status.update_status[PATCH_BL33-1].check_delta = ERROR;
fota_status.update_status[PATCH_BL33-1].check_rom = WAIT;
@@ -1484,7 +1737,7 @@
fota_status.update_status[PATCH_BL33-1].check_rom = ERROR;
}else{
-
+
//fota_status.update_status[PATCH_BL33 -1].check_delta = PASS;
//fota_status.update_status[PATCH_BL33 -1].check_rom = WAIT;
}
@@ -1493,17 +1746,16 @@
if ((status != 0) &&(status != 1))
{
-
- up_info.fota_flag[0] = 'e';
- up_info.fota_flag[1] = 'n';
- up_info.fota_flag[2] = 'd';
- up_info.update_result = status;
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
up_info.ota_run = 0;
lseek(fd_update_status,0,SEEK_SET);
- write(fd_update_status, &up_info,sizeof(up_info));
- mtk_device_wrap_close(fd_curr);
- sync();
- close(fd_update_status);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ mtk_device_wrap_close(fd_curr);
+ sync();
+ close(fd_update_status);
lynq_fota_release_wake_lock();
return status;
}
@@ -1517,7 +1769,7 @@
- if ((da_head.full_sys>0)|| (da_head.full_boot>0)|| (da_head.full_tee>0)||(da_head.full_md1img>0)||(da_head.full_md1dsp>0)||(da_head.full_vbmeta>0)||(da_head.full_bl33>0))
+ if ((da_head.full_sys>0)|| (da_head.full_boot>0)|| (da_head.full_tee>0)||(da_head.full_md1img>0)||(da_head.full_md1dsp>0)||(da_head.full_vbmeta>0)||(da_head.full_oemapp>0)||(da_head.full_oemapp2>0)||(da_head.full_bl33>0))
{
now_patch = 0;
@@ -2032,25 +2284,179 @@
if (status != 0)
{
-
- up_info.fota_flag[0] = 'e';
- up_info.fota_flag[1] = 'n';
- up_info.fota_flag[2] = 'd';
- up_info.update_result = status;
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
up_info.ota_run = 0;
lseek(fd_update_status,0,SEEK_SET);
- write(fd_update_status, &up_info,sizeof(up_info));
- sync();
- close(fd_update_status);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
lynq_fota_release_wake_lock();
return status;
}
-
-
+
+
}
-
+
+ if(da_head.full_oemapp>0) {
+
+ delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_tee + da_head.full_boot + da_head.full_md1img + da_head.full_md1dsp + da_head.full_vbmeta;
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_b");
+ }
+
+ if(current_slot==SLOT_B) {
+ fd_oemapp_a = mtk_device_wrap_open(DEV_OEMAPP_A,O_RDWR);
+ if (fd_oemapp_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp_a;
+ }else{
+ fd_oemapp_b = mtk_device_wrap_open(DEV_OEMAPP_B,O_RDWR);
+ if (fd_oemapp_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp_b;
+ }
+ fota_status.ota_run = FULL_OEMAPP;
+ save_fota_status();
+ retry_cnt = 0;
+ LYVERBLOG("+[UA]: Start upgrading oemapp full.\n");
+ do {
+ status = delta_copyto_nand(delta_offset,da_head.full_oemapp);
+ ROCK_SHA_FILE_COMMON(fd_delta,delta_offset,da_head.full_oemapp,digest_s);
+ ROCK_SHA_FILE(fd_curr,0,da_head.full_oemapp,digest_t);
+ retry_cnt++;
+ }while((strncmp(digest_s,digest_t,SHA_DIGEST_SIZE)!=0)&&(retry_cnt <= 3));
+ mtk_device_wrap_close(fd_curr);
+
+ LYVERBLOG("+[UA]: oemapp full retry_cnt = %d\n",retry_cnt);
+ if (retry_cnt>3) {
+ if (status == 0) {
+ status = retry_cnt;
+ }
+ if(current_slot==SLOT_B) {
+ nand_copyto_nand(DEV_OEMAPP_B,DEV_OEMAPP_A);
+ }
+ else{
+ nand_copyto_nand(DEV_OEMAPP_A,DEV_OEMAPP_B);
+ }
+ }
+
+ LYVERBLOG("+[UA]: oemapp upgrade result:%d\n",status);
+ fota_status.update_result = status;
+ fota_status.update_status[FULL_OEMAPP-1].update_result = status;
+ save_fota_status();
+
+ if (status != 0)
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+
+
+ }
+
+ if(da_head.full_oemapp2>0) {
+
+ delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_tee + da_head.full_boot + da_head.full_md1img + da_head.full_md1dsp + da_head.full_vbmeta + da_head.full_oemapp;
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_b");
+ }
+
+ if(current_slot==SLOT_B) {
+ fd_oemapp2_a = mtk_device_wrap_open(DEV_OEMAPP2_A,O_RDWR);
+ if (fd_oemapp2_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp2_a;
+ }else{
+ fd_oemapp2_b = mtk_device_wrap_open(DEV_OEMAPP2_B,O_RDWR);
+ if (fd_oemapp2_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp2_b;
+ }
+ fota_status.ota_run = FULL_OEMAPP2;
+ save_fota_status();
+ retry_cnt = 0;
+ LYVERBLOG("+[UA]: Start upgrading oemapp2 full.\n");
+ do {
+ status = delta_copyto_nand(delta_offset,da_head.full_oemapp2);
+ ROCK_SHA_FILE_COMMON(fd_delta,delta_offset,da_head.full_oemapp2,digest_s);
+ ROCK_SHA_FILE(fd_curr,0,da_head.full_oemapp2,digest_t);
+ retry_cnt++;
+ }while((strncmp(digest_s,digest_t,SHA_DIGEST_SIZE)!=0)&&(retry_cnt <= 3));
+ mtk_device_wrap_close(fd_curr);
+
+ LYVERBLOG("+[UA]: oemapp2 full retry_cnt = %d\n",retry_cnt);
+ if (retry_cnt>3) {
+ if (status == 0) {
+ status = retry_cnt;
+ }
+ if(current_slot==SLOT_B) {
+ nand_copyto_nand(DEV_OEMAPP2_B,DEV_OEMAPP2_A);
+ }
+ else{
+ nand_copyto_nand(DEV_OEMAPP2_A,DEV_OEMAPP2_B);
+ }
+ }
+
+ LYVERBLOG("+[UA]: oemapp2 upgrade result:%d\n",status);
+ fota_status.update_result = status;
+ fota_status.update_status[FULL_OEMAPP2-1].update_result = status;
+ save_fota_status();
+
+ if (status != 0)
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+
+
+ }
+
if(da_head.full_bl33>0) {
-
+
}
@@ -2060,21 +2466,21 @@
up_info.fota_flag[0] = 'B';
up_info.fota_flag[1] = '-';
- up_info.fota_flag[2] = 'A';
-
+ up_info.fota_flag[2] = 'A';
+
}else{
-
+
up_info.fota_flag[0] = 'A';
up_info.fota_flag[1] = '-';
up_info.fota_flag[2] = 'B';
-
+
}
-
+
}else{
up_info.fota_flag[0] = 'e';
up_info.fota_flag[1] = 'n';
- up_info.fota_flag[2] = 'd';
-
+ up_info.fota_flag[2] = 'd';
+
}
@@ -2361,8 +2767,8 @@
read(fd_delta, (unsigned char*)&da_head, sizeof(da_head));
- rock_trace(&ctx, "da_head.sys:%d,da_head.boot:%d,da_head.tee:%d,da_head.md1img=%d,da_head.md1dsp=%d,da_head.vbmeta=%d,da_head.bl33=%d\n", da_head.sys, da_head.boot,da_head.tee,da_head.md1img,da_head.md1dsp,da_head.vbmeta,da_head.bl33);
- rock_trace(&ctx, "da_head.fullsys:%d,da_head.fullboot:%d,da_head.fulltee:%d,da_head.fullmd1img=%d,da_head.fullmd1dsp=%d,da_head.fullvbmeta=%d,da_head.fullbl33=%d\n", da_head.full_sys, da_head.full_boot,da_head.full_tee, da_head.full_md1img,da_head.full_md1dsp,da_head.full_vbmeta,da_head.full_bl33);
+ rock_trace(&ctx, "da_head.sys:%d,da_head.boot:%d,da_head.tee:%d,da_head.md1img=%d,da_head.md1dsp=%d,da_head.vbmeta=%d,da_head.oemapp=%d,da_head.oemapp2=%d,da_head.bl33=%d\n", da_head.sys, da_head.boot,da_head.tee,da_head.md1img,da_head.md1dsp,da_head.vbmeta,da_head.oemapp,da_head.oemapp2,da_head.bl33);
+ rock_trace(&ctx, "da_head.fullsys:%d,da_head.fullboot:%d,da_head.fulltee:%d,da_head.fullmd1img=%d,da_head.fullmd1dsp=%d,da_head.fullvbmeta=%d,da_head.full_oemapp=%d,da_head.full_oemapp2=%d,da_head.fullbl33=%d\n", da_head.full_sys, da_head.full_boot,da_head.full_tee, da_head.full_md1img,da_head.full_md1dsp,da_head.full_vbmeta,da_head.full_oemapp,da_head.full_oemapp2,da_head.full_bl33);
if (da_head.sys>0) {
@@ -2383,6 +2789,12 @@
if (da_head.vbmeta>0) {
fota_status.update_status[PATCH_VBMETA - 1].need_update = 1;
}
+ if (da_head.oemapp>0) {
+ fota_status.update_status[PATCH_OEMAPP - 1].need_update = 1;
+ }
+ if (da_head.oemapp2>0) {
+ fota_status.update_status[PATCH_OEMAPP2 - 1].need_update = 1;
+ }
if (da_head.bl33>0) {
fota_status.update_status[PATCH_BL33 - 1].need_update = 1;
}
@@ -2408,10 +2820,16 @@
if (da_head.full_vbmeta>0) {
fota_status.update_status[FULL_VBMETA - 1].need_update = 1;
}
+ if (da_head.full_oemapp>0) {
+ fota_status.update_status[FULL_OEMAPP - 1].need_update = 1;
+ }
+ if (da_head.full_oemapp2>0) {
+ fota_status.update_status[FULL_OEMAPP2 - 1].need_update = 1;
+ }
fota_status.switch_slot = WAIT;
save_fota_status();
- delta_size = da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.bl33;
+ delta_size = da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp + da_head.oemapp2 + da_head.bl33;
if ((da_head.sys>0) && (up_info.ota_run <= PATCH_SYSTEM))
@@ -3171,11 +3589,246 @@
}
+ if ((da_head.oemapp>0) && (up_info.ota_run <= PATCH_OEMAPP))
+ {
+
+ now_patch = PATCH_OEMAPP;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta;
+
+
+ if (up_info.ota_run == PATCH_OEMAPP)
+ {
+ ctx.first_run = 0;
+
+ }else{
+ ctx.first_run = 1;
+ }
+
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_b");
+ }
+// if(current_slot==SLOT_B) {
+ fd_oemapp_a = mtk_device_wrap_open(DEV_OEMAPP_A,O_RDWR);
+ if (fd_oemapp_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp_a;
+// }else{
+ fd_oemapp_b = mtk_device_wrap_open(DEV_OEMAPP_B,O_RDWR);
+ if (fd_oemapp_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp_b;
+// }
+
+ if(current_slot==SLOT_B){
+ fd_read = fd_oemapp_b;
+ fd_write = fd_oemapp_a;
+ } else {
+ fd_read = fd_oemapp_a;
+ fd_write = fd_oemapp_b;
+ }
+
+
+ fota_status.ota_run = PATCH_OEMAPP;
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = WAIT;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = WAIT;
+ fota_status.update_status[PATCH_OEMAPP-1].update_result= WAIT;
+
+ save_fota_status();
+
+ up_info.ota_run = PATCH_OEMAPP;
+
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+
+ LYVERBLOG("+[UA]: Start upgrading oemapp.\n");
+ status = iot_patch(&ctx);
+ LYVERBLOG("+[UA]: oemapp upgrade result:%d\n",status);
+
+ up_info.ota_run = 0;
+ //fota_status.ota_run = 0;
+ fota_status.update_status[PATCH_OEMAPP-1].update_result= status;
+ fota_status.update_result= status;
+
+ if((status == 0)||(status ==1))
+ {
+
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = PASS;
+
+ }else if(status == E_ROCK_INVALID_DELTA) {
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = ERROR;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = WAIT;
+ }else if((status == E_ROCK_DELTA_MISMATCH)||(status == E_ROCK_DELTA_CHUNK_MISMATCH)) {
+ fota_status.update_status[PATCH_OEMAPP-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP-1].check_rom = ERROR;
+
+ }else{
+
+ //fota_status.update_status[PATCH_OEMAPP -1].check_delta = PASS;
+ //fota_status.update_status[PATCH_OEMAPP -1].check_rom = WAIT;
+ }
+
+ save_fota_status();
+
+
+ if ((status != 0) &&(status != 1))
+ {
+
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+
+
+ }
+
+ if ((da_head.oemapp2>0) && (up_info.ota_run <= PATCH_OEMAPP2))
+ {
+
+ now_patch = PATCH_OEMAPP2;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp;
+
+
+ if (up_info.ota_run == PATCH_OEMAPP2)
+ {
+ ctx.first_run = 0;
+
+ }else{
+ ctx.first_run = 1;
+ }
+
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_b");
+ }
+// if(current_slot==SLOT_B) {
+ fd_oemapp2_a = mtk_device_wrap_open(DEV_OEMAPP2_A,O_RDWR);
+ if (fd_oemapp2_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp2_a;
+// }else{
+ fd_oemapp2_b = mtk_device_wrap_open(DEV_OEMAPP2_B,O_RDWR);
+ if (fd_oemapp2_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+// fd_curr = fd_oemapp2_b;
+// }
+
+ if(current_slot==SLOT_B){
+ fd_read = fd_oemapp2_b;
+ fd_write = fd_oemapp2_a;
+ } else {
+ fd_read = fd_oemapp2_a;
+ fd_write = fd_oemapp2_b;
+ }
+
+
+ fota_status.ota_run = PATCH_OEMAPP2;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = WAIT;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = WAIT;
+ fota_status.update_status[PATCH_OEMAPP2-1].update_result= WAIT;
+
+ save_fota_status();
+
+ up_info.ota_run = PATCH_OEMAPP2;
+
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+
+ LYVERBLOG("+[UA]: Start upgrading oemapp2.\n");
+ status = iot_patch(&ctx);
+ LYVERBLOG("+[UA]: oemapp2 upgrade result:%d\n",status);
+
+ up_info.ota_run = 0;
+ //fota_status.ota_run = 0;
+ fota_status.update_status[PATCH_OEMAPP2-1].update_result= status;
+ fota_status.update_result= status;
+
+ if((status == 0)||(status ==1))
+ {
+
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = PASS;
+
+ }else if(status == E_ROCK_INVALID_DELTA) {
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = ERROR;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = WAIT;
+ }else if((status == E_ROCK_DELTA_MISMATCH)||(status == E_ROCK_DELTA_CHUNK_MISMATCH)) {
+ fota_status.update_status[PATCH_OEMAPP2-1].check_delta = PASS;
+ fota_status.update_status[PATCH_OEMAPP2-1].check_rom = ERROR;
+
+ }else{
+
+ //fota_status.update_status[PATCH_OEMAPP2 -1].check_delta = PASS;
+ //fota_status.update_status[PATCH_OEMAPP2 -1].check_rom = WAIT;
+ }
+
+ save_fota_status();
+
+
+ if ((status != 0) &&(status != 1))
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+ mtk_device_wrap_close(fd_read);
+ mtk_device_wrap_close(fd_write);
+
+
+ }
+
if ((da_head.bl33>0) && (up_info.ota_run <= PATCH_BL33))
{
now_patch = PATCH_BL33;
- delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta;
+ delta_offset = DELTA_HEARD_SIZE + da_head.sys + da_head.boot + da_head.tee + da_head.md1img + da_head.md1dsp + da_head.vbmeta + da_head.oemapp + da_head.oemapp2;
if (up_info.ota_run == PATCH_BL33)
{
@@ -3265,7 +3918,7 @@
- if ((da_head.full_sys>0)|| (da_head.full_boot>0)|| (da_head.full_tee>0)||(da_head.full_md1img>0)||(da_head.full_md1dsp>0)||(da_head.full_vbmeta>0)||(da_head.full_bl33>0))
+ if ((da_head.full_sys>0)|| (da_head.full_boot>0)|| (da_head.full_tee>0)||(da_head.full_md1img>0)||(da_head.full_md1dsp>0)||(da_head.full_vbmeta>0)||(da_head.full_oemapp>0)||(da_head.full_oemapp2>0)||(da_head.full_bl33>0))
{
now_patch = 0;
@@ -3721,7 +4374,7 @@
if(da_head.full_vbmeta>0) {
- delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_boot + da_head.full_tee + da_head.full_md1img + da_head.full_md1dsp;
+ delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_tee + da_head.full_boot + da_head.full_md1img + da_head.full_md1dsp;
if(current_slot==SLOT_B) {
system("flash_eraseall /dev/disk/by-partlabel/vbmeta_a");
@@ -3796,7 +4449,157 @@
}
+
+ if(da_head.full_oemapp>0) {
+ delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_tee + da_head.full_boot + da_head.full_md1img + da_head.full_md1dsp + da_head.full_vbmeta;
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp_b");
+ }
+
+ if(current_slot==SLOT_B) {
+ fd_oemapp_a = mtk_device_wrap_open(DEV_OEMAPP_A,O_RDWR);
+ if (fd_oemapp_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp_a;
+ }else{
+ fd_oemapp_b = mtk_device_wrap_open(DEV_OEMAPP_B,O_RDWR);
+ if (fd_oemapp_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp_b;
+ }
+ fota_status.ota_run = FULL_OEMAPP;
+ save_fota_status();
+ retry_cnt = 0;
+ LYVERBLOG("+[UA]: Start upgrading oemapp full.\n");
+ do {
+ status = delta_copyto_nand(delta_offset,da_head.full_oemapp);
+ ROCK_SHA_FILE_COMMON(fd_delta,delta_offset,da_head.full_oemapp,digest_s);
+ ROCK_SHA_FILE(fd_curr,0,da_head.full_oemapp,digest_t);
+ retry_cnt++;
+ }while((strncmp(digest_s,digest_t,SHA_DIGEST_SIZE)!=0)&&(retry_cnt <= 3));
+ mtk_device_wrap_close(fd_curr);
+
+ LYVERBLOG("+[UA]: oemapp full retry_cnt = %d\n",retry_cnt);
+ if (retry_cnt>3) {
+ if (status == 0) {
+ status = retry_cnt;
+ }
+ if(current_slot==SLOT_B) {
+ nand_copyto_nand(DEV_OEMAPP_B,DEV_OEMAPP_A);
+ }
+ else{
+ nand_copyto_nand(DEV_OEMAPP_A,DEV_OEMAPP_B);
+ }
+ }
+
+ LYVERBLOG("+[UA]: oemapp upgrade result:%d\n",status);
+ fota_status.update_result = status;
+ fota_status.update_status[FULL_OEMAPP-1].update_result = status;
+ save_fota_status();
+
+ if (status != 0)
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+
+ }
+
+ if(da_head.full_oemapp2>0) {
+
+ delta_offset = DELTA_HEARD_SIZE + delta_size + DELTA_FULL_HEARD_SIZE + da_head.full_sys + da_head.full_tee + da_head.full_boot + da_head.full_md1img + da_head.full_md1dsp + da_head.full_vbmeta + da_head.full_oemapp;
+
+
+ if(current_slot==SLOT_B) {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_a");
+ } else {
+ system("flash_eraseall /dev/disk/by-partlabel/oemapp2_b");
+ }
+
+ if(current_slot==SLOT_B) {
+ fd_oemapp2_a = mtk_device_wrap_open(DEV_OEMAPP2_A,O_RDWR);
+ if (fd_oemapp2_a < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp2_a;
+ }else{
+ fd_oemapp2_b = mtk_device_wrap_open(DEV_OEMAPP2_B,O_RDWR);
+ if (fd_oemapp2_b < 0) {
+ err = errno;
+ LYERRLOG("+[UA]: Error opening metadata file: %s\n",strerror(errno));
+ lynq_fota_release_wake_lock();
+ return -err;
+ }
+ fd_curr = fd_oemapp2_b;
+ }
+ fota_status.ota_run = FULL_OEMAPP2;
+ save_fota_status();
+ retry_cnt = 0;
+ LYVERBLOG("+[UA]: Start upgrading oemapp2 full.\n");
+ do {
+ status = delta_copyto_nand(delta_offset,da_head.full_oemapp2);
+ ROCK_SHA_FILE_COMMON(fd_delta,delta_offset,da_head.full_oemapp2,digest_s);
+ ROCK_SHA_FILE(fd_curr,0,da_head.full_oemapp2,digest_t);
+ retry_cnt++;
+ }while((strncmp(digest_s,digest_t,SHA_DIGEST_SIZE)!=0)&&(retry_cnt <= 3));
+ mtk_device_wrap_close(fd_curr);
+ LYVERBLOG("+[UA]: oemapp2 full retry_cnt = %d\n",retry_cnt);
+ if (retry_cnt>3) {
+ if (status == 0) {
+ status = retry_cnt;
+ }
+ if(current_slot==SLOT_B) {
+ nand_copyto_nand(DEV_OEMAPP2_B,DEV_OEMAPP2_A);
+ }
+ else{
+ nand_copyto_nand(DEV_OEMAPP2_A,DEV_OEMAPP2_B);
+ }
+ }
+ LYVERBLOG("+[UA]: oemapp2 upgrade result:%d\n",status);
+ fota_status.update_result = status;
+ fota_status.update_status[FULL_OEMAPP2-1].update_result = status;
+ save_fota_status();
+
+ if (status != 0)
+ {
+ up_info.fota_flag[0] = 'e';
+ up_info.fota_flag[1] = 'n';
+ up_info.fota_flag[2] = 'd';
+ up_info.update_result = status;
+ up_info.ota_run = 0;
+ lseek(fd_update_status,0,SEEK_SET);
+ write(fd_update_status, &up_info,sizeof(up_info));
+ sync();
+ close(fd_update_status);
+ lynq_fota_release_wake_lock();
+ return status;
+ }
+ }
+
if(da_head.full_bl33>0) {
}
diff --git a/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h b/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
index 505fdc9..1f0a32b 100755
--- a/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
+++ b/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
@@ -71,6 +71,12 @@
int lynq_set_ims(const int ims_mode);
int lynq_wait_signalchanges(int *handle);
int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id);
+void lynq_set_voice_registration_valid_period(int valid_period);
+void lynq_set_data_registration_valid_period(int valid_period);
+void lynq_set_ims_registration_valid_period(int valid_period);
+int lynq_get_voice_registration_valid_period();
+int lynq_get_data_registration_valid_period();
+int lynq_get_ims_registration_valid_period();
#ifdef MODEM_GEN97
/**@brief set or get OOS recover timer interval
* @param mode [IN] <mode>:
diff --git a/src/lynq/lib/liblynq-network/lynq_network.cpp b/src/lynq/lib/liblynq-network/lynq_network.cpp
index 3752455..70914ae 100755
--- a/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -13,6 +13,7 @@
#include "lynq_network.h"
#include "liblog/lynq_deflog.h"
+#include "lynq_network_state_buffer.h"
#define LYNQ_SERVICE_PORT 8088
#define LYNQ_URC_SERVICE_PORT 8086
#define LYNQ_URC_ADDRESS "0.0.0.0"
@@ -202,14 +203,31 @@
urc_p->readInt32(&network_urc_slot_id);
switch(urc_id)
{
- case 1002: //RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
+ case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
{
+ set_register_voice_buffer_valid(false);
network_wait_urc_id = urc_id;
LYINFLOG("slot_id = %d",network_urc_slot_id);
send_signal_changes();
break;
}
- case 1009: //RIL_UNSOL_SIGNAL_STRENGTH
+ case RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED:
+ {
+ set_register_data_buffer_valid(false);
+ network_wait_urc_id = urc_id;
+ LYINFLOG("slot_id = %d",network_urc_slot_id);
+ send_signal_changes();
+ break;
+ }
+ case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED:
+ {
+ set_register_ims_buffer_valid(false);
+ network_wait_urc_id = urc_id;
+ LYINFLOG("slot_id = %d",network_urc_slot_id);
+ send_signal_changes();
+ break;
+ }
+ case RIL_UNSOL_SIGNAL_STRENGTH:
{
urc_p->readInt32(&network_urc_solSigStren.rssi);
if((network_urc_solSigStren.rssi!=99)&&(network_urc_solSigStren.rssi!=0))
@@ -290,6 +308,7 @@
}
}
}
+ return NULL;
}
@@ -380,6 +399,8 @@
LYLOGEINIT(USER_LOG_TAG);
int ret = 0;
+ init_network_timer_all();
+
ret = lynq_server_socket_start();
if(ret !=0)
{
@@ -539,6 +560,9 @@
}
g_lynq_network_init_flag = 0;
network_urc_status = 0;
+
+ deinit_network_timer_all();
+
return 0;
}
@@ -823,10 +847,22 @@
strUpper(str);
if(!strcmp(str,"VOICE"))
{
+ if(lynq_get_registration_state_to_buf_voice(regState,netType,netRejected)==0)
+ {
+ return 0;
+ }
client_t.request = RIL_REQUEST_VOICE_REGISTRATION_STATE;
}else if(!strcmp(str,"DATA")){
+ if(lynq_get_registration_state_to_buf_data(regState,LAC,CID,netType)==0)
+ {
+ return 0;
+ }
client_t.request = RIL_REQUEST_DATA_REGISTRATION_STATE;
}else if(!strcmp(str,"IMS")){
+ if(lynq_get_registration_state_to_buf_ims(imsRegState,radioTechFam)==0)
+ {
+ return 0;
+ }
client_t.request = RIL_REQUEST_IMS_REGISTRATION_STATE;
}else{
LYERRLOG("request error");
@@ -882,7 +918,8 @@
lynqStrdupReadString(p);
lynqStrdupReadString(p);
lynqStrdupReadString(p);
- *netRejected = atoi(lynqStrdupReadString(p));
+ *netRejected = atoi(lynqStrdupReadString(p));
+ lynq_set_registration_state_to_buf_voice(*regState,*netType,*netRejected);
}
}else if(!strcmp(str,"DATA")){
p.readInt32(&num);
@@ -895,6 +932,7 @@
resp[1] = lynqStrdupReadString(p);
strcpy(CID,resp[1]);
*netType = atoi(lynqStrdupReadString(p));
+ lynq_set_registration_state_to_buf_data(*regState,LAC,CID,*netType);
}
}else if(!strcmp(str,"IMS")){
@@ -903,6 +941,7 @@
{
p.readInt32(imsRegState);
p.readInt32(radioTechFam);
+ lynq_set_registration_state_to_buf_ims(*imsRegState,*radioTechFam);
}
}else{
LYERRLOG("request error");
diff --git a/src/lynq/lib/liblynq-network/lynq_network_state_buffer.cpp b/src/lynq/lib/liblynq-network/lynq_network_state_buffer.cpp
new file mode 100755
index 0000000..2fdea32
--- /dev/null
+++ b/src/lynq/lib/liblynq-network/lynq_network_state_buffer.cpp
@@ -0,0 +1,581 @@
+#include <stdio.h>
+#include <stdint.h> /*just for uint64_t in lynq_query_cell_info 20220819 hq*/
+#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <signal.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "liblog/lynq_deflog.h"
+#include "lynq_network.h"
+#include "lynq_network_state_buffer.h"
+
+#define USER_LOG_TAG "LYNQ_NETWORK"
+
+typedef struct{
+ int voice_valid_period;
+ int data_valid_period;
+ int ims_valid_period;
+}lynq_network_register_buf_cfg;
+
+lynq_network_register_buf_cfg s_register_cfg;
+static timer_t s_register_timer_voice;
+static timer_t s_register_timer_data;
+static timer_t s_register_timer_ims;
+static int register_sig_value_voice = 2;
+static int register_sig_value_data = 3;
+static int register_sig_value_ims = 4;
+static int s_register_voice_valid=false;
+static int s_register_data_valid=false;
+static int s_register_ims_valid=false;
+static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+#define VOICE_REG_BUFFER_FILE "/data/ril/network/.network_register_voice_buffer"
+#define DATA_REG_BUFFER_FILE "/data/ril/network/.network_register_data_buffer"
+#define IMS_REG_BUFFER_FILE "/data/ril/network/.network_register_ims_buffer"
+#define REG_CONFIG_FILE "/data/ril/network/.network_cfg"
+
+void get_network_register_timer_length_from_file()
+{
+ int fd_backup;
+ int ret;
+ memset(&s_register_cfg,0,sizeof (s_register_cfg));
+ fd_backup = open(REG_CONFIG_FILE,O_RDONLY | O_CREAT,0777);
+ if (fd_backup < 0) {
+ LYERRLOG("when get, Error opening register cfg file: %s\n",strerror(errno));
+ return;
+ }
+
+ ret = read(fd_backup,&s_register_cfg,sizeof (s_register_cfg));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get register cfg fail, ret is %d",__func__,ret);
+ }
+ else
+ {
+ LYINFLOG("%s get register cfg suc %d",__func__);
+ }
+ close(fd_backup);
+
+ return;
+}
+
+void set_network_register_timer_length_to_file()
+{
+ int fd_backup;
+ int ret;
+ fd_backup = open(REG_CONFIG_FILE,O_WRONLY | O_CREAT,0777);
+ if (fd_backup < 0) {
+ LYERRLOG("when set, Error opening register cfg file: %s\n",strerror(errno));
+ return;
+ }
+
+ ret = write(fd_backup,&s_register_cfg,sizeof (s_register_cfg));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set register cfg fail, ret is %d",__func__,ret);
+ }
+ else
+ {
+ LYINFLOG("%s set register cfg suc %d",__func__);
+ }
+ close(fd_backup);
+
+ return;
+}
+
+void set_register_voice_buffer_valid(int valid)
+{
+ s_register_voice_valid = valid;
+ if(valid==false)
+ {
+ stop_network_timer(s_register_timer_voice, register_sig_value_voice);
+ }
+}
+
+void set_register_data_buffer_valid(int valid)
+{
+ s_register_data_valid = valid;
+ if(valid==false)
+ {
+ stop_network_timer(s_register_timer_data, register_sig_value_data);
+ }
+}
+
+void set_register_ims_buffer_valid(int valid)
+{
+ s_register_ims_valid = valid;
+ if(valid==false)
+ {
+ stop_network_timer(s_register_timer_ims, register_sig_value_ims);
+ }
+}
+
+void start_network_timer(timer_t timer, int signal_value, int milliseconds) {
+ LYINFLOG("start_network_timer(), timer_id=%ld, signal_value=%d, time=%d",(long)timer, signal_value, milliseconds);
+
+ struct itimerspec expire;
+ expire.it_interval.tv_sec = 0;
+ expire.it_interval.tv_nsec = 0;
+ expire.it_value.tv_sec = milliseconds/1000;
+ expire.it_value.tv_nsec = (milliseconds%1000)*1000000;
+ if (timer_settime(timer, 0, &expire, NULL) == -1) {
+ LYERRLOG("timer_settime failed reason=[%s]", strerror(errno));
+ }
+}
+
+void stop_network_timer(timer_t timer, int signal_value) {
+ LYINFLOG("stop_network_timer(), timer_id=%ld, signal_value=%d", (long)timer, signal_value);
+ struct itimerspec timespec;
+ if(timer_gettime(timer, ×pec) == -1) {
+ LYERRLOG("stop_network_timer(), get time fail(%s)", strerror(errno));
+ return;
+ }
+ LYINFLOG("stop_network_timer(), tv_sec=%ld, tv_nsec=%ld",timespec.it_value.tv_sec, timespec.it_value.tv_nsec);
+ if((timespec.it_value.tv_sec == 0) && (timespec.it_value.tv_nsec == 0) ) {
+ LYINFLOG("stop_network_timer(), timer_id(%ld) had stopped, just return", (long)timer);
+ return;
+ } else {
+ start_network_timer(timer, signal_value, 0);
+ }
+}
+
+void network_timer_handler(sigval_t sig) {
+ LYINFLOG("network_timer_handler, sig_value: %d", sig.sival_int);
+ int s;
+ s = pthread_mutex_lock(&mtx);
+ if(s != 0) {
+ LYERRLOG("network_timer_handler, pthead_mutex_lock fail");
+ }
+ if(sig.sival_int == register_sig_value_voice)
+ {
+ s_register_voice_valid=false;
+ }
+ else if(sig.sival_int == register_sig_value_data)
+ {
+ s_register_data_valid=false;
+ }
+ else if(sig.sival_int == register_sig_value_ims)
+ {
+ s_register_ims_valid=false;
+ }
+ s = pthread_mutex_unlock(&mtx);
+ if(s != 0) {
+ LYERRLOG("network_timer_handler, pthread_mutex_unlock fail");
+ }
+}
+
+void init_network_timer(timer_t* timer, int signal_value)
+{
+ struct sigevent sevp;
+ memset(&sevp, 0, sizeof(sevp));
+ sevp.sigev_value.sival_int = signal_value;
+ sevp.sigev_notify = SIGEV_THREAD;
+ sevp.sigev_notify_function = network_timer_handler;
+
+ if(timer_create(CLOCK_MONOTONIC, &sevp, timer) == -1) {
+ LYERRLOG("init_network_timer() failed reason=[%s]", strerror(errno));
+ }
+ LYINFLOG("init_network_timer(), timer_Id = %ld, signal_value=%d", (long)(*timer), signal_value);
+}
+
+void init_network_timer_all() {
+ init_network_timer(&s_register_timer_voice,register_sig_value_voice);
+ init_network_timer(&s_register_timer_data,register_sig_value_data);
+ init_network_timer(&s_register_timer_ims,register_sig_value_ims);
+ s_register_voice_valid = false;
+ s_register_data_valid = false;
+ s_register_ims_valid = false;
+
+ get_network_register_timer_length_from_file();
+}
+
+void deinit_network_timer_all()
+{
+ stop_network_timer(s_register_timer_voice, register_sig_value_voice);
+ stop_network_timer(s_register_timer_data, register_sig_value_data);
+ stop_network_timer(s_register_timer_ims, register_sig_value_ims);
+ s_register_voice_valid = false;
+ s_register_data_valid = false;
+ s_register_ims_valid = false;
+}
+
+void lynq_set_registration_state_to_buf_voice(int regState,int netType,int netRejected)
+{
+ int ret;
+ int fd_backup;
+
+ if(s_register_cfg.voice_valid_period<=0)
+ {
+ LYINFLOG("%s timer length is not greater than 0",__func__);
+ return;
+ }
+
+ fd_backup = open(VOICE_REG_BUFFER_FILE,O_WRONLY | O_CREAT,0777);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate voice buffer file: %s\n",strerror(errno));
+ return ;
+ }
+
+ ret = write(fd_backup,®State,sizeof (regState));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set regState fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,&netType,sizeof (netType));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set netType fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,&netRejected,sizeof (netRejected));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set netRejected fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ sync();
+ close(fd_backup);
+ start_network_timer(s_register_timer_voice,register_sig_value_voice,s_register_cfg.voice_valid_period*1000);
+ s_register_voice_valid=true;
+
+ LYINFLOG("set_registration_state voice suc, regState is %d, netType is %d, netRejected is %d",regState,netType,netRejected);
+ return;
+
+error_done:
+
+ close(fd_backup);
+ return;
+}
+void lynq_set_registration_state_to_buf_data(int regState,char * LAC,char * CID,int netType)
+{
+ int ret;
+ int stringLen;
+ int fd_backup;
+
+ if(s_register_cfg.data_valid_period <=0)
+ {
+ LYINFLOG("%s timer length is not greater than 0",__func__);
+ return;
+ }
+
+ fd_backup = open(DATA_REG_BUFFER_FILE,O_WRONLY | O_CREAT,0777);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate data buffer file: %s\n",strerror(errno));
+ return ;
+ }
+
+ ret = write(fd_backup,®State,sizeof (regState));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set regState fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,&netType,sizeof (netType));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set netType fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ stringLen=strlen(LAC)+1;
+ ret = write(fd_backup,&stringLen,sizeof (stringLen));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set lac stringLen %d fail, ret is %d",__func__, stringLen, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,LAC,stringLen);
+ if(ret<=0)
+ {
+ LYERRLOG("%s set lac fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ stringLen=strlen(CID)+1;
+ ret = write(fd_backup,&stringLen,sizeof (stringLen));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set cid stringLen %d fail, ret is %d",__func__, stringLen, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,CID,stringLen);
+ if(ret<=0)
+ {
+ LYERRLOG("%s set cid fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ sync();
+ close(fd_backup);
+ start_network_timer(s_register_timer_data,register_sig_value_data,s_register_cfg.data_valid_period*1000);
+ s_register_data_valid=true;
+
+ LYINFLOG("set_registration_state data suc, regState is %d, netType is %d, LAC is %s, CID is %s",regState,netType,LAC,CID);
+ return;
+
+error_done:
+
+ close(fd_backup);
+ return;
+}
+void lynq_set_registration_state_to_buf_ims(int imsRegState,int radioTechFam)
+{
+ int ret;
+ int fd_backup;
+
+ if(s_register_cfg.ims_valid_period<=0)
+ {
+ LYINFLOG("%s timer length is not greater than 0",__func__);
+ return;
+ }
+
+ fd_backup = open(IMS_REG_BUFFER_FILE,O_WRONLY | O_CREAT,0777);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate ims buffer file: %s\n",strerror(errno));
+ return ;
+ }
+
+ ret = write(fd_backup,&imsRegState,sizeof (imsRegState));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set imsRegState fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = write(fd_backup,&radioTechFam,sizeof (radioTechFam));
+ if(ret<=0)
+ {
+ LYERRLOG("%s set radioTechFam fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ sync();
+ close(fd_backup);
+ start_network_timer(s_register_timer_ims,register_sig_value_ims,s_register_cfg.ims_valid_period*1000);
+ s_register_ims_valid=true;
+
+ LYINFLOG("set_registration_state ims suc, imsRegState is %d, radioTechFam is %d",imsRegState,radioTechFam);
+ return;
+
+error_done:
+
+ close(fd_backup);
+ return;
+}
+
+int lynq_get_registration_state_to_buf_voice(int* regState,int *netType,int *netRejected)
+{
+ int ret;
+ int fd_backup;
+
+ if(!s_register_voice_valid)
+ {
+ LYINFLOG("registration voice buffer is false");
+ return 1;
+ }
+
+ fd_backup = open(VOICE_REG_BUFFER_FILE, O_RDONLY);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate voice buffer file: %s\n",strerror(errno));
+ s_register_voice_valid=false;
+ return -1;
+ }
+
+ ret = read(fd_backup,regState,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get regState fail, ret is %d",__func__,ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,netType,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get netType fail, ret is %d",__func__,ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,netRejected,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get netRejected fail, ret is %d",__func__,ret);
+ goto error_done;
+ }
+
+
+ close(fd_backup);
+ LYINFLOG("get_registration_state voice suc, regState is %d, netType is %d, netRejected is %d",*regState,*netType,*netRejected);
+ return 0;
+
+error_done:
+ s_register_voice_valid=false;
+ close(fd_backup);
+ return -1;
+}
+int lynq_get_registration_state_to_buf_data(int* regState,char * LAC,char * CID,int *netType)
+{
+ int ret;
+ int stringLen;
+ int fd_backup;
+
+ if(!s_register_data_valid)
+ {
+ LYINFLOG("registration data buffer is false");
+ return 1;
+ }
+
+ fd_backup = open(DATA_REG_BUFFER_FILE,O_RDONLY);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate data buffer file: %s\n",strerror(errno));
+ return -1;
+ }
+
+ ret = read(fd_backup,regState,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get regState fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,netType,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get netType fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,&stringLen,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get lac stringLen fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,LAC,stringLen);
+ if(ret<=0)
+ {
+ LYERRLOG("%s get lac fail, ret is %d, stringLen is %d",__func__, ret,stringLen);
+ goto error_done;
+ }
+
+
+ ret = read(fd_backup,&stringLen,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get cid stringLen fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,CID,stringLen);
+ if(ret<=0)
+ {
+ LYERRLOG("%s get cid fail, ret is %d, stringLen is %d",__func__, ret,stringLen);
+ goto error_done;
+ }
+
+ close(fd_backup);
+
+ LYINFLOG("get_registration_state data suc, regState is %d, netType is %d, LAC is %s, CID is %s",*regState,*netType,LAC,CID);
+ return 0;
+
+error_done:
+ s_register_data_valid =false;
+ close(fd_backup);
+ return -1;
+
+}
+int lynq_get_registration_state_to_buf_ims(int* imsRegState,int *radioTechFam)
+{
+ int ret;
+ int fd_backup;
+
+ if(!s_register_ims_valid)
+ {
+ LYINFLOG("registration ims buffer is false");
+ return 1;
+ }
+
+ fd_backup = open(IMS_REG_BUFFER_FILE,O_RDONLY);
+
+ if (fd_backup < 0) {
+ LYERRLOG("Error opening registrate ims buffer file: %s\n",strerror(errno));
+ return -1;
+ }
+
+ ret = read(fd_backup,imsRegState,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get imsRegState fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ ret = read(fd_backup,radioTechFam,sizeof (int));
+ if(ret<=0)
+ {
+ LYERRLOG("%s get radioTechFam fail, ret is %d",__func__, ret);
+ goto error_done;
+ }
+
+ close(fd_backup);
+
+ LYINFLOG("get_registration_state ims suc, imsRegState is %d, radioTechFam is %d",*imsRegState,*radioTechFam);
+ return 0;
+
+error_done:
+ s_register_ims_valid =false;
+ close(fd_backup);
+ return -1;
+}
+
+void lynq_set_voice_registration_valid_period(int valid_period)
+{
+ s_register_cfg.voice_valid_period=valid_period;
+ stop_network_timer(s_register_timer_voice, register_sig_value_voice);
+ s_register_voice_valid=false;
+ set_network_register_timer_length_to_file();
+}
+
+void lynq_set_data_registration_valid_period(int valid_period)
+{
+ s_register_cfg.data_valid_period = valid_period;
+ stop_network_timer(s_register_timer_data, register_sig_value_data);
+ s_register_data_valid=false;
+ set_network_register_timer_length_to_file();
+}
+
+void lynq_set_ims_registration_valid_period(int valid_period)
+{
+ s_register_cfg.ims_valid_period=valid_period;
+ stop_network_timer(s_register_timer_ims, register_sig_value_ims);
+ s_register_ims_valid=false;
+ set_network_register_timer_length_to_file();
+}
+
+int lynq_get_voice_registration_valid_period()
+{
+ return s_register_cfg.voice_valid_period;
+}
+
+int lynq_get_data_registration_valid_period()
+{
+ return s_register_cfg.data_valid_period;
+}
+
+int lynq_get_ims_registration_valid_period()
+{
+ return s_register_cfg.ims_valid_period;
+}
+
diff --git a/src/lynq/lib/liblynq-network/lynq_network_state_buffer.h b/src/lynq/lib/liblynq-network/lynq_network_state_buffer.h
new file mode 100755
index 0000000..c0e20be
--- /dev/null
+++ b/src/lynq/lib/liblynq-network/lynq_network_state_buffer.h
@@ -0,0 +1,24 @@
+#ifndef LYNQ_NETWORK_STATE_BUFFER_H
+#define LYNQ_NETWORK_STATE_BUFFER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+void set_register_voice_buffer_valid(int valid);
+void set_register_data_buffer_valid(int valid);
+void set_register_ims_buffer_valid(int valid);
+void stop_network_timer(timer_t timer, int signal_value);
+void start_network_timer(timer_t timer, int signal_value, int milliseconds);
+void init_network_timer_all();
+void deinit_network_timer_all();
+void lynq_set_registration_state_to_buf_voice(int regState,int netType,int netRejected);
+void lynq_set_registration_state_to_buf_data(int regState,char * LAC,char * CID,int netType);
+void lynq_set_registration_state_to_buf_ims(int imsRegState,int radioTechFam);
+int lynq_get_registration_state_to_buf_voice(int* regState,int *netType,int *netRejected);
+int lynq_get_registration_state_to_buf_data(int* regState,char * LAC,char * CID,int *netType);
+int lynq_get_registration_state_to_buf_ims(int* imsRegState,int *radioTechFam);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/lynq/lib/liblynq-network/makefile b/src/lynq/lib/liblynq-network/makefile
index 7174f89..491d547 100755
--- a/src/lynq/lib/liblynq-network/makefile
+++ b/src/lynq/lib/liblynq-network/makefile
@@ -28,6 +28,7 @@
LOCAL_LIBS := \
-L. \
-ldl \
+ -lrt \
-llog \
-lbinder \
-lpthread \
diff --git a/src/lynq/lib/liblynq-sim/include/lynq_sim.h b/src/lynq/lib/liblynq-sim/include/lynq_sim.h
index b0457df..923d03b 100755
--- a/src/lynq/lib/liblynq-sim/include/lynq_sim.h
+++ b/src/lynq/lib/liblynq-sim/include/lynq_sim.h
@@ -66,6 +66,12 @@
*/
int lynq_get_version(char buf[]);
+/**
+ * @brief sim power on/off
+ *
+ */
+int lynq_sim_power(int mode);
+
#ifdef __cplusplus
diff --git a/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp b/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
index b9f12ea..913599c 100755
--- a/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
+++ b/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
@@ -136,6 +136,10 @@
/*If you need to use any API under lynq_sim, you mustfirst call the lynq_sim_init() function to initialize these functions.*/
int lynq_get_sim_status(int *card_status)
{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(card_status == NULL)
return ret;
@@ -181,6 +185,10 @@
int lynq_get_imsi(char buf[])
{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(buf == NULL)
return ret;
@@ -230,6 +238,10 @@
/*add by lei*/
int lynq_get_iccid(char buf[]){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(buf == NULL)
return ret;
@@ -274,6 +286,10 @@
}
int lynq_enable_pin(char *pin){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(pin == NULL)
return ret;
@@ -315,7 +331,64 @@
return error1;
}
+int lynq_sim_power(int mode)
+{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
+ int ret = -1;
+ int send_num = 0;
+ int recv_num = 0;
+ int len = 0;
+ char res_data[MAX_LEN] = {0};
+ client_t.request = RIL_REQUEST_OEM_HOOK_RAW;
+ client_t.paramLen = 1;
+ client_t.uToken = Global_uToken;
+ char buf[64] = {0};
+ sprintf(buf, "%s%d", "AT+ESIMPOWER=", mode);
+ sprintf(client_t.param, "%s\n", buf);
+ pthread_mutex_lock(&g_lynq_sim_sendto_mutex);
+ send_num = sendto(sock_fd, &client_t, sizeof(client_t), 0, (struct sockaddr *)&addr_serv, len_addr_serv);
+ if(send_num < 0)
+ {
+ RLOGD("sendto error:");
+ return ret;
+ }
+ //get data msg
+ recv_num = recvfrom(sock_fd,res_data,sizeof(char)*MAX_LEN,0,(struct sockaddr *)&addr_serv,(socklen_t*)&len_addr_serv);
+ pthread_mutex_unlock(&g_lynq_sim_sendto_mutex);
+ if(recv_num < 0 || recv_num == 0)
+ {
+ RLOGD("recvfrom step2 fail:");
+ return recv_num;
+ }
+ Parcel p;
+ p.setData((uint8_t *)res_data,sizeof(char)*recv_num); // p.setData((uint8_t *) buffer, buflen);
+ p.setDataPosition(0);
+ int num = -1;
+ if(p.dataAvail() > 0)
+ {
+ char test[128] = {0};
+ p.readInt32(&resp_type);
+ p.readInt32(&request);
+ p.readInt32(&slot_id);
+ p.readInt32(&error1);
+ p.readInt32(&num);
+ if(num == -1){
+ }else{
+ p.read(test, num);
+ return error1;
+ }
+ }
+ return error1;
+}
+
int lynq_disable_pin(char *pin){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(pin == NULL)
return ret;
@@ -355,6 +428,10 @@
}
int lynq_query_pin_lock(char *pin,int buf[]){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(pin == NULL)
return ret;
@@ -405,6 +482,10 @@
}
int lynq_verify_pin(char *pin){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(pin == NULL)
return ret;
@@ -445,6 +526,10 @@
}
int lynq_change_pin(char *old_pin, char *new_pin){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(old_pin == NULL || new_pin == NULL)
return ret;
@@ -489,6 +574,10 @@
}
int lynq_unlock_pin(char *puk, char *pin){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(puk == NULL || pin == NULL)
return ret;
@@ -587,6 +676,10 @@
}
int lynq_query_phone_number(char buf[]){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(buf == NULL)
return ret;
@@ -654,7 +747,11 @@
}
int lynq_get_imei(char buf[])
-{
+{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(buf == NULL)
return ret;
@@ -714,6 +811,10 @@
}
int lynq_switch_card(int slot){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(!judge(slot))
return ret;
@@ -734,6 +835,10 @@
}
int lynq_screen(int num){
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(!judge(num))
return ret;
@@ -817,7 +922,11 @@
}
int lynq_req_sim_io(int list[5], char *path, char *data, char *pin2, char *aidPtr, int sw[2], char *simResponse)
-{
+{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
int ret = -1;
if(judge_illegal(list, path, data, pin2, aidPtr, sw, simResponse))
{
diff --git a/src/lynq/lib/liblynq-sms/src/lynq_sms.cpp b/src/lynq/lib/liblynq-sms/src/lynq_sms.cpp
index 5101671..ff92141 100755
--- a/src/lynq/lib/liblynq-sms/src/lynq_sms.cpp
+++ b/src/lynq/lib/liblynq-sms/src/lynq_sms.cpp
@@ -156,6 +156,10 @@
}
int lynq_wait_receive_new_sms(int *handle)
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
if(handle==NULL)
{
LYERRLOG("handle is null!!!");
@@ -165,7 +169,7 @@
*handle = sms_storage_index;
return 0;
}
-int recvfrom_server(void *resp)
+int recvfrom_server(void *resp, int id)
{
char recv_buf[4096] = {0};
int recv_len = 0;
@@ -174,21 +178,24 @@
int32_t resp_type = 0;
int32_t request = 0;
int32_t slot_id = 0;
- int32_t error = 0;
- recv_len = recvfrom(sms_instance.sock_fd, recv_buf, sizeof(recv_buf), 0, (struct sockaddr*)&sms_instance.addrfrom, (socklen_t*)&len);
- LYDBGLOG("##################recv length:%d\n", recv_len);
- if(recv_len <= 0){
- LYERRLOG("recvform error: %s\n", strerror(errno));
- return SMS_FAIL;
- }
- resp_parcel.setData((uint8_t *)recv_buf,recv_len);
- resp_parcel.setDataPosition(0);
- if(resp_parcel.dataAvail() > 0)
+ int32_t error = -1;
+ while (request != id)
{
- resp_parcel.readInt32(&resp_type);
- resp_parcel.readInt32(&request);
- resp_parcel.readInt32(&slot_id);
- resp_parcel.readInt32(&error);
+ recv_len = recvfrom(sms_instance.sock_fd, recv_buf, sizeof(recv_buf), 0, (struct sockaddr*)&sms_instance.addrfrom, (socklen_t*)&len);
+ LYDBGLOG("##################recv length:%d\n", recv_len);
+ if(recv_len <= 0){
+ LYERRLOG("recvform error: %s\n", strerror(errno));
+ return SMS_FAIL;
+ }
+ resp_parcel.setData((uint8_t *)recv_buf,recv_len);
+ resp_parcel.setDataPosition(0);
+ if(resp_parcel.dataAvail() > 0)
+ {
+ resp_parcel.readInt32(&resp_type);
+ resp_parcel.readInt32(&request);
+ resp_parcel.readInt32(&slot_id);
+ resp_parcel.readInt32(&error);
+ }
}
LYDBGLOG("resp data: %d,%d, %d,%d\n", resp_type, request, slot_id, error);
switch(request)
@@ -384,6 +391,10 @@
int lynq_send_sms(char telephony_num[TELEPHONE_NUM_LEN], int charset, char *msg)
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
lynq_client_t client;
int ret = SMS_OK;
if (NULL == msg)
@@ -398,11 +409,11 @@
client.request = RIL_REQUEST_SEND_SMS;
client.uToken = GuToken;
client.paramLen = 3;
-
+ bzero(client.param, 8*1024);
sprintf(client.param, "%s %d %s\n", telephony_num, charset, msg);
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
ret = send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server(NULL);
+ ret = recvfrom_server(NULL, RIL_REQUEST_SEND_SMS);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
return ret;
@@ -410,6 +421,10 @@
int lynq_read_sms(int index,int *status,int *charset,char smsc[SMSC_MAX_LEN],int *smscLen,int *smslen,char message[MSG_MAX_LEN],char teleNum[TELEPHONE_NUM_LEN],int *numLen,int *current,int *total)
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
lynq_client_t client;
lynq_sms_msg_info_t sms_msg_info;
int lenTemp = -1;
@@ -417,10 +432,11 @@
client.request = LYNQ_REQUEST_READ_SMS_FROM_MEMORY;
client.uToken = GuToken;
client.paramLen = 1;
+ bzero(client.param, 8*1024);
sprintf(client.param, "%d", index);
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
ret = send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server((void *)&sms_msg_info);
+ ret = recvfrom_server((void *)&sms_msg_info, LYNQ_REQUEST_READ_SMS_FROM_MEMORY);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
if(ret == 0)
{
@@ -449,6 +465,10 @@
int lynq_get_smsc_address(char service_num[SMSC_MAX_LEN])
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
if(NULL == service_num)
{
return -1;
@@ -461,7 +481,7 @@
client.paramLen = 0;
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
ret = send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server(service_num);
+ ret = recvfrom_server(service_num, RIL_REQUEST_GET_SMSC_ADDRESS);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
return ret;
@@ -469,6 +489,10 @@
int lynq_set_smsc_address(const char* service_num)
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
if(NULL == service_num)
{
return -1;
@@ -483,10 +507,11 @@
client.request = RIL_REQUEST_SET_SMSC_ADDRESS;
client.uToken = GuToken;
client.paramLen = 1;
+ bzero(client.param, 8*1024);
sprintf(client.param, "%s", service_num);
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server(NULL);
+ ret = recvfrom_server(NULL, RIL_REQUEST_SET_SMSC_ADDRESS);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
return ret;
@@ -494,6 +519,10 @@
int lynq_list_sms(char index_list[SMS_NUM_MAX])
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
lynq_client_t client;
int ret = SMS_OK;
client.request = LYNQ_REQUEST_LIST_SMS_FROM_MEMORY;
@@ -501,13 +530,17 @@
client.paramLen = 0;
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
ret = send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server((void *)index_list);
+ ret = recvfrom_server((void *)index_list, LYNQ_REQUEST_LIST_SMS_FROM_MEMORY);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
return ret;
}
int lynq_delete_sms(int index)
{
+ if(g_lynq_sms_init_flag == 0)
+ {
+ return -1;
+ }
lynq_client_t client;
int ret = SMS_OK;
client.request = LYNQ_REQUEST_DELETE_SMS_FROM_MEMORY;
@@ -517,7 +550,7 @@
sprintf(client.param, "%d", index);
pthread_mutex_lock(&g_lynq_sms_sendto_mutex);
ret = send_buff_to_service((char *)&client, sizeof(client));
- ret = recvfrom_server(NULL);
+ ret = recvfrom_server(NULL, LYNQ_REQUEST_DELETE_SMS_FROM_MEMORY);
pthread_mutex_unlock(&g_lynq_sms_sendto_mutex);
return ret;
}
diff --git a/src/telephonyware/3.0/libvendor-ril/mtk-rilproxy/framework/base/RfxTransferUtils.cpp b/src/telephonyware/3.0/libvendor-ril/mtk-rilproxy/framework/base/RfxTransferUtils.cpp
index bd5e781..5f0362a 100755
--- a/src/telephonyware/3.0/libvendor-ril/mtk-rilproxy/framework/base/RfxTransferUtils.cpp
+++ b/src/telephonyware/3.0/libvendor-ril/mtk-rilproxy/framework/base/RfxTransferUtils.cpp
@@ -1578,6 +1578,8 @@
return;
invalid:
+ dataEnd;
+ IT_PRINT_LOG;
invalidCommandBlock(id);
return;
}