What's new

wl1_country_code=US changed to Q2 after reboot

mike7

Occasional Visitor
Playing with wireless power settings on RT-N66U, I found, some nvram settings reverted after boot.
So if you set wl1_country_code=US, it will change to Q2.

Looks like ASUS set particular values in init-broadcom.c, starting line 1541:

Code:
...	else
{
if (nvram_match(strcat_r(prefix, "nband", tmp), "2"))	// 2.4G
{
if (nvram_match(strcat_r(prefix, "country_code", tmp), "US"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "39"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "39");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "39");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "EU"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "3"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "3");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "3");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "JP"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "13"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "13");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "13");
commit_needed++;
}
}
}
else	// 5G
{
if (nvram_match(strcat_r(prefix, "country_code", tmp), "US"))
{
nvram_set("regulation_domain_5G", "Q2");
nvram_set(strcat_r(prefix, "country_code", tmp), "Q2");
nvram_set(strcat_r(prefix2, "ccode", tmp2), "Q2");
nvram_set(strcat_r(prefix, "country_rev", tmp), "2");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "2");
commit_needed++;
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "Q2"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "2"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "2");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "2");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "EU"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "0"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "0");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "0");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "TW"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "0"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "0");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "0");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "CN"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "0"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "0");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "0");
commit_needed++;
}
}
else if (nvram_match(strcat_r(prefix, "country_code", tmp), "JP"))
{
if (!nvram_match(strcat_r(prefix2, "regrev", tmp2), "13"))
{
nvram_set(strcat_r(prefix, "country_rev", tmp), "13");
nvram_set(strcat_r(prefix2, "regrev", tmp2), "13");
commit_needed++;
}
}
}
}

as I understand actual power settings depend on regrev settings.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top