新闻  |   论坛  |   博客  |   在线研讨会
RTL8723蓝牙wifi移植到4.9.88内核
电子禅石 | 2020-08-01 10:14:19    阅读:9492   发布文章

/*新增8723bu移植到imx6qdl 4.9.88最新内核,很多东西需要改的头大,一下是3.14.28版本的内黑*/

8723buwifi

软件包下载

http://download.csdn.net/detail/qqchangjianfei/9554279

 

WIFI:            增加路径

linux/kernel/kernel-3.4.39/drivers/net/wireless/Makefile

obj-$(CONFIG_BRCMSMAC) += brcm80211/

obj-$(CONFIG_RTL8723BU) += rtl8723BU_WiFi/

linux/kernel/kernel-3.4.39/drivers/net/wireless/Kconfig

source"drivers/net/wireless/DHD_REL_1_141_44_3/Kconfig"

source"drivers/net/wireless/rtl8723BU_WiFi/Kconfig"

内核添加 

-> Device Drivers                                                       

    -> Network device support (NETDEVICES[=y])                          

       -> Wireless LAN (WLAN [=y])

<*>   Realtek8723B USB WiFi  

测试:

-----------------------------------------wpa_supplicant方法---------------------

开启wifi设备:ifconfig wlan0 up

显示wifi热点:iwlist scanning

增加连接的wifi 的名称和密码

vi etc/wpa_supplicant.conf

内容如下:

# WPA-PSK/TKIP

 

ctrl_interface=/var/run/wpa_supplicant

 

network={

       ssid="dlink" //WIFI名称

       key_mgmt=WPA-PSK

       proto=WPA

       pairwise=TKIP

       group=TKIP

       psk="12345" //WIFI密码

}

 

 wpa_supplicant -d -Dwext-iwlan0 -c/etc/wpa_supplicant.conf &

wpa_supplicant wpa_supplicant可执行程序path

-d :增加调试信息

-Dwext wext,驱动名称

-iwlan0 wlan0,网络接口名称

 iwconfig

 ifconfig wlan0 192.168.12.198  //设置无线网卡IP

 ifconfig wlan0

 

Ping 同一网段的IP

ping 192.168.12.102

 

64 bytes from 192.168.12.102: seq=0 ttl=64 time=54.105 ms

64 bytes from 192.168.12.102: seq=1 ttl=64 time=278.848ms

64 bytes from 192.168.12.102: seq=2 ttl=64 time=199.479ms

 

 

 

8723bu  蓝牙部分

 

 

BT4.0:      驱动和应用移植:

驱动:从网上下载8723bu_bt驱动RTL8723BU.rar(蓝牙wifi驱动都有)

解压到linux/QT_6818/kernel/drivers/Bluetooth

修改Makefile

obj-$(CONFIG_BT_RTKBTUSB_CJF)   += rtk_btusb_cjf.o

rtk_btusb_cjf-y= rtk_coex.o rtk_bt.o

Kconfig

configBT_RTKBTUSB_CJF

    tristate "RTK HCI USB driver byCJF"

    depends on USB

    help

      RTK Bluetooth HCI USB driver by CJF

内核增加该选项

[*] Networking support --->

   <*>   Bluetooth subsystem support  --->

                   Bluetooth device drivers  --->

                                       <*>RTK HCI USB driver by CJF

应用层程序移植:需要移植bluez-4.95

    

http://blog.csdn.net/u011408697/article/details/44459239

1、交叉编译 expat-2.0.1

./configure-prefix=/usr/local/bluez-4.95 -host=arm-linux CC=arm-linux-gcc

make

makeinstall

2、交叉编译 dbus-1.4.1

./configure-prefix=/usr/local/bluez-4.95 -host=arm-linux -with-x=no-enable-abstract-sockets CC=arm-linux-gccCFLAGS=-I/usr/local/bluez-4.95/include LDFLAGS=-L/usr/local/bluez-4.95/lib

make

makeinstall

3、交叉编译 glib-2.16.2

./configure-prefix=/usr/local/bluez-4.95 -host=arm-linux CC=arm-linux-gcc glib_cv_stack_grows=noglib_cv_uscore=yes glib_cv_have_qsort_r=yes ac_cv_func_posix_getpwuid_r=yesac_cv_func_posix_getgrgid_r=yes

 

make

makeinstall

4、交叉编译 bluez-4.95

sudoapt-get install libdbus-1-dev libdbus-glib-1-dev

 

exportPKG_CONFIG_LIBDIR=/usr/local/bluez-4.95/lib/pkgconfig

 

