Merge "[Bugfix][API-1313]after flash_erase system_a, can't startup" into GSW3.0-No-Connman
diff --git a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
index fd8e9dd..25e060a 100755
--- a/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
+++ b/meta/meta-mediatek-mt2735/recipes-lynq/suspend-service/files/autosuspend_wakeup_count.c
@@ -45,6 +45,10 @@
#define BASE_SLEEP_TIME 100000
#define POSSIBLE_MAX_SLEEP_TIME 60000000
+#define LOG_UCI_MODULE "lynq_autosuspend"
+#define LOG_UCI_FILE "lynq_uci"
+
+
static int state_fd;
static int wakeup_count_fd;
static int suspend_ctrl_fd;
@@ -73,7 +77,6 @@
static long end_time;
-
# define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
@@ -233,17 +236,17 @@
int ret = 0;
int i;
int flag = -1;
-
+ char tmp[20];
system("echo \"Sys standby mode\" >/dev/console");
- // sleep(1);
+
+ lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "debug", tmp);
+ adb_debug_mode=atoi(tmp);
+
if(adb_debug_mode == 2)
{
system("echo 11 | emdlogger_ctrl");
}
- else
- {
- system("echo 7 | emdlogger_ctrl");
- }
+
if (lynq_screen(0) != 0) //notify ril for screen off
{
ALOGI("lynq_screen off fail\n");
@@ -325,10 +328,6 @@
sleep(1);
system("echo 6 | emdlogger_ctrl");//start modem log SD mode
}
- else
- {
- system("echo 6 | emdlogger_ctrl");//start modem log SD mode
- }
usleep(200000);
ALOGI("Log on with failure\n");
@@ -346,10 +345,7 @@
sleep(1);
system("echo 6 | emdlogger_ctrl");//start modem log SD mode
}
- else
- {
- system("echo 6 | emdlogger_ctrl");//start modem log SD mode
- }
+
usleep(300000); //delay 2s for ril handling screen on,at least 70ms
diff --git a/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/files/mdlog1.config b/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/files/mdlog1.config
new file mode 100755
index 0000000..593f470
--- /dev/null
+++ b/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/files/mdlog1.config
Binary files differ
diff --git a/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/mdlogger_1.0.0.bb b/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/mdlogger_1.0.0.bb
old mode 100644
new mode 100755
index 52cb262..e33c107
--- a/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/mdlogger_1.0.0.bb
+++ b/meta/meta-mediatek-mt2735/recipes-telephony/mdlogger/mdlogger_1.0.0.bb
@@ -5,6 +5,7 @@
LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"
FILESEXTRAPATHS_append := ":${THISDIR}/files"
SRC_URI = "file://mdlogger.config"
+SRC_URI += "file://mdlog1.config"
DEPENDS += "uci mipc libccci"
@@ -17,6 +18,7 @@
FILES_${PN} += "/usr/lib/libmdloggerrecycle.a /usr/bin/emdlogger1 /usr/bin/emdlogger_ctrl"
FILES_${PN} += "/etc/config/mdlog"
+FILES_${PN} += "/data/mdlog/mdlog1_config"
INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN} += "installed-vs-shipped"
@@ -32,6 +34,8 @@
do_install() {
install -d ${D}/usr/lib/
install -d ${D}/usr/bin/
+ install -d ${D}/data/mdlog/
+ install -m 0660 ${WORKDIR}/mdlog1.config ${D}/data/mdlog/mdlog1_config
if [ -d "${WORKONSRC}" ]; then
install -m 0755 ${S}src/emdlogger/libmdloggerrecycle.a ${D}/usr/lib/
install -m 0755 ${S}src/emdlogger/emdlogger1 ${D}/usr/bin/
diff --git a/src/bsp/hsm/src/application/bootloader/mt2735/bootloader.c b/src/bsp/hsm/src/application/bootloader/mt2735/bootloader.c
index aaee340..da1ebbe 100644
--- a/src/bsp/hsm/src/application/bootloader/mt2735/bootloader.c
+++ b/src/bsp/hsm/src/application/bootloader/mt2735/bootloader.c
@@ -320,6 +320,8 @@
uint32_t i = 0;
int32_t bld_loaded = 0;
int32_t ret = BL_OK;
+ int slot = 0; //jb.qi modify for ab_rollback start on 20231117
+ int ret_mark; //jb.qi modify for ab_rollback start on 20231117
struct bdev *dev = NULL;
uint8_t label[MAX_PART_NAME_LEN] = "bl2";
@@ -370,6 +372,12 @@
break;
} else {
LOGE("load img a fail\r\n");
+ /*jb.qi modify for ab_rollback start on 20231117*/
+ slot = get_current_slot();
+ LOGD("get_current_slot is %d\r\n", slot);
+ ret_mark = mark_slot_unsuccessful(slot);
+ LOGD("mark_slot_unsuccessful ret is %d\r\n", ret_mark);
+ /*jb.qi modify for ab_rollback end on 20231117*/
bl_flash_partition_deinit(boot_device_list[i], device_name);
}
}
diff --git a/src/bsp/hsm/src/middleware/bootloader/bootctrl/bootctrl_api.c b/src/bsp/hsm/src/middleware/bootloader/bootctrl/bootctrl_api.c
index 68d8dc6..c66daf7 100644
--- a/src/bsp/hsm/src/middleware/bootloader/bootctrl/bootctrl_api.c
+++ b/src/bsp/hsm/src/middleware/bootloader/bootctrl/bootctrl_api.c
@@ -403,6 +403,33 @@
return slotp->bl_ver;
}
+/*jb.qi modify for ab_rollback start on 20231117*/
+int mark_slot_unsuccessful(int slot)
+{
+ int ret = -1;
+ AvbABSlotData *slotp;
+ AvbABData metadata;
+
+ if (slot < 0 || slot >= SLOT_COUNT) {
+ return -1;
+ }
+
+ ret = read_write_partition_info(&metadata, READ_PARTITION);
+ if (ret < 0) {
+ return -1;
+ }
+
+ slotp = &metadata.slots[slot];
+ slotp->successful_boot = 0;
+
+ ret = read_write_partition_info(&metadata, WRITE_PARTITION);
+ if (ret < 0) {
+ return -1;
+ }
+
+ return 0;
+}
+/*jb.qi modify for ab_rollback end on 20231117*/
int check_ab_boot(void) {
int slot;
diff --git a/src/bsp/hsm/src/middleware/bootloader/include/bootctrl.h b/src/bsp/hsm/src/middleware/bootloader/include/bootctrl.h
index 7ee3f7e..c3b3814 100644
--- a/src/bsp/hsm/src/middleware/bootloader/include/bootctrl.h
+++ b/src/bsp/hsm/src/middleware/bootloader/include/bootctrl.h
@@ -183,6 +183,14 @@
*/
int get_bl_ver_data(int slot);
+/*jb.qi modify for ab_rollback start on 20231117*/
+/**
+* mark_slot_unsuccessful() mark the slot unsuccessful.
+* Returns mark success or fail.
+*/
+int mark_slot_unsuccessful(int slot);
+/*jb.qi modify for ab_rollback end on 20231117*/
+
/**
* check_ab_boot() - check ab boot status
*
diff --git a/src/kernel/linux/v4.19/drivers/net/phy/phy.c b/src/kernel/linux/v4.19/drivers/net/phy/phy.c
index b9d8bd7..a52cf9b 100644
--- a/src/kernel/linux/v4.19/drivers/net/phy/phy.c
+++ b/src/kernel/linux/v4.19/drivers/net/phy/phy.c
@@ -884,6 +884,9 @@
* of rtnl_lock(), but PHY_HALTED shall guarantee phy_change()
* will not reenable interrupts.
*/
+/*xf.li@20231117 add for API-1429 start*/
+ phy_state_machine(&phydev->state_queue.work);
+/*xf.li@20231117 add for API-1429 end*/
}
EXPORT_SYMBOL(phy_stop);
diff --git a/src/lynq/framework/lynq-sdk-ready/src/timer/lynq_timer.cpp b/src/lynq/framework/lynq-sdk-ready/src/timer/lynq_timer.cpp
index e007262..4d5c7ee 100755
--- a/src/lynq/framework/lynq-sdk-ready/src/timer/lynq_timer.cpp
+++ b/src/lynq/framework/lynq-sdk-ready/src/timer/lynq_timer.cpp
@@ -397,14 +397,14 @@
{
RLOGD("@@@@@@@num=%d\n", num);
flag = 0;
- ret[0] = system("uci show | grep \"lynq_uci.lynq_ril\"");
+ ret[0] = system("uci show | grep \"lynq_uci.lynq_ril\" > /dev/null");
if(ret[0] != 0)
{
RLOGD("lynq_uci unload\n");
flag = 1;
}
- ret[1] = system("uci show | grep \"^lynq_uci_ro\.\"");
+ ret[1] = system("uci show | grep \"^lynq_uci_ro\.\" > /dev/null");
if(ret[1] != 0)
{
RLOGD("lynq_uci_ro unload\n");
@@ -418,21 +418,21 @@
flag = 1;
}
- ret[3] = system("uci show | grep \"^radio_property\.\"");
+ ret[3] = system("uci show | grep \"^radio_property\.\" > /dev/null");
if(ret[3] != 0)
{
RLOGD("radio_property unload\n");
flag = 1;
}
- ret[4] = system("uci show | grep \"^service\.\"");
+ ret[4] = system("uci show | grep \"^service\.\" > /dev/null");
if(ret[4] != 0)
{
RLOGD("service unload\n");
flag = 1;
}
- ret[5] = system("uci show | grep \"^usb\.\"");
+ ret[5] = system("uci show | grep \"^usb\.\" > /dev/null");
if(ret[5] != 0)
{
RLOGD("usb unload\n");
@@ -444,7 +444,7 @@
{
RLOGD("config reload\n");
result = chdir("/data_backup/");
- result =system("tar -zxvf userdata.tar.gz -C /STATE/");
+ result =system("tar -zxvf userdata.tar.gz -C /STATE/ >/dev/null");
if(result!= 0)
{
RLOGD("cp config fail\n");
diff --git a/src/lynq/lib/liblynq-wifi6/libwifi6.c b/src/lynq/lib/liblynq-wifi6/libwifi6.c
index 0a5a4e3..e99ff0d 100755
--- a/src/lynq/lib/liblynq-wifi6/libwifi6.c
+++ b/src/lynq/lib/liblynq-wifi6/libwifi6.c
@@ -1756,6 +1756,37 @@
return ret;
}
+/*
+ *add func to get conencted STA device ip from dnsmasq ap0.lease
+ *return 0 means get ip success
+ */
+static int inner_get_ip_by_mac_lease(const char * mac, char * ip,int ip_len)
+{
+ char * p;
+ int ret;
+ char cmd[256]={0};
+ if (NULL == mac || NULL == ip)
+ return -1;
+ memset(ip, 0, ip_len);
+ sprintf(cmd, "cat /run/wg870/ap0.lease | grep \"%s\" | awk '{print $3}'", mac);
+ ret = exec_cmd(cmd, ip, ip_len);
+ if( ret == 0 )
+ {
+ p = strchr(ip, '\n');
+ if (NULL != p)
+ {
+ *p = '\0';
+ RLOGD("inner_get_ip_by_mac_lease %s function return is:%d", ip,ret);
+ return ret;
+ }else
+ {
+ ret = -1;
+ }
+ }
+ RLOGD("%s %d function return is:%d",__func__,__LINE__,ret);
+ return ret;
+
+}
static int inner_get_ip_by_mac(const char * mac, char * ip, int ip_len)
{
@@ -1771,6 +1802,9 @@
if (NULL != p)
{
*p = '\0';
+ }else
+ {
+ ret = inner_get_ip_by_mac_lease(mac,ip,ip_len);
}
RLOGD("inner_get_ip_by_mac %s\n", ip);
return ret;
@@ -2213,7 +2247,7 @@
char lynq_wifi_frequency_cmd[128]={0};
char lynq_cmd_mode[128]={0};
char lynq_cmd_slect[128]={0};
- RLOGD("enter lynq_wifi_ap_frequency_set and input frequency is:%d", lynq_wifi_frequency);
+ RLOGD("enter %s %d input frequency:%d",__func__,__LINE__,lynq_wifi_frequency);
//@do check input frequency
check = lynq_check_set_frequency(lynq_wifi_frequency);
if(check != 0)
@@ -2247,6 +2281,7 @@
DO_OK_FAIL_REQUEST(lynq_cmd_mode);
DO_OK_FAIL_REQUEST(cmd_save_config);
//@ tmp do down/up to fix 5G AP turn to 2.4G cannot be conenct
+
system("wl down");
system("wl up");
RLOGD("[%s] -- run cmd down/up --%d",__func__,__LINE__);
@@ -2678,13 +2713,10 @@
int lynq_wifi_ap_start(lynq_wifi_index_e idx)
{
- RLOGD("[lynq_wifi]----enter lynq_wifi_ap_start");
+ RLOGD("enter %s %d",__func__,__LINE__);
char LYNQ_WIFI_CMD[128]={0};
- //const char *lynq_remove_all_cmd = "REMOVE_NETWORK all";
- //const char *lynq_reconfig_cmd = "RECONFIGURE /data/wifi/wg870/wpa_supplicant.conf";
- RLOGD("enter lynq_wifi_ap_channel_get");
- CHECK_IDX(idx, CTRL_AP);
+ CHECK_IDX(idx, CTRL_AP);
CHECK_WPA_CTRL(CTRL_AP);
if (inner_get_ap_interface_name() == NULL)
@@ -2693,8 +2725,6 @@
return -1;
}
- //DO_OK_FAIL_REQUEST(lynq_remove_all_cmd);
- //DO_OK_FAIL_REQUEST(lynq_reconfig_cmd);
sprintf(LYNQ_WIFI_CMD,"SELECT_NETWORK %d",AP_NETWORK_0);
DO_OK_FAIL_REQUEST(LYNQ_WIFI_CMD);
@@ -2722,8 +2752,8 @@
}
RLOGD("[lynq_wifi_ap_start] creat APTmpWatcherThreadProc ok");
}
- RLOGD("[lynq_wifi]----end lynq_wifi_ap_start");
+ RLOGD("end %s %d",__func__,__LINE__);
return 0;
}
@@ -2734,6 +2764,7 @@
int lynq_wifi_ap_stop(lynq_wifi_index_e idx)
{
+ RLOGD("enter %s %d",__func__,__LINE__);
char LYNQ_WIFI_CMD[128]={0};
CHECK_IDX(idx, CTRL_AP);
@@ -2744,7 +2775,6 @@
DO_OK_FAIL_REQUEST(LYNQ_WIFI_CMD);
-// system("connmanctl tether wifi off");
ret = system_call_v("%s %s", start_stop_ap_script, "stop");
if (ret != 0)
@@ -2757,6 +2787,7 @@
pthread_join(g_ap_tmp_watcher_pid, NULL);
g_ap_tmp_watcher_pid = 0;
+ RLOGD("end %s %d",__func__,__LINE__);
return 0;
}
@@ -3118,10 +3149,8 @@
{
if (memcmp(ssid + 1, ap->ap_ssid, strlen(ap->ap_ssid)) == 0 && ssid[strlen(ap->ap_ssid) + 1] == '\"')
{
- RLOGD("-----curr_get ssid form config is %s",ssid);
break;
}
- RLOGD("-----countine to find dest ssid %s ---curr_get ssid from config is %s",ap->ap_ssid,ssid);
}
else
{
@@ -3135,7 +3164,6 @@
}
if (memcmp(tmp_ssid, ap->ap_ssid, ssid_len) == 0)
{
- RLOGD("curr_ssid is(from config) ---- %s ap_info ssid --->",tmp_ssid,ap->ap_ssid);
break;
}
}
@@ -3157,7 +3185,6 @@
for( index=0; index < count; index++ )
{
p = strstr(split_lines[index], "key_mgmt=");
- RLOGD("current p str ------- %s",p);
if(p != NULL)
{
p += 9;
@@ -3176,7 +3203,6 @@
}else{
curr_auth = 1;
}
- RLOGD("************curret_get_auth is %d ssid is %s",curr_auth,ap->ap_ssid);
if( curr_auth < 1 || curr_auth > 6)
{
ret = -1;
@@ -3224,7 +3250,6 @@
if (*password == '\"')
{
*password = '\0';
- RLOGD("---------password------- p:: %s",p);
ret = 0;
break;
}
@@ -3882,17 +3907,13 @@
int lynq_wifi_sta_stop(lynq_wifi_index_e idx)
{
-// char lynq_disable_network_cmd[MAX_CMD];
-// curr_status_info curr_state;
-// ap_info_s ap_info;
+ RLOGD("enter %s %d",__func__,__LINE__);
int i=0;
char state[MAX_CMD];
-// const char * lynq_disable_sta_cmd = "wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 disable_net all";
CHECK_IDX(idx, CTRL_STA);
CHECK_WPA_CTRL(CTRL_STA);
-// system(lynq_disable_sta_cmd);
DO_OK_FAIL_REQUEST(cmd_disconnect);
DO_OK_FAIL_REQUEST(cmd_save_config);
@@ -3920,6 +3941,7 @@
pthread_mutex_lock(&s_global_check_mutex);
g_history_disconnect_valid_num = 0; //clean history_disconenct_list info
pthread_mutex_unlock(&s_global_check_mutex);
+ RLOGD("end %s %d",__func__,__LINE__);
return 0;
// return system("connmanctl disable wifi");
}
@@ -4290,15 +4312,18 @@
}
int lynq_unreg_ap_event_callback(void * priv) {
+ RLOGD("enter %s %d",__func__,__LINE__);
pthread_mutex_lock(&s_ap_callback_mutex);
if (g_ap_callback_priv == priv)
{
g_ap_callback_func = NULL;
g_ap_callback_priv = NULL;
pthread_mutex_unlock(&s_ap_callback_mutex);
+ RLOGD("unreg ap callback pass %s %d",__func__,__LINE__);
return 0;
}
pthread_mutex_unlock(&s_ap_callback_mutex);
+ RLOGE("unreg ap callback fail %s %d",__func__,__LINE__);
return -1;
}
@@ -4331,15 +4356,18 @@
}
int lynq_unreg_sta_event_callback(void * priv) {
+ RLOGD("enter %s %d",__func__,__LINE__);
pthread_mutex_lock(&s_sta_callback_mutex);
if (g_sta_callback_priv == priv)
{
g_sta_callback_func = NULL;
g_sta_callback_priv = NULL;
pthread_mutex_unlock(&s_sta_callback_mutex);
+ RLOGD("unreg sta callback pass %s %d",__func__,__LINE__);
return 0;
}
pthread_mutex_unlock(&s_sta_callback_mutex);
+ RLOGE("unreg sta callback fail %s %d",__func__,__LINE__);
return -1;
}