Revert "[BugFix][API-810][wifi]fix wifi can't change country code"
This reverts commit 11e16d86ab49f12fce6caaef079a64150b0b9d28.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I84ffaa5738f27ed4be7d028b605acce482c87122
diff --git a/lib/liblynq-wifi6/libwifi6.c b/lib/liblynq-wifi6/libwifi6.c
index e529fd5..4a3c6c9 100755
--- a/lib/liblynq-wifi6/libwifi6.c
+++ b/lib/liblynq-wifi6/libwifi6.c
@@ -3472,78 +3472,28 @@
return 0;
}
-static int check_and_init_uci_config(char * country_code)
-{
- FILE * fp;
- int is_different = 0;
- const char * creat_uci_cmd ="uci set lynq_uci.lynq_wifi_country_code='lynq_wifi_country_code'";
- const char * commit_cmd ="uci commit";
- char set_country_cmd[MAX_CMD];
- char lynq_cmd_ret[MAX_CMD]={0};
-
- if((fp=popen("uci get lynq_uci.lynq_wifi_country_code.code","r"))==NULL)
- {
- RLOGE("popen error!,create now");
-
- system(creat_uci_cmd);
- sprintf(set_country_cmd, "uci set lynq_uci.lynq_wifi_country_code.code='%s'",country_code);
- system(set_country_cmd);
- system(commit_cmd);
- is_different = 1;
-
- if((fp=popen("uci get lynq_uci.lynq_wifi_country_code.code","r"))==NULL)
- {
- return -1;
- }
- }
-
- if((fread(lynq_cmd_ret,sizeof(lynq_cmd_ret),1,fp))<0 )
- {
- RLOGE("fread fail!");
- fclose(fp);
- return -1;
- }
-
- if ( strncmp(lynq_cmd_ret,country_code,2) != 0 )
- {
- RLOGE("get country code for uci %s,input cpuntry code is:%s\n",lynq_cmd_ret,country_code);
- is_different = 1;
- }
-
- fclose(fp);
- return is_different;
-
-}
-
int lynq_set_country_code(lynq_wifi_index_e idx, char * country_code) {
- char check_current_code[10];
- int ret,is_different;
+// const char * cmd_str = "GET country";
+// CHECK_IDX(idx, CTRL_AP);
+// CHECK_WPA_CTRL(CTRL_STA);
+
+// DO_REQUEST(cmd_str);
+// printf("result %s\n", cmd_reply);
if (country_code == NULL || *country_code == '\0')
{
- RLOGE("bad country code\n");
+ RLOGD("bad country code\n");
return -1;
}
- is_different = check_and_init_uci_config(country_code);
- if( is_different < 0 )
+ char lynq_country_cmd[MAX_CMD];
+ sprintf(lynq_country_cmd, "wl country %s", country_code);
+ if (system(lynq_country_cmd) == 0)
{
- RLOGE("init set uci fail\n");
- return -1;
+ return 0;
}
- ret = lynq_get_country_code(idx,check_current_code);
- if( ret == 0 && (is_different == 1 || strcmp(check_current_code, country_code) != 0))
- {
- ret = lynq_wifi_disable();
- if(ret != 0 )
- {
- RLOGE("berfore set country,find bcmdhd insmod,remod fail\n");
- return -1;
- }
- }
-
- return 0;
+ return -1;
}
int lynq_get_connect_ap_mac(lynq_wifi_index_e idx,char *mac)