全志V3S 入门 RTL8723BS 连接wifi

9 篇文章 1 订阅
4 篇文章 6 订阅

开发板:荔枝派zero
linux:5.10
rootfs:buildroot 2017.8.1
使用最新的主线linux内核5.10,主线5.10内核linux

make ARCH=arm licheepi_zero_defconfig

默认打开了8723BS编译为模块且只能编译成模块 因为要加载固件到8723内部
编译后的驱动在drivers/staging/rtl8723bs目录下,把r8723bs.ko和rtl8723bs_nic.bin拷到TF卡的BOOT分区,等会要把rtl8723bs_nic.bin放到/lib/firmware/rtlwifi目录下
在这里插入图片描述
buildroot中打开wireless tools 和wpa_supplicant
在这里插入图片描述
安装模块

insmod r8723bs.ko

正常会出现

# insmod r8723bs.ko
[   41.913611] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[   41.940102] RTL8723BS: module init start
[   41.944058] RTL8723BS: rtl8723bs v4.3.5.5_12290.20140916_BTCOEX20140507-4E40
[   41.951244] RTL8723BS: rtl8723bs BT-Coex version = BTCOEX20140507-4E40
[   41.959077] pnetdev = bbff7945
[   42.114968] RTL8723BS: rtw_ndev_init(wlan0)
[   42.120728] RTL8723BS: module init ret =0

然后把bin文件拷到相应目录下,原始的buildroot是没有这个文件的

cp rtl8723bs_nic.bin /lib/firmware/rtlwifi/

然后打开wlan0

ifconfig wlan0 up

出现

rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin

输入ifconfig就能看到有wlan0了

# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  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)

wlan0     Link encap:Ethernet  HWaddr 84:20:96:AB:35:86
          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)

配置连接WiFi
编辑vi /etc/network/interfaces文件

# Configure Loopback
auto lo
iface lo inet loopback
# wlan0
auto wlan0
iface wlan0 inet dhcp

wpa_supplicant连接WIFI的时候会从配置文件中读取账号和密码,以及加密方式等, 所以我们再运行wpa_supplicant工具的时候要提前写好配置文件。
配置文件名称自定,但是要以 .conf 为后缀,并保存在 /etc/ 目录下,这边给出一个配置文件的例子。
编辑vi /etc/wpa_supplicant.conf 文件:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
    ssid="KKKK"
    scan_ssid=1
    key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
    pairwise=TKIP CCMP
    group=CCMP TKIP WEP104 WEP40
    psk="99999999"
    priority=5
}

创建一个socket通信的目录

mkdir -p /var/run/wpa_supplicant

连接WiFi

wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0

出现以下正常

# vi /etc/network/interfaces
# vi /etc/wpa_supplicant.conf
# mkdir -p /var/run/wpa_supplicant
# wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
# [  263.533205] RTL8723BS: rtw_set_802_11_connect(wlan0)  fw_state = 0x00000008
[  263.837861] RTL8723BS: start auth
[  263.843508] RTL8723BS: auth success, start assoc
[  263.852424] RTL8723BS: rtw_cfg80211_indicate_connect(wlan0) BSS not found !!
[  263.859594] RTL8723BS: assoc success
[  263.869354] RTL8723BS: send eapol packet
[  263.881070] RTL8723BS: send eapol packet
[  263.886245] RTL8723BS: set pairwise key camid:4, addr:fa:12:65:54:24:c9, kid:0, type:AES
[  263.897246] RTL8723BS: set group key camid:5, addr:fa:12:65:54:24:c9, kid:2, type:AES

获取IP地址

# udhcpc -i wlan0
udhcpc: started, v1.27.2
udhcpc: sending discover
udhcpc: sending select for 192.168.137.115
udhcpc: lease of 192.168.137.115 obtained, lease time 604800
deleting routers
adding dns 192.168.137.1

查看网络状态

