RTL8723BS 移植(WIFI部分)已解決

硬件平臺:N3290X (ARM9)
驅動接口:(必須)支持SDIO
Linux系統版本:2.6.35.4
編譯器版本:arm-linux-gcc-4.3.2

RTL8723BS WIFI部分源碼下載

硬件電路如下,這不就是SD卡標準接口麼?!!
這裏寫圖片描述

源碼修改

diff -Nur a/include/autoconf.h b/include/autoconf.h
--- a/include/autoconf.h    2015-11-25 16:46:03.000000000 +0800
+++ b/include/autoconf.h    2016-11-23 19:35:26.792215500 +0800
@@ -310,7 +310,7 @@
 /*
  * Debug Related Config
  */
-#define CONFIG_DEBUG
+//#define CONFIG_DEBUG  //屏蔽掉調試信息(調成之後感覺沒有留的必要,太辣眼睛了)

 #ifdef CONFIG_DEBUG
 #define DBG    1   // for ODM & BTCOEX debug
diff -Nur a/include/osdep_service_linux.h b/include/osdep_service_linux.h
--- a/include/osdep_service_linux.h 2015-11-25 16:46:03.000000000 +0800
+++ b/include/osdep_service_linux.h 2016-11-22 23:26:57.980254100 +0800
@@ -387,7 +387,7 @@
 #elif defined(CONFIG_ANDROID_POWER)
 #include <linux/android_power.h>
 #endif
-
+#define PATH_MAX    4096
 // limitation of path length
 #define PATH_LENGTH_MAX PATH_MAX

diff -Nur a/Makefile b/Makefile
--- a/Makefile  2015-11-25 16:46:03.000000000 +0800
+++ b/Makefile  2016-11-24 20:42:28.579376200 +0800
@@ -68,7 +68,8 @@
 ######### Notify SDIO Host Keep Power During Syspend ##########
 CONFIG_RTW_SDIO_PM_KEEP_POWER = y
 ###################### Platform Related #######################
-CONFIG_PLATFORM_I386_PC = y
+CONFIG_PLATFORM_ARM_N3290X = y
+CONFIG_PLATFORM_I386_PC = n
 CONFIG_PLATFORM_ANDROID_X86 = n
 CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
 CONFIG_PLATFORM_JB_X86 = n
@@ -884,6 +885,14 @@
 KSRC ?= /usr/src/linux-2.6.34.1
 endif

+ifeq ($(CONFIG_PLATFORM_ARM_N3290X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := arm-none-linux-gnueabi-
+KVER  := 2.6.35.4
+KSRC := /home/w55fa93bsp-2.6.35/linux-2.6.35.4
+endif
+
 ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
 EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
 ARCH:=

加載驅動會看到以下調試信息,說明已經成功驅動了,否則就要各種查查查,如果人品不行的就到廟裏多燒燒香(看個人信仰)!

加載驅動:

/ #insmod /usr/8723bs.ko                                                                                                                                    
[    9.370000] RTL871X: module init start
[    9.370000] RTL871X: rtl8723bs v4.3.16.8_16010.20151125_BTCOEX20150119-5844
[    9.380000] RTL871X: build time: Nov 23 2016 19:35:46
[    9.380000] RTL871X: rtl8723bs BT-Coex version = BTCOEX20150119-5844
[    9.640000] RTL871X: rtw_ndev_init(wlan0)
[    9.660000] RTL871X: module init ret=0

啓動網卡設備

/ #ifconfig wlan0 up                                                              
/ # [ 1159.120000] RTL871X: nolinked power save enter

連接wifi熱點

/ #wpa_supplicant -D wext -c  /etc/wpa_supplicant.conf -i wlan0 -B

[ 1273.970000] RTL871X: nolinked power save leave
[ 1273.990000] RTL871X: set bssid:00:00:00:00:00:00
ioctl[SIOCSIWAP]: Operation not permitted
/ # [ 1275.690000] RTL871X: set ssid [HAME_A5_6537] fw_state=0x00000008
[ 1275.710000] RTL871X: set bssid:9c:41:7c:06:53:78
[ 1275.830000] RTL871X: start auth
[ 1275.840000] RTL871X: auth success, start assoc
[ 1275.850000] RTL871X: assoc success
[ 1276.080000] RTL871X: send eapol packet
[ 1276.090000] RTL871X: send eapol packet
[ 1276.090000] RTL871X: set pairwise key camid:4, addr:9c:41:7c:06:53:78, kid:0, type:AES
[ 1276.120000] RTL871X: send eapol packet
[ 1276.130000] RTL871X: set group key camid:5, addr:9c:41:7c:06:53:78, kid:2, type:AES

動態獲取IP地址

/ #udhcpc -i wlan0                                                                
udhcpc (v1.15.2) started
Sending discover...
Sending select for 192.168.169.3...
Lease of 192.168.169.3 obtained, lease time 86400
deleting routers
route: SIOCDELRT: No such process
adding dns 192.168.169.1
adding dns 8.8.8.8

測試網絡

/ # ping 14.215.177.37
PING 14.215.177.37 (14.215.177.37): 56 data bytes
64 bytes from 14.215.177.37: seq=0 ttl=54 time=69.517 ms
64 bytes from 14.215.177.37: seq=1 ttl=54 time=41.021 ms
64 bytes from 14.215.177.37: seq=2 ttl=54 time=51.218 ms
64 bytes from 14.215.177.37: seq=3 ttl=54 time=31.156 ms
64 bytes from 14.215.177.37: seq=4 ttl=54 time=61.027 ms
^C
--- 14.215.177.37 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 31.156/50.787/69.517 ms
/ # 

其中wpa_supplicant.conf 配置文件格式,可自行網上查wpa_supplicant工具用法

ctrl_interface=/var/run/wpa_supplicant

network={
        ssid="熱點名稱"
        psk="熱點的密碼"
        key_mgmt=WPA-PSK
        proto=WPA2
        pairwise=CCMP
        group=CCMP
}

還有幾個wifi調試工具
比如iwlist掃描附近有哪些顯擺的熱點:

/ # iwlist wlan0 scan                                                              
wlan0     Scan completed :
          Cell 01 - Address: 9C:41:7C:06:53:78
                    ESSID:"HAME_A5_6537"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:150 Mb/s
                    Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=100/100  Signal level=76/100  
                    Extra:fm=0003
          Cell 02 - Address: 74:C3:30:51:F1:C8
                    ESSID:"FAST_102"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Extra:
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=100/100  Signal level=74/100  
                    Extra:fm=0003
          Cell 03 - Address: FC:D7:33:EC:35:86
                    ESSID:"TP-LINK_3586"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.412 GHz (Channel 1)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Extra:
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=89/100  Signal level=54/100  
                    Extra:fm=0003
          Cell 04 - Address: 08:10:79:6D:F0:E3
                    ESSID:"Netcore_6DF0E3"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:300 Mb/s
                    Extra:wpa_ie=dd160050f20101000050f20401000050f20401000050f202
                    IE: WPA Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Extra:
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=72/100  Signal level=47/100  
                    Extra:fm=0001
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章