使用者工具

網站工具


os:linux:ath10k_整理

修改預設 country code

- The EEPROM setting in the card is 0 (“CTRY_DEFAULT”) for both country and region code, which should allow any other country to be set in software

- The Linux ath10k driver however will do this:

  if (reg->country_code == CTRY_DEFAULT &&
      regdmn == CTRY_DEFAULT) {
      printk(KERN_DEBUG "ath: EEPROM indicates default "
             "country code should be used\n");
      reg->country_code = CTRY_UNITED_STATES;
  }

So if they're both 0, it just sets the country code to “US” which results in channels 12+13 becoming unusuable to us. So the hardware is not set to US, but the settings as they are cause the driver to make that setting.

There is a function that changes the region code if there are unknown flags present. I modified this function to set the region code to 0x67 if both country code and region code are 0, that fixes the problem for us:

  static void ath_regd_sanitize(struct ath_regulatory *reg)
  {
    if (reg->current_rd != COUNTRY_ERD_FLAG && (reg->current_rd != 0 && reg->country_code == 0))
          return;
      printk(KERN_DEBUG "ath: EEPROM regdomain sanitized\n");
      reg->current_rd = 0x67; 
  }

Region code 0x67 allows channels 1-13 and all 5 GHz channels except 144 and 173. From there, one can further reduce the allowed channels by setting a country code as you described or by including it in the wpa_supplicant configuration file.

Both these above code snippets are from drivers/net/wireless/ath/regd.c

os/linux/ath10k_整理.txt · 上一次變更: 2019/06/10 01:44 由 eddie