使用 mwifiex_pcie 驱动程序创建接入点

Create Access Point with mwifiex_pcie driver

我的配置:
- i.MX6Quad
- 内核稳定 5.5.6
- wifi 模块:mwifiex_pcie
- 固件:pcieuart8997_combo_v4.bin(来自 https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

我正在尝试创建一个访问点,但是当我启动 hostapd 时,我总是从固件中得到同样的错误:

$ hostapd -B /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
[  855.225833] mwifiex_pcie 0000:01:00.0: CMD_RESP: cmd 0xf7 error, result=0x2
mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE

使用的进程:
1) 加载wifi模块

$ modprobe mwifiex_pcie
[ 300.412095] mwifiex_pcie 0000:01:00.0: enabling device (0140 -> 0142)
[ 300.418982] mwifiex_pcie: PCI memory map Virt0: 52dcd608 PCI memory map Virt2: 6cc1cdc2
[ 301.422006] mwifiex_pcie 0000:01:00.0: info: FW download over, size 632240 bytes
[ 302.262589] mwifiex_pcie 0000:01:00.0: WLAN FW is active
[ 302.324072] mwifiex_pcie 0000:01:00.0: Unknown api_id: 3
[ 302.329794] mwifiex_pcie 0000:01:00.0: Unknown api_id: 4
[ 302.335983] mwifiex_pcie 0000:01:00.0: Unknown GET_HW_SPEC TLV type: 0x217
[ 302.375282] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179)
[ 302.383574] mwifiex_pcie 0000:01:00.0: driver_version = mwifiex 1.0 (16.68.1.p179)

2) 设置接口

$ ip link set mlan0 up
$ /sbin/ifup -a
$ ifconfig mlan0
 mlan0     Link encap:Ethernet  HWaddr C0:EE:XX:XX:XX:XX  
          inet addr:192.168.0.5  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

我的 接口 文件:

auto lo
iface lo inet loopback

auto mlan0
iface mlan0 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4 192.168.0.1

3) 配置hostapd.conf

# interface wlan du Wi-Fi
interface=mlan0

# nl80211 avec tous les drivers Linux mac80211 
driver=nl80211

# Nom du spot Wi-Fi
ssid=my_access_point

# mode Wi-Fi (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
country_code=FR

# AC
ieee80211d=1
channel=6
macaddr_acl=0

# Wi-Fi authentication required
auth_algs=1

# Beacon interval in kus (1.024 ms)
beacon_int=100

# DTIM (delivery trafic information message) 
dtim_period=2

# Maximum number of stations allowed in station table
max_num_sta=255

# Fragmentation threshold; 2346 = disabled (default)
fragm_threshold=-1

logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2i

wpa=2
wpa_passphrase=wifipassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

4) 启动 hostapd

hostapd -B /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
[  855.225833] mwifiex_pcie 0000:01:00.0: CMD_RESP: cmd 0xf7 error, result=0x2
mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE

接下来我有一个固件转储:

[  847.848390] mwifiex_pcie 0000:01:00.0: mwifiex_cmd_timeout_func: Timeout cmd id = 0xb0, act = 0x1
[  847.857885] mwifiex_pcie 0000:01:00.0: num_data_h2c_failure = 0
[  847.863914] mwifiex_pcie 0000:01:00.0: num_cmd_h2c_failure = 0
[  847.869835] mwifiex_pcie 0000:01:00.0: is_cmd_timedout = 1
[  847.875406] mwifiex_pcie 0000:01:00.0: num_tx_timeout = 0
[  847.880887] mwifiex_pcie 0000:01:00.0: last_cmd_index = 3
[  847.886344] mwifiex_pcie 0000:01:00.0: last_cmd_id: 0c 01 1e 00 20 00 b0 00 0c 01
[  847.893860] mwifiex_pcie 0000:01:00.0: last_cmd_act: 01 00 00 00 08 00 01 00 01 00
[  847.901458] mwifiex_pcie 0000:01:00.0: last_cmd_resp_index = 2
[  847.907320] mwifiex_pcie 0000:01:00.0: last_cmd_resp_id: 0c 81 1e 80 20 80 1e 80 0c 81
[  847.915266] mwifiex_pcie 0000:01:00.0: last_event_index = 4
[  847.920868] mwifiex_pcie 0000:01:00.0: last_event: 58 00 0b 00 0a 00 0b 00 0a 00
[  847.928292] mwifiex_pcie 0000:01:00.0: data_sent=0 cmd_sent=1
[  847.934066] mwifiex_pcie 0000:01:00.0: ps_mode=1 ps_state=0
[  847.942382] mwifiex_pcie 0000:01:00.0: ===mwifiex driverinfo dump start===
[  847.949646] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179) 
[  847.957861] mwifiex_pcie 0000:01:00.0: PCIE register dump start
[  847.963863] mwifiex_pcie 0000:01:00.0: pcie scratch register:
[  847.969757] mwifiex_pcie 0000:01:00.0: reg:0xcf0, value=0xfedcba00
[  847.969757] reg:0xcf8, value=0x12f00fc
[  847.969757] reg:0xcfc, value=0x19b9c07
[  847.969757] 
[  847.984976] mwifiex_pcie 0000:01:00.0: PCIE register dump end
[  847.990935] mwifiex_pcie 0000:01:00.0: ===mwifiex driverinfo dump end===
[  847.997659] mwifiex_pcie 0000:01:00.0: == mwifiex firmware dump start ==
[  849.768341] mwifiex_pcie 0000:01:00.0: cmd_wait_q terminated: -110
[  849.775003] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.781719] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.788861] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.795435] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.801870] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.808277] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.814650] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.857862] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.864329] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.870829] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.877206] mwifiex_pcie 0000:01:00.0: 11D: failed to enable 11D
[  849.883378] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.889816] mwifiex_pcie 0000:01:00.0: Failed to set AP configuration
[  849.896419] mwifiex_pcie 0000:01:00.0: Failed to start AP
[  849.902571] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.909010] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.915294] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.921777] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.928127] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.934501] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.941019] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  849.947459] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[  849.999480] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.039425] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.045877] mwifiex_pcie 0000:01:00.0: mlan0: changing to 2 not supported
[  850.054252] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.061013] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.067634] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.074322] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.088987] mwifiex_pcie 0000:01:00.0: mlan0: changing to 2 not supported
[  850.096716] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.103094] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.109793] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[  850.116133] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state

有人知道是什么原因造成的吗?以及如何解决它? 我搜索了很多主题,但找不到解决此问题的方法。

感谢您的宝贵时间

如果有人有同样的问题,这里是解决方案:

1) 加载 wifi 模块

modprobe mwifiex_pcie

2) 设置接口
要使用 mwifiex_pcie 驱动程序创建接入点,我们需要添加另一个接口:uap0

iw dev mlan0 interface add uap0 type __ap

We should have : lo, mlan0 and uap0 with $ifconfig

3) 然后,使用接口 uap0

配置您的 interfaces 文件和 hostapd.conf 文件

用于解决此问题的链接:
- http://linuxwireless.sipsolutions.net/en/users/Drivers/mwifiex/__v9.html