diff --git a/src/logan_wifi/wifi_hal.c b/src/logan_wifi/wifi_hal.c
index f84c67c..aa6f2da 100644
--- a/src/logan_wifi/wifi_hal.c
+++ b/src/logan_wifi/wifi_hal.c
@@ -2689,6 +2689,98 @@
 	}
 }
 
+static void wifi_guard_interval_file_check()
+{
+	char ret_buf[MAX_BUF_SIZE] = {0};
+	int res;
+	unsigned char i = 0;
+	char file[MAX_SUB_CMD_SIZE] = {0};
+	FILE *f = NULL;
+	INT radio_num = 0;
+
+	wifi_getMaxRadioNumber(&radio_num);
+	for (i = 0; i < radio_num; i++) {
+		res = snprintf(file, sizeof(file), "%s%d.txt", GUARD_INTERVAL_FILE, i);
+		if (os_snprintf_error(sizeof(file), res)) {
+			wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
+		}
+		wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+		if (access(file, F_OK) != 0) {
+			res =  _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
+			if (res) {
+				wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
+			}
+		}
+		f = fopen(file, "w");
+		if (f == NULL)
+			return;
+		fprintf(f, "%s", "auto");
+		if (fclose(f) == EOF)
+			wifi_debug(DEBUG_ERROR, "Unexpected fclose fail\n");
+	}
+}
+
+static void wifi_power_percentage_file_check()
+{
+	char ret_buf[MAX_BUF_SIZE] = {0};
+	int res;
+	unsigned char band = 0;
+	char file[MAX_SUB_CMD_SIZE] = {0};
+	FILE *f = NULL;
+
+	for (band = band_2_4; band <= band_6; band++) {
+		res = snprintf(file, sizeof(file), "%s%d.txt", POWER_PERCENTAGE, band);
+		if (os_snprintf_error(sizeof(file), res)) {
+			wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
+		}
+		wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+		if (access(file, F_OK) != 0) {
+			res =  _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
+			if (res) {
+				wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
+			}
+		}
+		f = fopen(file, "w");
+		if (f == NULL)
+			return;
+		fprintf(f, "%s", "100");
+		if (fclose(f) == EOF)
+			wifi_debug(DEBUG_ERROR, "Unexpected fclose fail\n");
+	}
+}
+
+static void wifi_mcs_file_check()
+{
+	char ret_buf[MAX_BUF_SIZE] = {0};
+	int res;
+	unsigned char i = 0;
+	char file[MAX_SUB_CMD_SIZE] = {0};
+	FILE *f = NULL;
+	INT radio_num = 0;
+
+	wifi_getMaxRadioNumber(&radio_num);
+	for (i = 0; i < radio_num; i++) {
+		res = snprintf(file, sizeof(file), "%s%d.txt", MCS_FILE, i);
+		if (os_snprintf_error(sizeof(file), res)) {
+			wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
+		}
+		wifi_debug(DEBUG_ERROR, "%s:file %s", __func__, file);
+		if (access(file, F_OK) != 0) {
+			res =  _syscmd_secure(ret_buf, sizeof(ret_buf), "touch %s", file);
+			if (res) {
+				wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
+			}
+		}
+		f = fopen(file, "w");
+		if (f == NULL)
+			return;
+		fprintf(f, "%s", "11");
+		if (fclose(f) == EOF)
+			wifi_debug(DEBUG_ERROR, "Unexpected fclose fail\n");
+	}
+}
+
+
 // Initializes the wifi subsystem (all radios)
 INT wifi_init()							//RDKB
 {
@@ -2710,6 +2802,9 @@
 		eht_mld_config_init();
 		CallOnce = 0;
 		mld_info_display();
+		wifi_guard_interval_file_check();
+		wifi_power_percentage_file_check();
+		wifi_mcs_file_check();
 	}
 
 	WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
@@ -6305,7 +6400,7 @@
 
 	if (wifi_GetInterfaceName(radioIndex, interface_name) != RETURN_OK)
 		return RETURN_ERR;
-	res = snprintf(pwr_file, sizeof(pwr_file), "%s%d.txt", POWER_PERCENTAGE, radioIndex);
+	res = snprintf(pwr_file, sizeof(pwr_file), "%s%d.txt", POWER_PERCENTAGE, radio_index_to_band(radioIndex));
 	if (os_snprintf_error(sizeof(pwr_file), res)) {
 		wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
 		return RETURN_ERR;
@@ -6400,7 +6495,7 @@
 	mtk_nl80211_deint(&unl_ins);
 	wifi_debug(DEBUG_NOTICE, "set cmd success.\n");
 
-	res = snprintf(pwr_file, sizeof(pwr_file), "%s%d.txt", POWER_PERCENTAGE, radioIndex);
+	res = snprintf(pwr_file, sizeof(pwr_file), "%s%d.txt", POWER_PERCENTAGE, radio_index_to_band(radioIndex));
 	if (os_snprintf_error(sizeof(pwr_file), res)) {
 		wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
 		return RETURN_ERR;
@@ -8162,10 +8257,8 @@
 	char config_file[64] = {'\0'};
 
 	char buf[512] = {'\0'};
-	char stbc_config[16] = {'\0'};
 	wifi_band band;
 	int iterator = 0;
-	BOOL current_stbc = FALSE;
 	int ant_count = 0;
 	int ant_bitmap = 0;
 	struct params list;
@@ -8199,29 +8292,11 @@
 		wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
 		return RETURN_ERR;
 	}
-
 	// set ht and vht config
 	for (int i = 0; i < iterator; i++) {
-		memset(stbc_config, 0, sizeof(stbc_config));
 
 		memset(buf, 0, sizeof(buf));
 		list.name = (i == 0)?"ht_capab":"vht_capab";
-		res = snprintf(stbc_config, sizeof(stbc_config), "%s", list.name);
-		if (os_snprintf_error(sizeof(stbc_config), res)) {
-			wifi_debug(DEBUG_ERROR, "Unexpected snprintf fail\n");
-			return RETURN_ERR;
-		}
-
-		res = _syscmd_secure(buf, sizeof(buf), "cat %s | grep -E '^%s' | grep 'STBC'", config_file, stbc_config);
-		if (res) {
-			wifi_debug(DEBUG_ERROR, "_syscmd_secure fail\n");
-		}
-
-		if (strlen(buf) != 0)
-			current_stbc = TRUE;
-		if (current_stbc == STBC_Enable)
-			continue;
-
 		if (STBC_Enable == TRUE) {
 			// Append the STBC flags in capab config
 
