USB WiFi:rtl8188eu
Linux kernel:4.1.15 armv7l GNU/Linux
移植好内核和文件系统后编译了wpa_supplicant,lwlist能正常搜索到WiFi信号,通过wpa_supplicant也能正常连接到手机热点或者路由器上并自动获取到IP
接着笔记本上开热点,手机能正常连接并且上网,但是开发板通过wpa_supplicant去连接Windows的热点,iwconfig显示确实能连接上:
wpa_supplicant -Dwext -c/etc/wpa_supplicant.conf -iwlan0 &
root@hope_imx6ull:/# iwconfig
wlan0 IEEE 802.11bgn ESSID:"Hope" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.437 GHz Access Point: D6:6D:6D:C7:C6:58
Bit Rate:72.2 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:****-****-****-****-****-****-****-**** Security mode:open
Power Management:off
Link Quality=100/100 Signal level=100/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
root@hope_imx6ull:/#
root@hope_imx6ull:/# ifconfig
wlan0 Link encap:Ethernet HWaddr 00:13:EF:F1:0E:C6
inet6 addr: fe80::213:efff:fef1:ec6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:39 errors:0 dropped:0 overruns:0 frame:0
TX packets:31 errors:0 dropped:3 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6951 (6.7 KiB) TX bytes:8457 (8.2 KiB)
但使用 udhcpc -i wlan0 却始终无法获取到IP地址:
root@hope_imx6ull:/# udhcpc wlan0
udhcpc: started, v1.29.0
Setting IP address 0.0.0.0 on eth0
[ 854.423772] fec 20b4000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr=20b4000.ethernet:01, irq=-1)
[ 854.463813] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
同时,虽然iwconfig显示已经连接到Windows热点上,但是在win上却看不到已连接设备的信息(图中这两是我手机):
查了老半天最后还是只能靠手动设置IP和路由才能上网:
root@hope_imx6ull:/# ifconfig wlan0 192.168.137.115 netmask 255.255.255.0 broadcast 192.168.137.255
root@hope_imx6ull:/# route add default gw 192.168.137.1
root@hope_imx6ull:/# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default LAPTOP-6GR2TNN2 0.0.0.0 UG 0 0 0 wlan0
192.168.137.0 * 255.255.255.0 U 0 0 0 wlan0
接着,手动修改DNS:
vi /etc/resolv.conf
# 原来的内容
nameserver 192.168.43.1
# 修改后
nameserver 192.168.137.1
尝试ping Windows和百度:
root@hope_imx6ull:/# ping 192.168.137.1
PING 192.168.137.1 (192.168.137.1): 56 data bytes
64 bytes from 192.168.137.1: seq=0 ttl=64 time=9.479 ms
64 bytes from 192.168.137.1: seq=1 ttl=64 time=1.641 ms
64 bytes from 192.168.137.1: seq=2 ttl=64 time=29.819 ms
^C
--- 192.168.137.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.641/13.646/29.819 ms
root@hope_imx6ull:/#
root@hope_imx6ull:/# ping www.baidu.com
PING www.baidu.com (220.181.38.149): 56 data bytes
64 bytes from 220.181.38.149: seq=0 ttl=50 time=101.346 ms
64 bytes from 220.181.38.149: seq=1 ttl=50 time=125.001 ms
64 bytes from 220.181.38.149: seq=2 ttl=50 time=45.836 ms
^C
--- www.baidu.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 45.836/90.727/125.001 ms
root@hope_imx6ull:/#
能ping通,能上网,win上还是看不到: