https://blog.csdn.net/subfate/article/details/51882322
这篇文章讲述的是在ubuntu14.04系统上使用WIFI功能5GHz频率的问题,问题本身不大,但基于笔者经验和认知,还是走了些弯路,这里记录一下解决过程,写点东西,留点回忆。
遇到问题
对于WIFI热点的创建,除了从未知到入门这一大坎外,其它的路途还是很顺利的。上峰要求的WIFI是5GHz,但作为技术要求,我必须要考虑2.4GHz和5GHz。首先在一台Ubuntu14.04系统上测试5GHz频率热点,一切正常。但换到另一台裁剪过的Ubuntu14.04上就有问题(正常的ubuntu体积比较大,而这台裁剪过的系统只有500MB)。
问题是,使用iw list查看,所有的5GHz的信道都不能使用,信息如下:
root@latelee:~# iw list
Wiphy phy0
Band 2:
Capabilities: 0x19e3
RX LDPC
HT20/HT40
Static SM Power Save
RX HT20 SGI
RX HT40 SGI
TX STBC
RX STBC 1-stream
Max AMSDU length: 7935 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 8 usec (0x06)
HT TX/RX MCS rate indexes supported: 0-15
Frequencies:
* 5180 MHz [36] (30.0 dBm) (passive scanning, no IBSS)
* 5200 MHz [40] (30.0 dBm) (passive scanning, no IBSS)
* 5220 MHz [44] (30.0 dBm) (passive scanning, no IBSS)
* 5240 MHz [48] (30.0 dBm) (passive scanning, no IBSS)
* 5260 MHz [52] (30.0 dBm) (passive scanning, no IBSS, radar detection)
* 5280 MHz [56] (30.0 dBm) (passive scanning, no IBSS, radar detection)
* 5300 MHz [60] (30.0 dBm) (passive scanning, no IBSS, radar detection)
* 5320 MHz [64] (30.0 dBm) (passive scanning, no IBSS, radar detection)
* 5500 MHz [100] (disabled)
* 5520 MHz [104] (disabled)
* 5540 MHz [108] (disabled)
* 5560 MHz [112] (disabled)
* 5580 MHz [116] (disabled)
* 5600 MHz [120] (disabled)
* 5620 MHz [124] (disabled)
* 5640 MHz [128] (disabled)
* 5660 MHz [132] (disabled)
* 5680 MHz [136] (disabled)
* 5700 MHz [140] (disabled)
* 5745 MHz [149] (30.0 dBm) (passive scanning, no IBSS)
* 5765 MHz [153] (30.0 dBm) (passive scanning, no IBSS)
* 5785 MHz [157] (30.0 dBm) (passive scanning, no IBSS)
* 5805 MHz [161] (30.0 dBm) (passive scanning, no IBSS)
* 5825 MHz [165] (30.0 dBm) (passive scanning, no IBSS)
从网上查到的信息,当信道后面有disabled或passive scanning字样时,这个信道是无法正常使用(于AP模式)的。从启动信息也可以看到有些信道是被禁止的,如下:
[ 10.921565] ath10k: qca988x hw2.0 (0x4100016c, 0x043222ff) fw 10.1.467.1-1 api 2 htt 2.1
[ 10.921572] ath10k: debug 0 debugfs 0 tracing 0 dfs 0
[ 11.414145] ath: EEPROM regdomain: 0x0
[ 11.414151] ath: EEPROM indicates default country code should be used
[ 11.414154] ath: doing EEPROM country->regdmn map search
[ 11.414157] ath: country maps to regdmn code: 0x3a
[ 11.414159] ath: Country alpha2 being used: US
[ 11.414162] ath: Regpair used: 0x3a
[ 11.414225] cfg80211: Updating information on frequency 2412 MHz with regulatory rule:
[ 11.414229] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414233] cfg80211: Updating information on frequency 2417 MHz with regulatory rule:
[ 11.414236] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414240] cfg80211: Updating information on frequency 2422 MHz with regulatory rule:
[ 11.414243] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414246] cfg80211: Updating information on frequency 2427 MHz with regulatory rule:
[ 11.414249] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414252] cfg80211: Updating information on frequency 2432 MHz with regulatory rule:
[ 11.414256] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414259] cfg80211: Updating information on frequency 2437 MHz with regulatory rule:
[ 11.414262] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414265] cfg80211: Updating information on frequency 2442 MHz with regulatory rule:
[ 11.414269] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414272] cfg80211: Updating information on frequency 2447 MHz with regulatory rule:
[ 11.414275] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414278] cfg80211: Updating information on frequency 2452 MHz with regulatory rule:
[ 11.414282] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414285] cfg80211: Updating information on frequency 2457 MHz with regulatory rule:
[ 11.414288] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414291] cfg80211: Updating information on frequency 2462 MHz with regulatory rule:
[ 11.414294] cfg80211: 2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414298] cfg80211: Updating information on frequency 2467 MHz with regulatory rule:
[ 11.414301] cfg80211: 2457000 KHz - 2482000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414304] cfg80211: Updating information on frequency 2472 MHz with regulatory rule:
[ 11.414307] cfg80211: 2457000 KHz - 2482000 KHz @ 40000 KHz), (600 mBi, 2000 mBm)
[ 11.414311] cfg80211: Updating information on frequency 2484 MHz with regulatory rule:
[ 11.414314] cfg80211: 2474000 KHz - 2494000 KHz @ 20000 KHz), (600 mBi, 2000 mBm)
[ 11.414317] cfg80211: Updating information on frequency 5180 MHz with regulatory rule:
[ 11.414321] cfg80211: 5170000 KHz - 5250000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414324] cfg80211: Updating information on frequency 5200 MHz with regulatory rule:
[ 11.414327] cfg80211: 5170000 KHz - 5250000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414331] cfg80211: Updating information on frequency 5220 MHz with regulatory rule:
[ 11.414334] cfg80211: 5170000 KHz - 5250000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414337] cfg80211: Updating information on frequency 5240 MHz with regulatory rule:
[ 11.414340] cfg80211: 5170000 KHz - 5250000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414344] cfg80211: Updating information on frequency 5260 MHz with regulatory rule:
[ 11.414347] cfg80211: 5250000 KHz - 5330000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414350] cfg80211: Updating information on frequency 5280 MHz with regulatory rule:
[ 11.414354] cfg80211: 5250000 KHz - 5330000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414357] cfg80211: Updating information on frequency 5300 MHz with regulatory rule:
[ 11.414360] cfg80211: 5250000 KHz - 5330000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414363] cfg80211: Updating information on frequency 5320 MHz with regulatory rule:
[ 11.414367] cfg80211: 5250000 KHz - 5330000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414370] cfg80211: Updating information on frequency 5500 MHz with regulatory rule:
[ 11.414373] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414376] cfg80211: Updating information on frequency 5520 MHz with regulatory rule:
[ 11.414380] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414383] cfg80211: Updating information on frequency 5540 MHz with regulatory rule:
[ 11.414386] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414389] cfg80211: Updating information on frequency 5560 MHz with regulatory rule:
[ 11.414393] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414396] cfg80211: Updating information on frequency 5580 MHz with regulatory rule:
[ 11.414399] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414403] cfg80211: Updating information on frequency 5600 MHz with regulatory rule:
[ 11.414406] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414409] cfg80211: Updating information on frequency 5620 MHz with regulatory rule:
[ 11.414412] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414416] cfg80211: Updating information on frequency 5640 MHz with regulatory rule:
[ 11.414419] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414422] cfg80211: Updating information on frequency 5660 MHz with regulatory rule:
[ 11.414426] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414429] cfg80211: Updating information on frequency 5680 MHz with regulatory rule:
[ 11.414432] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414435] cfg80211: Updating information on frequency 5700 MHz with regulatory rule:
[ 11.414439] cfg80211: 5490000 KHz - 5730000 KHz @ 160000 KHz), (600 mBi, 2000 mBm)
[ 11.414441] cfg80211: Disabling freq 5745 MHz
[ 11.414444] cfg80211: Disabling freq 5765 MHz
[ 11.414446] cfg80211: Disabling freq 5785 MHz
[ 11.414449] cfg80211: Disabling freq 5805 MHz
[ 11.414451] cfg80211: Disabling freq 5825 MHz
[ 11.415005] cfg80211: Calling CRDA to update world regulatory domain
尝试解决
从网上找到一篇文章,问题和我遇到的很类似,难得的是,作者用的网卡驱动和我的一模一样。于是参考其中的做法,将linux驱动的regd.c文件源码进行修改。然而还是不成功。看到问题不是驱动方面。
接着check一下网卡驱动、固件这些文件是否OK。对应的驱动信息如下:
root@latelee:~# modinfo ath10k_pci
filename: /lib/modules/3.17.1+/kernel/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
firmware: ath10k/QCA988X/hw2.0/board.bin
firmware: ath10k/QCA988X/hw2.0/firmware-2.bin
license: Dual BSD/GPL
description: Driver support for Atheros QCA988X PCIe devices
author: Qualcomm Atheros
depends: ath10k_core
intree: Y
vermagic: 3.17.1+ SMP mod_unload modversions 686
parm: target_ps:Enable ath10k Target (SoC) PS option (uint)
parm: irq_mode:0: auto, 1: legacy, 2: msi (default: 0) (uint)
parm: reset_mode:0: auto, 1: warm only (default: 0) (uint)
驱动找到了,固件也有了,都是已经具备并且都正常的。
解决
继续看linux无线wiki关于CRDA的资料,找到如下关键的段落:
We use userspace events (uevents) to let the kernel speak to userspace. Below is an example udev rule you can place into your distribution's udev rules directory (usually /etc/udev/rules.d/). Note that most distributions have udev configured with inotify on the udev rules directory, so there is no need to restart udev after adding the new rule.
# Example file, should be put in /etc/udev/rules.d/regulatory.rules
KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda"
其实我已经看过,之所以没有留意这个,是因为我看过/etc/udev/rules.d/这个目录是不存在的。但我却不知道,它已经变成/lib/udev/rules.d/目录了。于是在原装的Ubuntu系统中找到带“regulatory.rules”字样的文件,放到裁剪过的系统对应目录,问题终于解决了。
总结
为了使用WIFI的5GHz频率,有很多事是要注意的:
1、无线网卡是否支持5GHz。
2、需要CRDA可执行文件:/sbin/crda
3、需要CRDA目录:/lib/crda/
4、udev文件:/lib/udev/rules.d/85-regulatory.rules
最后再提一下,如果要自己移植,最好的方法是使用一台原装的系统进行测试,这样至于有一个正确的环境做对比,以减少弯路。
参考资料:
关于CRDA的Linux官方介绍:https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA
《HOSTAPD+ATH10K+802.11AC AP的实现方法》:
---------------------
作者:李迟
来源:CSDN
原文:https://blog.csdn.net/subfate/article/details/51882322
版权声明:本文为博主原创文章,转载请附上博文链接!
阅读(2394) | 评论(0) | 转发(0) |