导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页

    【FAQ】全志R329如何解决RTL驱动hostap启动失败的问题?

    其它全志芯片讨论区
    r329 r328 r818 faq 技术支持
    1
    1
    1689
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • q1215200171
      budbool LV 9 最后由 编辑

      问题背景

      硬件:R328系列公板+ Wi-Fi模组(RTL8723ds)
      软件:Tina3.0及以上

      问题简述

      执行hostapd报错提示:wlan0: IEEE 802.11 Configured channel (13) not found from the channel list of current mode (1) IEEE 802.11g
      操作log:
      
      Configuration file: /etc/wifi/hostapd.conf
      wlan0: IEEE 802.11 Configured channel (13) not found from the channel list of current mode (1) IEEE 802.11g
      wlan0: IEEE 802.11 Hardware does not support configured channel
      Could not select hw_mode and channel. (-3)
      wlan0: interface state UNINITIALIZED->DISABLED
      wlan0: AP-DISABLED 
      wlan0: Unable to setup interface.
      wlan0: interface state DISABLED->DISABLED
      wlan0: AP-DISABLED 
      hostapd_free_hapd_data: Interface wlan0 wasn't started
      nl80211: deinit ifname=wlan0 disabled_11b_rates=0
      

      问题分析

      hostapd启动失败,第一反应是配置文件配的不对,从hostapd的启动日志或许能看出点猫腻。从log看很明显,不支持channel 13。

      1.第一反应是网卡国家码不对

      iw reg get查看国家码是US,确实不支持13信道。重新配置网卡国家码为CN:iw reg set CN,配置失败,设置后会重新变回US,看来网卡驱动的配置是以环境的AP来配置国家码的。

      重新设置网卡的WCNSS_qcom_cfg.ini文件以支持手动配置国家码,并强制关闭环境AP的配置:

      gStaCountryCode=CN    //默认sta的国家码为CN
      gAPCntryCode=CN       //默认AP的国家码为CN
      g11dSupportEnabled=0  //关闭国家码从环境获取
      

      好了,国家码能正常设置了,但是启动hostapd还是直接退出了,报错还是不支持13信道。

      2.没办法,就去看了一下hostapd报错的位置的代码

      static int hostapd_is_usable_chans(struct hostapd_iface *iface)
      {
             if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1)) 
                    return 0;
      
             if (!iface->conf->secondary_channel)
                    return 1;
      
             return hostapd_is_usable_chan(iface, iface->conf->channel +
                                        iface->conf->secondary_channel * 4, 0); 
      }
      

      原来,配置文件中指定的启动HT40[即信道带宽是40MHz]时,要求辅信道也必须在支持的信道内。HT40+是指辅信道是主信道+4,17信道是不支持的,因此配置失败了。

      同样,5G信道也有一些配置是不允许的,于是使用RTL8821cs测试

      5G时设置hostapd失败打印:

      I/hostapd (  661): wlan0: interface state UNINITIALIZED->HT_SCAN
      E/hostapd (  661): HT40 channel pair (153, 1) not allowed
      I/hostapd (  661): Fallback to 20 MHz
      E/hostapd (  661): Interface initialization failed
      I/hostapd (  661): wlan0: interface state HT_SCAN->DISABLED
      I/hostapd (  661): wlan0: AP-DISABLED 
      E/hostapd (  661): hostapd_free_hapd_data: Interface wlan0 wasn't started
      

      而代码中指定要求5G时hostapd的信道只能有以下几个:

      int allowed[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 140,
                        149, 157, 184, 192 };
      

      解决办法

      修改驱动配置即可:

      drivers/net/wireless/rtl8723ds/Makefile
      CONFIG_RTW_CHPLAN=0x23
      
      1 条回复 最后回复 回复 引用 分享 0
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • Referenced by  q1215200171 q1215200171 
      • 1 / 1
      • First post
        Last post

      Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

      行为准则 | 用户协议 | 隐私权政策