cm42
Posts: 3
Joined: Sat Apr 23, 2016 11:45 am

Problems with setting wifi country

Thu May 05, 2016 10:31 pm

I am using Raspbian Jessie (latest image: 2016-03-18) on a Raspberry Pi 3.
Using the graphical configuration application Raspberry Pi Configuration I set the "WIFI Country" to "DE Germany". After rebooting iw reg get showed as expected the following text:

Code: Select all

country DE: DFS-ETSI
	(2400 - 2483 @ 40), (N/A, 20), (N/A)
	(5150 - 5250 @ 80), (N/A, 20), (N/A), NO-OUTDOOR
	(5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
	(5470 - 5725 @ 160), (N/A, 26), (0 ms), DFS
	(57000 - 66000 @ 2160), (N/A, 40), (N/A)
This graphical user interface calls raspi-config to adjust the country.
raspi-config does this by changing the configuration file of wpa_supplicant (

Code: Select all

/etc/wpa_supplicant/wpa_supplicant.conf
.

For more information see https://github.com/raspberrypi/rc_gui/b ... c/rc_gui.c and https://github.com/RPi-Distro/raspi-con ... spi-config.

But after changing it for this for the first time, I am not able to change the country anymore. I tried to change it to "IT" (Italy) and "US" (United States). (I only change this for test purposes and only for short durations. I know, that I have to comply with the local regulations.) It did not succeed. The raspi configuration application adjusted the configuration of wpa_supplicant, but even after a reboot the output of iw reg get did not change.

I tried also the following methods to set the wifi country:
  • setting the country in

    Code: Select all

    /etc/default/crda
  • iw reg set <country code>
Even using these methods together with the graphical configuration tool did not help.
Using iw reg set <country code> changed the output of iw reg get to:

Code: Select all

country 98: DFS-UNSET
	(2402 - 2472 @ 40), (N/A, 20), (N/A)
	(5170 - 5250 @ 80), (N/A, 17), (N/A), NO-OUTDOOR
	(5250 - 5330 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS
	(57240 - 63720 @ 2160), (N/A, 40), (N/A)
But after a reboot I got the old well known output.

Is there something wrong?
Do I missunterstand how setting the wifi country works?

Many thanks in advance.

cm42
Posts: 3
Joined: Sat Apr 23, 2016 11:45 am

Re: Problems with setting wifi country

Sat May 07, 2016 3:01 pm

Meanwhile I found out, why I was not able to change the regulatory domain. As described in https://wireless.wiki.kernel.org/en/dev ... sing_rules (subsection Country IE processing) the kernel module cfg80211 is able to get regulatory information by an acess point, if it is associated with it. In my case linux was getting this information and thus did not allow me to change the regulatory domain.

After disconnecting from my wifi network, I was able to change the regualtory domain.
In the following a (not complete) list of possibilities to adjust the regualtory domain:
  • adjust /etc/default/crda
  • add or change line COUNTRY=<country code> in /etc/wpa_supplicant/wpa_supplicant.conf (This is what the Raspberry Pi configuration application does.)
  • for non-persistent changes you can use iw reg set <country code>
  • the cfg80211 kernel module has also an option for setting the regulatory domain


Short summary: If you connect your Raspberry Pi (or Linux PC) with an wifi network, perhaps it gets the regulatory domain information from the access point.

In order to check the current regulatory domain you can use iw reg get.
If you run iw phy, you get a list of enabled and disabled frequency bands together with transmission power for each of the attached wifi devices. Thus the output of this command depends on your device and the set regulatory domain.

Return to “Troubleshooting”