Qualcomm WiFi country code

Country Code information can be given to driver from:
1. DefaultCountryTablefield in WCNSS_qcom_wlan_nv.bin-read during driver initialization
2. gStaCountryCodeparameter in WCNSS_qcom_cfg.ini –read during driver initialization to replace default country code in WCNSS_qcom_wlan_nv.bin
3. Country IE from AP defined by 802.11d –information given by AP
4. “iwregset” command –set from userspaceapplication over cfg80211 interface
Private IOCTL with “COUNTRY” command –set from userspaceapplication over wextinterface

gCountryCodePriorityis a flag that can be defined in WCNSS_qcom_cfg.ini to decide the preferred priority of Country Code information between userspacecommands (either over cfg80211 interface or wextinterface) and 802.11d; the value can be
.1 –Country Code information from userspacecommands takes priority
Overall priority would be userspacecommands > 802.11d > gStaCountryCodein WCNSS_qcom_cfg.ini > DefaultCountryTablein WCNSS_qcom_wlan_nv.bin
This is the default setting
.0 –Country Code information from 802.11d takes priority
Overall priority would be 802.11d > userspacecommands > gStaCountryCodein WCNSS_qcom_cfg.ini > DefaultCountryTablein WCNSS_qcom_wlan_nv.bin
 

命令设置国家码

iw reg set CN
iw reg get     
iwpriv wlan0 getChannelList     
wpa_cli -i wlan0 driver COUNTRY CN 

 

WCN36X0 Country Code from DefaultCountryTable field in WCNSS_qcom_wlan_nv.bin
WCN39X0 or QC61x4 Country Code from Regulatory Domain field in BDF file(/firmware/image/bdwlan.bin)

 

相关property

ro.boot.wificountrycode

gsm.operator.iso-country

设置 

Settings.Global.getInt(mContext.getContentResolver(),
                 Settings.Global.WIFI_COUNTRY_CODE);

 

framework

WifiManager.setCountryCode()

 

driver

wlan_reg_set_country

   reg_set_country

frameworks/opt/telephony/src/java/com/android/internal/telephony/LocaleTracker.java

   private synchronized void updateLocale() {
376          // If MCC is available from network service state, use it first.
377          String mcc = null;
378          String countryIso = "";
379          if (!TextUtils.isEmpty(mOperatorNumeric)) {
380              try {
381                  mcc = mOperatorNumeric.substring(0, 3);
382                  countryIso = MccTable.countryCodeForMcc(mcc);
383              } catch (StringIndexOutOfBoundsException ex) {
384                  loge("updateLocale: Can't get country from operator numeric. mcc = "
385                          + mcc + ". ex=" + ex);
386              }
387          }
388  
389          // If for any reason we can't get country from operator numeric, try to get it from cell
390          // info.
391          if (TextUtils.isEmpty(countryIso)) {
392              mcc = getMccFromCellInfo();
393              countryIso = MccTable.countryCodeForMcc(mcc);
394          }
395  
396          log("updateLocale: mcc = " + mcc + ", country = " + countryIso);
397          boolean countryChanged = false;
398          if (!Objects.equals(countryIso, mCurrentCountryIso)) {
399              String msg = "updateLocale: Change the current country to \"" + countryIso
400                      + "\", mcc = " + mcc + ", mCellInfoList = " + mCellInfoList;
401              log(msg);
402              mLocalLog.log(msg);
403              mCurrentCountryIso = countryIso;
404  
405              TelephonyManager.setTelephonyProperty(mPhone.getPhoneId(),
406                      TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, mCurrentCountryIso);
407  
408              // Set the country code for wifi. This sets allowed wifi channels based on the
409              // country of the carrier we see. If we can't see any, reset to 0 so we don't
410              // broadcast on forbidden channels.
411              WifiManager wifiManager = (WifiManager) mPhone.getContext()
412                      .getSystemService(Context.WIFI_SERVICE);
413              if (wifiManager != null) {
414                  wifiManager.setCountryCode(countryIso);
415              } else {
416                  msg = "Wifi manager is not available.";
417                  log(msg);
418                  mLocalLog.log(msg);
419              }
420  
421  
422              Intent intent = new Intent(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED);
423              intent.putExtra(TelephonyManager.EXTRA_NETWORK_COUNTRY, countryIso);
424              SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
425              mPhone.getContext().sendBroadcast(intent);
426  
427              countryChanged = true;
428          }
429  

 

frameworks/opt/telephony/src/java/com/android/internal/telephony/Phone.java#581

        // The locale from the "ro.carrier" system property or R.array.carrier_properties.
569          // This will be overwritten by the Locale from the SIM language settings (EF-PL, EF-LI)
570          // if applicable.
571          final Locale carrierLocale = getLocaleFromCarrierProperties(mContext);
572          if (carrierLocale != null && !TextUtils.isEmpty(carrierLocale.getCountry())) {
573              final String country = carrierLocale.getCountry();
574              try {
575                  Settings.Global.getInt(mContext.getContentResolver(),
576                          Settings.Global.WIFI_COUNTRY_CODE);
577              } catch (Settings.SettingNotFoundException e) {
578                  // note this is not persisting
579                  WifiManager wM = (WifiManager)
580                          mContext.getSystemService(Context.WIFI_SERVICE);
581                  wM.setCountryCode(country);
582              }
583          }

 

有一篇不错的文章

https://blog.csdn.net/zhangdaxia2/article/details/90545175   高通Android7.1 WIFI国家码问题

### VS Code Qualcomm 插件安装与使用 对于希望利用VS Code进行基于Qualcomm平台开发或调试工作的开发者来说,找到并正确配置适合的扩展非常重要。虽然特定于Qualcomm硬件的支持可能不如其他一些更常见的架构那样广泛,但仍有一些方法和资源可以帮助实现这一目标。 #### 寻找适用于Qualcomm设备的VS Code插件 在Visual Studio Code市场中搜索针对Qualcom平台优化过的插件时,可以通过访问官方Marketplace网站或者直接通过IDE内的Extensions视图来完成此操作。输入关键词`qualcomm`以查看是否有任何专门为此制造商设计的附加组件可用[^1]。 一旦找到了合适的插件,按照常规流程点击“Install”按钮即可将其加入当前的工作环境中。值得注意的是,并不是所有情况下都会有现成的、完全匹配需求的解决方案;在这种情形下,则需考虑通用型工具或是探索如何自定义设置满足项目特殊要求的方法。 #### 配置开发环境 除了寻找专用插件外,建立一个良好的基础也是至关重要的一步。这通常涉及到安装必要的SDK和其他依赖项,比如GCC编译器等软件包。如果计划从事RISC-V架构上的编程活动,考虑到其向下兼容特性,优先选择64位版本可能会更加灵活[^3]。 另外,在某些场景下,即使没有专门为某个品牌定制化的支持选项存在,也可以借助诸如CMake这样的跨平台构建系统以及GDB远程调试功能来进行高效的应用程序创建与故障排查工作。 ```bash # 更新系统包列表并安装基本构建工具(Linux为例) sudo apt update && sudo apt install build-essential cmake gdb ``` #### 实际应用案例 假设正在参与一个涉及Snapdragon处理器系列的新产品线的研发过程,此时可以尝试查找有关该系列产品线的相关文档和技术论坛帖子作为指导材料。同时也要留意社区成员分享的经验教训——它们往往能够提供宝贵的第一手信息,帮助解决遇到的具体难题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值