# wpa_cli -iwlan0 status
bssid=fa:12:65:54:24:c9
freq=2462
ssid=KKKK
id=0
mode=station
pairwise_cipher=CCMP
group_cipher=CCMP
key_mgmt=WPA2-PSK
wpa_state=COMPLETED
ip_address=192.168.137.115
address=84:20:96:ab:35:86
uuid=184c11e5-9a89-5b14-8be3-a53e89785949

ping 看下网络通不通

# ping www.baidu.com
PING www.baidu.com (183.232.231.172): 56 data bytes
64 bytes from 183.232.231.172: seq=0 ttl=56 time=12.049 ms
64 bytes from 183.232.231.172: seq=1 ttl=56 time=28.945 ms
64 bytes from 183.232.231.172: seq=2 ttl=56 time=11.020 ms
64 bytes from 183.232.231.172: seq=3 ttl=56 time=58.708 ms
64 bytes from 183.232.231.172: seq=4 ttl=56 time=11.982 ms
64 bytes from 183.232.231.172: seq=5 ttl=56 time=26.644 ms

最后设置开机启动
新建一个rc.local文件到/etv/init.d目录下

!/bin/sh

sh /etc/init.d/auto_wifi_link.sh
echo "wifi finish!!"

创建脚本auto_wifi_link.sh放到/etc/init.d/目录下

#!/bin/sh
insmod /r8723bs.ko
ifconfig wlan0 up
wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0
sleep 3s
udhcpc -i wlan0

修改开机启动项 vi /etc/inittab
# now run any rc scripts 后加入如下

::sysinit:/etc/init.d/rc.local

在这里插入图片描述

修改rc.local 权限

# chmod 755 /etc/init.d/rc.local

rc.local就能够正常工作了。
reboot重启看到自动导入驱动然后连接wifi得到ip地址
在这里插入图片描述

评论 1 您还未登录,请先 登录 后发表或查看评论
1. General Description 1-1. Product Overview and Functional Description AzureWave Technologies, Inc. introduces the first IEEE 802.11b/g/n WLAN & Bluetooth stamp module ---AW-NB300SM. The stamp module is targeted to mobile devices including Personal Digital ShenZhen Header Office Contact:JackyChen PhoneNo.,:13510094765.email:jackychen@flycastle.com flycastle@126.com Assistants (PDAs), Netbook, Tablet and Gaming Devices which need small package stamp module, low power consumption, multiple interfaces and OS support. By using AW-NB300SM, the customers can easily enable the Wi-Fi, and BT embedded applications with the benefits of high design flexibility, short development cycle, and quick time-to-market. Compliance with the IEEE 802.11b/g/n standard, the AW-NB300SM uses Direct Sequence Spread Spectrum (DSSS), Orthogonal Frequency Division Multiplexing (OFDM), DBPSK, DQPSK, CCK and QAM baseband modulation technologies. A high level of integration and full implementation of the power management functions specified in the IEEE 802.11 standard minimize the system power requirements by using AW-NB300SM. In addition to the support of WPA/WPA2 and WEP 64-bit and 128-bit encryption, the AW-NB300SM also supports the IEEE 802.11i security standard through the implementation of Advanced Encryption Standard (AES)/Counter Mode CBC-MAC Protocol (CCMP), Wired Equivalent Privacy (WEP) with Temporal Key Integrity Protocol (TKIP), Advanced Encryption Standard (AES)/Cipher-Based Message Authentication Code (CMAC), and WLAN Authentication and Privacy Infrastructure (WAPI) security mechanisms. For the video, voice and multimedia applications the AW-NB300SM support 802.11e Quality of Service (QoS). For Bluetooth operation, AW-NB300SM is Bluetooth 4.0, also complaint with Bluetooth 2.1 + Enhanced Data Rate (EDR). The AW-NB300SM supports SDIO for WLAN to the host processor. UART interface are available to connect the BT core the host processor. AW-NB300SM is suitable for multiple mobi

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

Kevincoooool

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值