./configure-prefix=/usr/local/bluez-4.95 -host=arm-linux -disable-audio -enable-network-enable-serial -enable-input -enable-service -enable-health -enable-usb-enable-tools -enable-bccmd -enable-hid2hci -enable-hidd -enable-pand -enable-cups-enable-test CC=arm-linux-gcc CFLAGS=-I/usr/local/bluez-4.95/includeLDFLAGS=-L/usr/local/bluez-4.95/lib

 

make

makeinstall

 

错误

audio/pcm_bluetooth.c:40:fatal error: alsa/asoundlib.h: No such file or directory

compilationterminated.

$sudo apt-getinstall libasound2-dev

 

5、交叉编译 bluez-hcidump-2.5

 

./configure-prefix=/usr/local/bluez-4.95 -host=arm-linux CC=arm-linux-gcc

 

make

makeinstall

 

 

 

四、使用方法:

 

1、把刚刚交叉编译好的 bluez-4.95复制到开发板上,比如放在 /usr/local/

 

2、开发板上,vi /etc/passwd,在最后添加messagebus:x:500:500::/home/messagebus:/bin/sh,保存

 

3、添加环境变量:

 

exportPATH=/mnt/sdcard/bluez-4.95/bin:$PATH

exportPATH=/mnt/sdcard/bluez-4.95/sbin:$PATH

 

exportLD_LIBRARY_PATH=/mnt/sdcard/bluez-4.95/lib:$LD_LIBRARY_PATH

 

mount/mnt/sdcard/bluez-4.95 /usr/local/bluez-4.95/

4、运行 dbus-daemon -system

 

dbus-daemon--system

 

注:启动一次过后会生成某进程文件,以后再启用需要先删除它

rm/mnt/sdcard/bluez-4.95/var/run/dbus/pid

 

5bluetoothd -f/mnt/sdcard/bluez-4.95/etc/bluetooth/main.conf

 

或者:直接 bluetoothd,默认会载入上边的 conf

或者:bluetoothd -nd表示进入调试并且不后台执行

 

注:开启 bluetoothd默认会 hci0 up

 

 

1\加载驱动

/lib/firmware # insmod rtk_btusb.ko

2\查看蓝牙设备

/bin #hciconfig

hci0:Type: BR/EDR  Bus: USB

BDAddress: 00:00:00:00:00:00  ACL MTU:0:0  SCO MTU: 0:0

DOWN

RXbytes:0 acl:0 sco:0 events:0 errors:0

TX bytes:0acl:0 sco:0 commands:0 errors:0

3\启动设备,会自动加载固件

/sbin #./hciconfig hci0 up 

rtk_btusb:btusb_open hdev->promisc ==0

rtk_btusb:download_patch start

5\扫描设备

/sbin #./hcitool scan

Scanning...

00:74:23:8E:D2:A9

K-TouchT619(天语 

38:BC:1A:88:59:E2

MEIZUMX2

6\开启可检测性和连接

root@lierda:~#./hciconfig hci0 up piscan

7\ ping测试

/sbin #./l2ping 00:74:23:8E:D2:A9

/*********************无密码链接蓝牙**************************/

将这2个文件放在/lib/firmware下(此为固件升级软件 还有必要的路径在内核配置总)

 

#CONFIG_BCM4339 is not set

CONFIG_BCMDHD_FW_PATH="/system/etc/firmware/fw_bcmdhd.bin"

CONFIG_BCMDHD_NVRAM_PATH="/system/etc/wifi/bcmdhd.cal"

#CONFIG_BRCMFMAC is not set

#CONFIG_HOSTAP is not set

(相信这里把大部分人给卡住了,啧啧啧,我可是研究好几天呢)

rtl8723b_fw       rtl8723bu_config

vi/etc/passwd,在最后添加messagebus:x:500:500::/home/messagebus:/bin/sh,保存

exportPATH=/mnt/sdcard/bluez-4.95/bin:$PATH

exportPATH=/mnt/sdcard/bluez-4.95/sbin:$PATH

exportLD_LIBRARY_PATH=/mnt/sdcard/bluez-4.95/lib:$LD_LIBRARY_PATH

mount/mnt/sdcard/bluez-4.95 /usr/local/bluez-4.95/

 

hciconfig

hciconfighci0 up

rm/mnt/sdcard/bluez-4.95/var/run/dbus/pid

dbus-daemon--system

 

bluetoothd

hciconfighci0 up piscan

hcitoolscan

hciconfighci0 up piscan

/***********************************************/

 

https://blog.csdn.net/qqchangjianfei/article/details/51719108?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
属于自己的技术积累分享,成为嵌入式系统研发高手。
推荐文章
最近访客