kopia lustrzana https://github.com/espressif/esp-idf
esp_wifi: fix country policy issue
1. Fix not update phy according to country code. 2. Update regdomain max channel according to country info from nvs and or AP. 3. Change nvs default country from "CN" to "01". 4. Channel 14 is allowed only 11b mode. 5. Remove csa when switch channel from/to 14 channel. 6. Update phy mode nvs when softap channel from 14 to other. 7. Fix the bug that check whether channel parameter is valid. Docs: change default country from "CN" to "01"pull/9141/head
rodzic
b965264e68
commit
06fb6b2e32
|
@ -1242,7 +1242,7 @@ esp_err_t esp_wifi_connectionless_module_set_wake_interval(uint16_t wake_interva
|
|||
* "RO","SE","SI","SK","TW","US"
|
||||
*
|
||||
* @attention 7. When country code "01" (world safe mode) is set, SoftAP mode won't contain country IE.
|
||||
* @attention 8. The default country is "CN" and ieee80211d_enabled is TRUE.
|
||||
* @attention 8. The default country is "01" (world safe mode) and ieee80211d_enabled is TRUE.
|
||||
*
|
||||
* @param country the configured country ISO code
|
||||
* @param ieee80211d_enabled 802.11d is enabled or not
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 0d5920de9592ae63ecb40471e895931fee2b0a66
|
||||
Subproject commit dd7254fb02c05aaa4d0c5f6f805a6e28998f9ab5
|
|
@ -1210,7 +1210,7 @@ When to Use LR
|
|||
|
||||
The general conditions for using LR are:
|
||||
|
||||
- Both the AP and station are devices.
|
||||
- Both the AP and station are Espressif devices.
|
||||
- Long distance Wi-Fi connection and data transmission is required.
|
||||
- Data throughput requirements are very small, such as remote device control.
|
||||
|
||||
|
@ -1232,7 +1232,7 @@ Call :cpp:func:`esp_wifi_set_country()` to set the country info. The table below
|
|||
- an ASCII ‘O’ character, which means the regulations under which the station/AP is operating are for an outdoor environment only.
|
||||
- an ASCII ‘I’ character, which means the regulations under which the station/AP is operating are for an indoor environment only.
|
||||
- an ASCII ‘X’ character, which means the station/AP is operating under a noncountry entity. The first two octets of the noncountry entity is two ASCII ‘XX’ characters.
|
||||
- the binary representation of the Operating Class table number currently in use. Refer to Annex E of IEEE Std 802.11-2012.
|
||||
- the binary representation of the Operating Class table number currently in use. Refer to Annex E of IEEE Std 802.11-2020.
|
||||
|
||||
* - schan
|
||||
- Start channel. It is the minimum channel number of the regulations under which the station/AP can operate.
|
||||
|
@ -1242,7 +1242,33 @@ Call :cpp:func:`esp_wifi_set_country()` to set the country info. The table below
|
|||
- Country policy. This field controls which country info will be used if the configured country info is in conflict with the connected AP’s. For more details on related policies, see the following section.
|
||||
|
||||
|
||||
The default country info is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}. If the Wi-Fi mode is station/AP coexist mode, they share the same configured country info. Sometimes the country info of the AP to which the station is connected is different from the configured country info. For example, if the configured station has the country info of {.cc="JP", .schan=1, .nchan=14, policy=WIFI_COUNTRY_POLICY_AUTO}, but the connected AP has the country info of {.cc="CN", .schan=1, .nchan=13}, then the country info of the connected AP is used.
|
||||
The default country info is::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "01",
|
||||
.schan = 1,
|
||||
.nchan = 11,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
If the Wi-Fi Mode is station/AP coexist mode, they share the same configured country info. Sometimes, the country info of AP, to which the station is connected, is different from the country info of configured. For example, the configured station has country info::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "JP",
|
||||
.schan = 1,
|
||||
.nchan = 14,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
but the connected AP has country info::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
};
|
||||
|
||||
then country info of connected AP's is used.
|
||||
|
||||
The following table depicts which country info is used in different Wi-Fi modes and different country policies, and it also describes the impact on active scan.
|
||||
|
||||
|
@ -1261,17 +1287,27 @@ The following table depicts which country info is used in different Wi-Fi modes
|
|||
|
||||
- If schan+nchan-1 >11 :
|
||||
|
||||
Use active scan from schan to 11 and use passive scan from 12 to schan+nchan-1.
|
||||
Use active scan from schan to 11 and use passive scan from 12 to 14.
|
||||
|
||||
- If schan+nchan-1 <= 11 :
|
||||
|
||||
Use active scan from schan to schan+nchan-1.
|
||||
Use active scan from schan to schan+nchan-1 and use passive scan from schan+nchan to 14.
|
||||
|
||||
Always keep in mind that if an AP with hidden SSID and station is set to a passive scan channel, the passive scan will not find it. In other words, if the application hopes to find the AP with hidden SSID in every channel, the policy of country info should be configured to WIFI_COUNTRY_POLICY_MANUAL.
|
||||
|
||||
* - Station
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- Always use the configured country info. For scan, scans channel “schan” to “schan+nchan-1” with active scan.
|
||||
- Always use the configured country info.
|
||||
|
||||
For scan:
|
||||
|
||||
- If schan+nchan-1 >11 :
|
||||
|
||||
Use active scan from schan to 11 and use passive scan from 12 to schan+nchan-1.
|
||||
|
||||
- If schan+nchan-1 <= 11 :
|
||||
|
||||
Use active scan from schan to schan+nchan-1.
|
||||
* - AP
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- Always use the configured country info.
|
||||
|
|
|
@ -1210,7 +1210,7 @@ LR 吞吐量
|
|||
|
||||
通常使用 LR 的场景包括:
|
||||
|
||||
- AP 和 station 都是 {IDF_TARGET_NAME} 设备。
|
||||
- AP 和 station 都是乐鑫设备。
|
||||
- 需要长距离 Wi-Fi 连接和数据传输。
|
||||
- 数据吞吐量要求非常小,例如远程设备控制等。
|
||||
|
||||
|
@ -1232,26 +1232,52 @@ Wi-Fi 国家/地区代码
|
|||
- ASCII 码 ‘O’ 字符,代表 station/AP 所处国家/地区的规定仅允许室外环境。
|
||||
- ASCII 码 ‘I’ 字符,代表 station/AP 所处国家/地区的规定仅允许室内环境。
|
||||
- ASCII 码 ‘X’ 字符,代表 station/AP 位于非国家/地区实体。非国家实体的前两个八位字节是两个 ASCII 码 ‘XX’ 字符。
|
||||
- 当前使用的操作类表编号的二进制形式。见 IEEE Std 802.11-2012 附件 E。
|
||||
- 当前使用的操作类表编号的二进制形式。见 IEEE Std 802.11-2020 附件 E。
|
||||
|
||||
* - schan
|
||||
- 起始信道,station/AP 所处国家/地区规定的最小信道数。
|
||||
- 起始信道,station/AP 所处国家/地区规定的最小信道值。
|
||||
* - nchan
|
||||
- 规定的总信道数,比如,如果 schan=1,nchan=13,那么 station/AP 可以从信道 1 至 13 发送数据。
|
||||
* - policy
|
||||
- 国家/地区政策,当配置的国家/地区信息与所连 AP 的国家/地区信息冲突时,该字段决定使用哪一信息。更多政策相关信息,可参见下文。
|
||||
- 国家/地区策略,当配置的国家/地区信息与所连 AP 的国家/地区信息冲突时,该字段决定使用哪一信息。更多策略相关信息,可参见下文。
|
||||
|
||||
|
||||
默认国家/地区信息为 {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO},如果 Wi-Fi 模式为 station/AP 共存模式,则它们配置的国家/地区信息相同。有时,station 所连 AP 的国家/地区信息与配置的不同。例如,配置的 station 国家/地区信息为 {.cc="JP", .schan=1, .nchan=14, policy=WIFI_COUNTRY_POLICY_AUTO},但所连 AP 的国家/地区信息为 {.cc="CN", .schan=1, .nchan=13},此时,使用所连 AP 的国家/地区信息。
|
||||
默认国家/地区信息为::
|
||||
|
||||
下表描述了在不同 Wi-Fi 模式和不同国家/地区政策下使用的国家/地区信息,并描述了对主动扫描的影响。
|
||||
wifi_country_t config = {
|
||||
.cc = "01",
|
||||
.schan = 1,
|
||||
.nchan = 11,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
如果 Wi-Fi 模式为 station/AP 共存模式,则它们配置的国家/地区信息相同。有时,station 所连 AP 的国家/地区信息与配置的不同。例如,配置的 station 国家/地区信息为::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "JP",
|
||||
.schan = 1,
|
||||
.nchan = 14,
|
||||
.policy = WIFI_COUNTRY_POLICY_AUTO,
|
||||
};
|
||||
|
||||
但所连 AP 的国家/地区信息为::
|
||||
|
||||
wifi_country_t config = {
|
||||
.cc = "CN",
|
||||
.schan = 1,
|
||||
.nchan = 13,
|
||||
};
|
||||
|
||||
此时,使用所连 AP 的国家/地区信息。
|
||||
|
||||
下表描述了在不同 Wi-Fi 模式和不同国家/地区策略下使用的国家/地区信息,并描述了对主动扫描的影响。
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: 15 15 35
|
||||
|
||||
* - Wi-Fi 模式
|
||||
- 政策
|
||||
- 策略
|
||||
- 描述
|
||||
* - station 模式
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
|
@ -1259,6 +1285,22 @@ Wi-Fi 国家/地区代码
|
|||
|
||||
扫描时:
|
||||
|
||||
- 如果 schan+nchan-1>11:
|
||||
|
||||
主动扫描起始信道至信道 11,被动扫描信道 12 至 信道 14。
|
||||
|
||||
- 如果 schan+nchan-1<=11:
|
||||
|
||||
主动扫描起始信道至信道 schan+nchan-1,被动扫描信道 schan+nchan 至 信道 14。
|
||||
|
||||
请记住,如果带有隐藏 SSID 的 AP 和 station 被设置在被动扫描信道上,被动扫描将无法找到该 AP。也就是说,如果应用程序希望在每个信道中找到带有隐藏 SSID 的 AP,国家/地区信息应该配置为 WIFI_COUNTRY_POLICY_MANUAL。
|
||||
|
||||
* - station 模式
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- 总是使用配置的国家/地区信息。
|
||||
|
||||
扫描时:
|
||||
|
||||
- 如果 schan+nchan-1>11:
|
||||
|
||||
主动扫描起始信道至信道 11,被动扫描信道 12 至 信道 schan+nchan-1。
|
||||
|
@ -1266,12 +1308,6 @@ Wi-Fi 国家/地区代码
|
|||
- 如果 schan+nchan-1<=11:
|
||||
|
||||
主动扫描起始信道至信道 schan+nchan-1。
|
||||
|
||||
请记住,如果 AP 带有隐藏 SSID 且 station 被设置为被动扫描信道,被动扫描将无法找到该 AP。也就是说,如果应用程序希望在每个信道中找到带有隐藏 SSID 的 AP,国家/地区信息应该配置为 WIFI_COUNTRY_POLICY_MANUAL。
|
||||
|
||||
* - station 模式
|
||||
- WIFI_COUNTRY_POLICY_MANUAL
|
||||
- 总是使用配置的国家/地区信息。 扫描时,主动扫描起始信道至信道 schan+nchan-1。
|
||||
* - AP 模式
|
||||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- 总是使用配置的国家/地区信息。
|
||||
|
@ -1282,7 +1318,7 @@ Wi-Fi 国家/地区代码
|
|||
- WIFI_COUNTRY_POLICY_AUTO
|
||||
- 如果 station 不连接任何外部 AP,AP 使用配置的国家/地区信息。如果 station 连接一个外部 AP,该 AP 的国家/地区信息与该 station 相同。
|
||||
|
||||
与 station 模式、WIFI_COUNTRY_POLICY_AUTO 政策下使用的国家/地区信息相同。
|
||||
与 station 模式、WIFI_COUNTRY_POLICY_AUTO 策略下使用的国家/地区信息相同。
|
||||
|
||||
|
||||
主信道
|
||||
|
|
Ładowanie…
Reference in New Issue