文档名称:嵌入式linux usb wifi驱动移植
版本历史
版本号 |
时间 |
内容 |
v1.0b001 |
2012-6-18 |
初始版本,介绍在嵌入式linux方面如何移植usb wifi相关 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
嵌入式linux usb wifi移植参考文档
■ 硬件平台:realARM 6410
■ 操作系统:fedora kernel 2.6.33.3-85.fc13.i686.PAE
■ 交叉编译器:arm-none-linux-gnueabi gcc version 4.3.2
■ WIFI模组:磊科NW336 芯片 realtek 8188cus
【前提 linux系统可以在板子上正常运行】
1. 调试步骤
移植usb wifi首先确定板子上的USB Host功能正常运行,进入内核配置界面,如下图进行配置。
Fig1.0linux kernel 2.6.36打开USB HOST界面
从新编译内核后启动开发板,并插入U盘后,通过mount命令进行U盘加载
Mount /dev/sdb1 /mnt/
Cd /mnt/
Ls
得到下图Fig1.1结果
Fig 1.1 mount U盘成功
2.下载磊科 USB WIFI 对应芯片驱动realtek8188cus,从官网下载linux驱动
http://www.realtek.com/downloads/downloadsView.aspx?Langid=3&PNid=48&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true#RTL8192CU
拷贝并解压得到以下目录
[root@localhost RTL8188C_8192C_8192D_USB_linux_v3.4.2_3727.20120404]# tree -d
.
|-- android_reference_codes
|-- android_reference_codes_ICS_nl80211
|-- document
|-- driver
| `-- rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404
| |-- core
| | `-- efuse
| |-- hal
| | |-- rtl8192c
| | | `-- usb
| | `-- rtl8192d
| | `-- usb
| |-- include
| | `-- byteorder
| `-- os_dep
| `-- linux
|-- hardware_wps_pbc
|-- WiFi_Direct_User_Interface
|-- wireless_tools
| `-- wireless_tools.30.rtl
| |-- cs
| |-- fr.ISO8859-1
| `-- fr.UTF-8
`-- wpa_supplicant_hostapd
`-- wpa_supplicant_hostapd-0.8
|-- hostapd
| `-- logwatch
|-- patches
|-- src
| |-- ap
| |-- common
| |-- crypto
| |-- drivers
| |-- eap_common
| |-- eapol_auth
| |-- eapol_supp
| |-- eap_peer
| |-- eap_server
| |-- l2_packet
| |-- p2p
| |-- radius
| |-- rsn_supp
| |-- tls
| |-- utils
| `-- wps
`-- wpa_supplicant
|-- dbus
|-- doc
| `-- docbook
|-- examples
|-- symbian
|-- tests
|-- vs2005
| |-- eapol_test
| |-- win_if_list
| |-- wpa_cli
| |-- wpa_passphrase
| |-- wpa_supplicant
| `-- wpasvc
|-- wpa_gui
|-- wpa_gui-qt4
| |-- icons
| `-- lang
`-- xcode
`-- wpa_supplicant.xcodeproj
65 directories
[root@localhost RTL8188C_8192C_8192D_USB_linux_v3.4.2_3727.20120404]# cd driver/
进入driver目录并解压rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404.tar.gz文件
在改目录下找到文件Makefile并作出相应的修改,因为默认情况下是PC平台x86结构的
/home/s3c6410/s3c6410/driver/RTL8188C_8192C_8192D_USB_linux_v3.4.2_3727.20120404/driver/rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404
Fig 1.2 将s3c6410平台从n改为y
Fig1.3根据自身linux开发环境做修改
在driver目录修改完Makefile后,执行make指令。不出意外将顺利完成编译必应从2.6.34内核到2.6.36内核驱动中涉及到的结构体变动比较小!如果内核跨度大的有可能出现结构体不一致而不得不修改源码。
[root@localhost rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404]# ls
8192cu.ko 8192cu.mod.o autoconf_rtl8192c_usb_linux.h clean hal include make_drv modules.order os_dep
8192cu.mod.c 8192cu.o autoconf_rtl8192d_usb_linux.h core ifcfg-wlan0 Kconfig Makefile Module.symvers wlan0dhcp
[root@localhost rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404]#
其中8192cu.ko 将是我们需要的驱动模块文件
下载内核,启动开发板:
U-Boot 1.1.6 (Mar 3 2010 - 20:17:49) for SMDK6410
CPU: S3C6410@800MHz
Fclk = 800MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board: SMDK6410
DRAM: 256 MB
Flash: 0 kB
NAND: Maf. ID is d3
1024 MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
SMDK6410 #
SMDK6410 #
SMDK6410 # ping 192.168.1.247
dm9000 i/o: 0x18000300, id: 0x90000a46
MAC: 00:22:12:34:56:90
operating at 100M full duplex mode
host 192.168.1.247 is alive
SMDK6410 # tftp c0008000 zImage
dm9000 i/o: 0x18000300, id: 0x90000a46
MAC: 00:22:12:34:56:90
operating at 100M full duplex mode
TFTP from server 192.168.1.247; our IP address is 192.168.1.20
Filename 'zImage'.
Load address: 0xc0008000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
####################################
done
Bytes transferred = 5508324 (540ce4 hex)
SMDK6410 #bootm c0008000
Boot with zImage
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.36-Xtramus (root@localhost.localdomain) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #624 PREEMPT Fri Jun 15 16:56:22 CST 2012
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: XTRAMUS6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x36410101)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=800000000, M=532000000, E=24000000
S3C64XX: HCLK2=266666666, HCLK=133333333, PCLK=66666666
mout_apll: source is fout_apll (1), rate is 800000000
mout_epll: source is epll (1), rate is 24000000
mout_mpll: source is mpll (1), rate is 532000000
mmc_bus: source is mout_epll (0), rate is 24000000
mmc_bus: source is mout_epll (0), rate is 24000000
mmc_bus: source is mout_epll (0), rate is 24000000
usb-bus-host: source is clk_48m (0), rate is 48000000
uclk1: source is dout_mpll (1), rate is 66500000
spi-bus: source is mout_epll (0), rate is 24000000
spi-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
audio-bus: source is mout_epll (0), rate is 24000000
irda-bus: source is mout_epll (0), rate is 24000000
camera: no parent clock specified
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
Kernel command line: noinitrd root=dev/mtdblock0 console=ttySAC0,115200 init/linuxrc mem=256M
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256MB = 256MB total
Memory: 252116k/252116k available, 10028k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xff600000 - 0xffe00000 ( 8 MB)
vmalloc : 0xd0800000 - 0xe0000000 ( 248 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc0363000 (3436 kB)
.text : 0xc0363000 - 0xc0717000 (3792 kB)
.data : 0xc0736000 - 0xc07596a0 ( 142 kB)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:246
VIC @f4000000: id 0x00041192, vendor 0x41
VIC @f4010000: id 0x00041192, vendor 0x41
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 799.53 BogoMIPS (lpj=3997696)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
s3c64xx_dma_init: Registering DMA channels
s3c64xx_dma_init1: registering DMA 0 (d0808100)
s3c64xx_dma_init1: registering DMA 1 (d0808120)
s3c64xx_dma_init1: registering DMA 2 (d0808140)
s3c64xx_dma_init1: registering DMA 3 (d0808160)
s3c64xx_dma_init1: registering DMA 4 (d0808180)
s3c64xx_dma_init1: registering DMA 5 (d08081a0)
s3c64xx_dma_init1: registering DMA 6 (d08081c0)
s3c64xx_dma_init1: registering DMA 7 (d08081e0)
PL080: IRQ 73, at d0808000
s3c64xx_dma_init1: registering DMA 8 (d080c100)
s3c64xx_dma_init1: registering DMA 9 (d080c120)
s3c64xx_dma_init1: registering DMA 10 (d080c140)
s3c64xx_dma_init1: registering DMA 11 (d080c160)
s3c64xx_dma_init1: registering DMA 12 (d080c180)
s3c64xx_dma_init1: registering DMA 13 (d080c1a0)
s3c64xx_dma_init1: registering DMA 14 (d080c1c0)
s3c64xx_dma_init1: registering DMA 15 (d080c1e0)
PL080: IRQ 74, at d080c000
S3C6410: Initialising architecture
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 65 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (extended precision)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 492
io scheduler noop registered (default)
s3c6400-uart.0: s3c2410_serial0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10
s3c6400-uart.1: s3c2410_serial1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10
s3c6400-uart.2: s3c2410_serial2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10
s3c6400-uart.3: s3c2410_serial3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10
loop: module loaded
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
S3C NAND Driver, (c) 2008 Samsung Electronics
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)
Creating 3 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "Bootloader"
0x000000040000-0x000000800000 : "Kernel"
0x000000800000-0x000040000000 : "ubifs"
dm9000 Ethernet Driver, V1.31
eth0: dm9000a at d0828000,d0c00004 IRQ 108 MAC: 00:22:12:34:56:90 (chip)
usbcore: registered new interface driver zd1201
usbcore: registered new interface driver hwa-rc
usbmon: debugfs is not available
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.36-Xtramus ohci_hcd
usb usb1: SerialNumber: s3c24xx
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usbcore: registered new interface driver hwa-hc
usbcore: registered new interface driver wusb-cbaf
usbcore: registered new interface driver cdc_wdm
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
s3c-hsotg s3c-hsotg: regs d0840000, irq 90
s3c-hsotg s3c-hsotg: s3c_hsotg_corereset: reset failed, GRSTCTL=80000001
s3c-hsotg s3c-hsotg: GRXFSIZ=0x00001800, GNPTXFSIZ=0x18001800
s3c-hsotg s3c-hsotg: shared fifos
s3c-hsotg s3c-hsotg: cannot create debug root
s3c-hsotg s3c-hsotg: DCFG=0x00200000, DCTL=0x00000002, DIEPMSK=0000000f
s3c-hsotg s3c-hsotg: GAHBCFG=0x00000000, 0x44=0x00000000
s3c-hsotg s3c-hsotg: GRXFSIZ=0x00000800, GNPTXFSIZ=0x04000800
s3c-hsotg s3c-hsotg: DPTx[1] FSize=768, StAddr=0x00000f00
s3c-hsotg s3c-hsotg: DPTx[2] FSize=768, StAddr=0x00001200
s3c-hsotg s3c-hsotg: DPTx[3] FSize=768, StAddr=0x00001500
s3c-hsotg s3c-hsotg: DPTx[4] FSize=768, StAddr=0x00001800
s3c-hsotg s3c-hsotg: DPTx[5] FSize=768, StAddr=0x00001b00
s3c-hsotg s3c-hsotg: DPTx[6] FSize=768, StAddr=0x00001e00
s3c-hsotg s3c-hsotg: DPTx[7] FSize=768, StAddr=0x00002100
s3c-hsotg s3c-hsotg: DPTx[8] FSize=768, StAddr=0x00002400
s3c-hsotg s3c-hsotg: DPTx[9] FSize=768, StAddr=0x00002700
s3c-hsotg s3c-hsotg: DPTx[10] FSize=768, StAddr=0x00002a00
s3c-hsotg s3c-hsotg: DPTx[11] FSize=768, StAddr=0x00002d00
s3c-hsotg s3c-hsotg: DPTx[12] FSize=768, StAddr=0x00003000
s3c-hsotg s3c-hsotg: DPTx[13] FSize=768, StAddr=0x00003300
s3c-hsotg s3c-hsotg: DPTx[14] FSize=768, StAddr=0x00003600
s3c-hsotg s3c-hsotg: DPTx[15] FSize=768, StAddr=0x00003900
s3c-hsotg s3c-hsotg: ep0-in: EPCTL=0x00008000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep0-out: EPCTL=0x00008000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep1-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep1-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep2-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep2-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep3-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep3-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep4-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep4-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep5-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep5-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep6-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep6-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep7-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep7-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep8-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep8-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep9-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep9-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep10-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep10-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep11-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep11-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep12-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep12-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep13-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep13-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
s3c-hsotg s3c-hsotg: ep14-in: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: ep14-out: EPCTL=0x00000000, SIZ=0x00000000, DMA=0x00000000
s3c-hsotg s3c-hsotg: DVBUSDIS=0x000017d7, DVBUSPULSE=000005b8
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
TCP cubic registered
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
s3c-rtc s3c64xx-rtc: hctosys: invalid date/time
Freeing init memory: 3436K
usb 1-1: New USB device found, idVendor=0bda, idProduct=8176
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: 802.11n WLAN Adapter
usb 1-1: Manufacturer: Realtek
usb 1-1: SerialNumber: 00e04c000001
eth0: link up, 100Mbps, full-duplex, lpa 0x41E1
ifconfig: SIOCSIFADDR: No such device
*********************Auto start telnetd ************************
Please press Enter to activate this console.
-/bin/sh: id: not found
[root@Xtramus6410 /]#
启动的时候顺利识别到usb wifi,说明USB HOST没问题,接着将加载驱动模块不管用何种方式(NFS,or ftp tftp均可)本文档采用的是tftp将模块驱动down到板子/opt/目录上
[root@Xtramus6410 /opt]# tftp -g -r 8192cu.ko 192.168.1.247
[root@Xtramus6410 /opt]# ls
8192cu.ko
[root@Xtramus6410 /opt]# insmod 8192cu.ko
rtw driver version=v3.4.2_3727.20120404
Build at: Jun 15 2012 15:21:30
register rtw_netdev_ops to netdev_ops
CHIP TYPE: RTL8188C_8192C
usb_endpoint_descriptor(0):
bLength=7
bDescriptorType=5
bEndpointAddress=81
wMaxPacketSize=40
bInterval=0
RT_usb_endpoint_is_bulk_in = 1
usb_endpoint_descriptor(1):
bLength=7
bDescriptorType=5
bEndpointAddress=2
wMaxPacketSize=40
bInterval=0
RT_usb_endpoint_is_bulk_out = 2
usb_endpoint_descriptor(2):
bLength=7
bDescriptorType=5
bEndpointAddress=3
wMaxPacketSize=40
bInterval=0
RT_usb_endpoint_is_bulk_out = 3
usb_endpoint_descriptor(3):
bLength=7
bDescriptorType=5
bEndpointAddress=84
wMaxPacketSize=40
bInterval=1
RT_usb_endpoint_is_int_in = 4, Interval = 1
nr_endpoint=4, in_num=2, out_num=2
NON USB_SPEED_HIGH
Chip Version ID: VERSION_NORMAL_TSMC_CHIP_88C.
RF_Type is 3!!
EEPROM type is E-FUSE
====> ReadAdapterInfo8192C
Boot from EFUSE, Autoload OK !
EEPROMVID = 0x0bda
EEPROMPID = 0x8176
EEPROMCustomerID : 0x00
EEPROMSubCustomerID: 0x00
RT_CustomerID: 0x00
_ReadMACAddress MAC Address from EFUSE = 08:10:76:34:80:f5
EEPROMRegulatory = 0x0
_ReadBoardType(0)
BT Coexistance = disable
RT_ChannelPlan: 0x02
_ReadPSSetting...bHWPwrPindetect(0)-bHWPowerdown(0) ,bSupportRemoteWakeup(0)
### PS params=> power_mgnt(0),usbss_enable(0) ###
### AntDivCfg(0)
readAdapterInfo_8192CU(): REPLACEMENT = 1
<==== ReadAdapterInfo8192C in 2170 ms
rtw_macaddr_cfg MAC Address = 08:10:76:34:80:f5
MAC Address from pnetdev->dev_addr= 08:10:76:34:80:f5
bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0
usbcore: registered new interface driver rtl8192cu
[root@Xtramus6410 /opt]#
[root@Xtramus6410 /opt]# ifconfig 仍然看不到usb wifi网卡
eth0 Link encap:Ethernet HWaddr 00:22:12:34:56:90
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:57 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6144 (6.0 KiB) TX bytes:1338 (1.3 KiB)
Interrupt:108 Base address:0x8000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
但是可以从/proc/net目录下可以看到wlan0
[root@Xtramus6410 net]# cat wireless
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
wlan0: 0000 0. 0. 0. 0 0 0 0 0 0
[root@Xtramus6410 net]# pwd
/proc/net
[root@Xtramus6410 net]
为能够是usb wifi能够正常访问网络,还需一些应用软件:iwconfig iwlist 等
Fig1.4 usb wifi在/dev/目录下存在的设备节点1-1
3.wifi应用软件的编译及使用
3.1
同上在解压出来的驱动包有wire tools具体如果应用也有相关文档说明,进入解压后目录找到Makefile文件,同样需要修改一些编译选项
[root@localhost wireless_tools.30.rtl]# pwd
/home/s3c6410/s3c6410/driver/RTL8188C_8192C_8192D_USB_linux_v3.4.2_3727.20120404/wireless_tools/wireless_tools.30.rtl
[root@localhost wireless_tools.30.rtl]#
Fig1.5 修改编译条件
Fig1.6成功编译后将获得绿色显示的工具
图1.6工具在本次中未能够使用到此处略去,日后需要将补上…
3.2
进入以下目录,同样需修改Makefile文件进行交叉编译得到工具wpa_supplicant
[root@localhost wpa_supplicant]# pwd
/home/s3c6410/s3c6410/driver/RTL8188C_8192C_8192D_USB_linux_v3.4.2_3727.20120404/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/wpa_supplicant
[root@localhost wpa_supplicant]#
Fig1.7 将CC改为arm-linux-gcc
在该目录执行make后将得到下图绿色显示的工具,为能够正常运行,先静态配置wlan0的ip(动态方式后续更新)
Fig1.8 成功编译wpa_supplicant 目录工具
配置wlan0 ip地址:
[root@Xtramus6410 /opt]# ifconfg
-/bin/sh: ifconfg: not found
[root@Xtramus6410 /opt]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:22:12:34:56:90
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:231 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20298 (19.8 KiB) TX bytes:1338 (1.3 KiB)
Interrupt:108 Base address:0x8000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
[root@Xtramus6410 /opt]# ifconfig wlan0 192.168.1.22
+871x_drv - drv_open, bup=0
===> FirmwareDownload91C() fw:Rtl819XFwImageArray_TSMC
FirmwareDownload92C accquire FW from embedded image
fw_ver=v80, fw_subver=0, sig=0x88c0
fw download ok!
Set RF Chip ID to RF_6052 and RF type to 1T1R.
IOL rtl8192c_IOL_exec_cmds_sync complete in 30ms
IOL rtl8192c_IOL_exec_cmds_sync complete in 30ms
IOL rtl8192c_IOL_exec_cmds_sync complete in 70ms
IOL rtl8192c_IOL_exec_cmds_sync complete in 70ms
IOL rtl8192c_IOL_exec_cmds_sync complete in 250ms
IQK:Start!!!
Path A IQK Success!!
Path A IQK Success!!
IQK: final_candidate is 0
IQK: RegE94=103 RegE9C=13 RegEA4=fe RegEAC=2 RegEB4=0 RegEBC=0 RegEC4=0 RegECC=0
Path A IQ Calibration Success !
pdmpriv->TxPowerTrackControl = 1
MAC Address from REG_MACID = 08:10:76:34:80:f5
rtl8192cu_hal_init in 1760ms
MAC Address = 08:10:76:34:80:f5
-871x_drv - drv_open, bup=1
[root@Xtramus6410 /opt]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:22:12:34:56:90
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1000 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:71294 (69.6 KiB) TX bytes:1500 (1.4 KiB)
Interrupt:108 Base address:0x8000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 08:10:76:34:80:F5
inet addr:192.168.1.22 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING 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)
[root@Xtramus6410 /opt]#
通过ifconfig后比先前看到的多出wlan0,可见目前已经将wlan0激活。但仍需要要一些应以偶那个设置方能访问网络。
在etc目录下创建wpa_supplicant.conf配置文件,文件内容如下:
# WPA-PSK/TKIP
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="XTRAMUS"
scan_ssid=1
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
pairwise=TKIP CCMP
group=CCMP TKIP WEP104 WEP40
psk="AABBCCDDEF"
}
ssid一个无线局域网分为几个需要不同身份验证的子网络,每一个子网络都需要独立的身份验证,只有通过身份验证的用户才可以进入相应的子网络,防止未被授权的用户进入本网络.
key_mgmt:加密方式 wpa等
psk 我理解成密钥,如理解错在更新
配置文件有了,接下来执行
[root@Xtramus6410 /opt]# wpa_supplicant -Dwext -iwlan0 -c /etc/wpa_supplicant.conf -dd &
结果出来一长串的信息,以后慢慢了解!
root@Xtramus6410 /opt]# wpa_supplicant v0.8.x
random: Trying to read entropy from /dev/random
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
ctrl_interface='/var/run/wpa_supplicant'
Line: 3 - start of a new network block
ssid - hexdump_ascii(len=7):
58 54 52 41 4d 55 53 XTRAMUS
scan_ssid=1 (0x1)
key_mgmt: 0xf
pairwise: 0x18
group: 0x1e
PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED][rtw_wx_set_pmkid] IW_PMKSA_FLUSH!
set_mode = IW_MODE_INFRA
Priority group 0
id=0 ssid='XTRAMUS'
rfkill: Cannot open RFKILL control device
WEXT: RFKILL status not available
SIOCGI[rtw_wx_set_pmkid] IW_PMKSA_FLUSH!
WRANGE: WE(compiled)=22 WE(source)=16 enc_capa=0xf
capabilities: key_mgmt 0xf enc 0xf flags 0x0
ioctl[SIOCSIWAP]: Operation not permitted
WEXT: Failed to set bogus BSSID/SSID to disconnect
netlink: Operstate: linkmode=1, operstate=5
wlan0: Own MAC address: 08:10:76:34:80:f5
wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0
wpa_driver_wext_set_countermeasures
wlan0: RSN: flushing PMKID list in the driver
wlan0: Setting scan request: 0 sec 100000 usec
WPS: Set UUID for interface wlan0
WPS: UUID based on MAC address - hexdump(len=16): a2 79 1c ac 4c d4 51 20 bf f3 72 84 51 89 6d 8e
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
EAPOL: Supplicant port status: Unauthorized
EAPOL: Supplicant port status: Unauthorized
wlan0: Added interface wlan0
RTM_NEWLINK: operstate=0 ifi_flags=0x1043 ([UP][RUNNIW_SCAN_THIS_ESSID, ssid=XTRAMUS, len=7
ING])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
Wireless event: cmd=0x8b06 len=8
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
wlan0: State: DISCONNECTED -> SCANNING
Scan SSID - hexdump_ascii(len=7):
58 54 52 41 4d 55 53 XTRAMUS
wlan0: Starting AP scan for specific SSID(s)
ioctl[SIOCSIWMLME]: Cannot allocate memory
Scan requested (ret=0) - scan timeout 5 seconds
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
survey done event(6b)
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
Wireless event: cmd=0x8b19 len=8
wlan0: Event 3 received on interface wlan0
Scan results did not fit - trying larger buffer (8192 bytes)
Received 5528 bytes of scan results (30 BSSes)
wlan0: BSS: Start scan result update 1
wlan0: BSS: Add new id 0 BSSID 00:26:5a:30:5a:5e SSID 'DIR-615(F1)'
wlan0: BSS: Add new id 1 BSSID 5c:d9:98:78:1d:f8 SSID 'dlink'
wlan0: BSS: Add new id 2 BSSID 00:22:b0:49:06:e8 SSID 'alpha-guest'
wlan0: BSS: Add new id 3 BSSID ec:6c:9f:04:05:6c SSID 'XTRAMUS'
wlan0: BSS: Add new id 4 BSSID 5c:d9:98:03:0b:b8 SSID 'dlink800'
wlan0: BSS: Add new id 5 BSSID fc:75:16:c6:e2:de SSID 'DIR-645'
wlan0: BSS: Add new id 6 BSSID 00:26:5a:b1:3c:24 SSID 'DI-524M(B1)'
wlan0: BSS: Add new id 7 BSSID 00:13:46:fd:b4:f8 SSID '3200ap'
wlan0: BSS: Add new id 8 BSSID f0:7d:68:82:87:c4 SSID '616'
wlan0: BSS: Add new id 9 BSSID cc:b2:55:e2:e7:44 SSID '8004W_4'
wlan0: BSS: Add new id 10 BSSID 00:15:e9:c4:44:27 SSID 'Oi_Velox_WiFi_4426'
wlan0: BSS: Add new id 11 BSSID 5c:d9:98:03:0b:c8 SSID ''
wlan0: BSS: Add new id 12 BSSID 84:c9:b2:e1:12:a6 SSID 'dlink_DIR-506L'
wlan0: BSS: Add new id 13 BSSID 00:d0:41:c4:d8:3e SSID 'Allen_Mobile_AP'
wlan0: BSS: Add new id 14 BSSID 00:22:b0:c7:6e:91 SSID 'dlink-csdd'
wlan0: BSS: Add new id 15 BSSID 00:24:01:85:b3:f1 SSID 'D-Link'
wlan0: BSS: Add new id 16 BSSID 00:24:01:c4:c3:70 SSID 'dlink'
wlan0: BSS: Add new id 17 BSSID 00:90:5c:22:22:22 SSID 'dlink444'
wlan0: BSS: Add new id 18 BSSID b8:a3:86:52:07:d8 SSID 'DAP-1360'
wlan0: BSS: Add new id 19 BSSID 00:11:22:33:44:77 SSID 'Lege_Test'
wlan0: BSS: Add new id 20 BSSID 1c:af:f7:be:81:c6 SSID 'D-Link_DIR-600M'
wlan0: BSS: Add new id 21 BSSID 14:d6:4d:e7:a3:0c SSID 'DIR-600N'
wlan0: BSS: Add new id 22 BSSID 1c:af:f7:99:88:20 SSID 'BBB'
wlan0: BSS: Add new id 23 BSSID 00:1e:e3:00:ac:45 SSID 'Dlink_0'
wlan0: BSS: Add new id 24 BSSID 14:d6:4d:24:2b:be SSID 'dlink'
wlan0: BSS: Add new id 25 BSSID 00:17:7b:0e:f9:28 SSID 'Azalea'
wlan0: BSS: Add new id 26 BSSID 1c:7e:e5:94:90:9e SSID 'dlink'
wlan0: BSS: Add new id 27 BSSID 00:10:18:00:00:01 SSID 'D-Link DSL-2870B'
wlan0: BSS: Add new id 28 BSSID 00:1e:e3:15:ba:a9 SSID 'dlink'
wlan0: BSS: Add new id 29 BSSID cc:b2:55:e2:e7:42 SSID '8004W_2'
Add randomness: count=1 entropy=0
Add randomness: count=2 entropy=1
Add randomness: count=3 entropy=2
Add randomness: count=4 entropy=3
Add randomness: count=5 entropy=4
Add randomness: count=6 entropy=5
Add randomness: count=7 entropy=6
Add randomness: count=8 entropy=7
Add randomness: count=9 entropy=8
Add randomness: count=10 entropy=9
wlan0: New scan results available
wlan0: Selecting BSS from priority group 0
wlan0: 0: 00:26:5a:30:5a:5e ssid='DIR-615(F1)' wpa_ie_len=0 rsn_ie_len=20 caps=0x11 level=50
wlan0: skip - SSID mismatch
wlan0: 1: 5c:d9:98:78:1d:f8 ssid='dlink' wpa_ie_len=0 rsn_ie_len=20 caps=0x11 level=43 wps
wlan0: skip - SSID mismatch
wlan0: 2: 00:22:b0:49:06:e8 ssid='alpha-guest' wpa_ie_len=26 rsn_ie_len=0 caps=0x11 level=42
wlan0: skip - SSID mismatch
wlan0: 3: ec:6c:9f:04:05:6c ssid='XTRAMUS' wpa_ie_len=0 rsn_ie_len=20 caps=0x11 level=99
wlan0: selected based on RSN IE
wlan0: selected BSS ec:6c:9f:04:05:6c ssid='XTRAMUS'
wlan0: Request association: reassociate: 0 selected: ec:6c:9f:04:05:6c bssid: 00:00:00:00:00:00 pending: 00:00:00:00:00:00 wpa_state: SCANNING
wlan0: Trying to associate with ec:6c:9f:04:05:6c (SSID='XTRAMUS' freq=2472 MHz)
wlan0: Cancelling scan request
wlan0: WPA: clearing own WPA/RSN IE
wlan0: Automatic auth_alg selection: 0x1
wlan0: RSN: using IEEE 802.11i/D9.0
wlan0: WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 2
wlan0: WPA: clearing AP WPA IE
WPA: set AP RSN IE - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
wlan0: Wwpa_set_auth_algs, AUTH_ALG_OPEN_SYSTEM
set_mode = IW_MODE_INFRA
wpa_ie(length:22):
0x30 0x14 0x01 0x00 0x00 0x0f 0xac 0x04
0x01 0x00 0x00 0x0f 0xac 0x04 0x01 0x00
0x00 0x0f 0xac 0x02 0x00 0x00 0xea 0xce
=>rtw_wx_set_essid
ssid=XTRAMUS, len=7
Set SSID under fw_state=0x00000008
[by_bssid:0][assoc_ssid:XTRAMUS][to_roaming:0] new candidate: XTRAMUS(ec:6c:9f:04:05:6c) rssi:-48
rtw_select_and_join_from_scanned_queue: candidate: XTRAMUS(ec:6c:9f:04:05:6c)
rtw_restructure_ht_ie IEEE80211_HT_CAP_MAX_AMSDU is set
link to Ralink AP
<=rtw_wx_set_essid, ret 0
Set BSSID under fw_state=0x00000088
set ch/bw before connected
PA: using GTK CCMP
wlan0: WPA: using PTK CCMP
wlan0: WPA: using KEY_MGMT WPA-PSK
WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
wlan0: No keys have been configured - skip key clearing
wlan0: State: SCANNING -> ASSOCIATING
wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
wpa_driver_wext_associate
wpa_driver_wext_set_drop_unencrypted
wpa_driver_wext_set_psk
wlan0: Setting authentication timeout: 10 sec 0 usec
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP fail=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portControl=Auto
EAPOL: Supplicant port status: Unauthorized
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
Wireless event: cmd=0x8b06 len=8
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
Wireless event: cmd=0x8b04 len=12
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
Wireless event: cmd=0x8b1a len=15
link to Ralink AP
issue_deauth to ec:6c:9f:04:05:6c
OnAuthClient
network.SupportedRates[0]=82
network.SupportedRates[1]=84
network.SupportedRates[2]=8B
network.SupportedRates[3]=96
network.SupportedRates[4]=12
network.SupportedRates[5]=24
network.SupportedRates[6]=48
network.SupportedRates[7]=6C
network.SupportedRates[8]=0C
network.SupportedRates[9]=18
network.SupportedRates[10]=30
network.SupportedRates[11]=60
bssrate_len = 12
OnAssocRsp
report_join_res(2)
rtw_joinbss_update_network
+rtw_update_ht_cap()
rtw_joinbss_update_stainfo
HW_VAR_BASIC_RATE: BrateCfg(0x15d)
RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])
RTM_NEWLINK, IWMM(0): 0, a42b
FLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on WMM(1): 0, a44f
WMM(2): 0, 5e4322
WMM(3): 0, 2f3222
[HW_VAR_ACM_CTRL] Write 0x0
HTOnAssocRsp
interface wlan0
Wireless event: cmd=0x8b15 len=20
Wireless event: new AP: ec:6c:9f:04:05:6c
wlan0: Event 0 received on interface wlan0
wlan0: State: ASSOCIATING -> ASSOCIATED
wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)
netlink: Operstate: linkmode=-1, operstate=5
wlan0: Associated to a new BSS: BSSID=ec:6c:9f:04:05:6c
Add randomness: count=11 entropy=10
wlan0: No keys have been configured - skip key clearing
wlan0: Associated with ec:6c:9f:04:05:6c
wlan0: WPA: Association event - clear replay counter
wlan0: WPA: Clear old PTK
EAPOL: External notification - portEnabled=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portValid=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - EAP success=0
EAPOL: Supplicant port status: Unauthorized
EAPOL: External notification - portEnabled=1
EAPOL: SUPP_PAE entering state CONNECTING
EAPOL: enable timer tick
EAPOL: SUPP_BE entering state IDLE
wlan0: Setting authentication timeout: 10 sec 0 usec
wlan0: Cancelling scan request
RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlupdate raid entry, mask=0xfffff, arg=0x80
an0
rtl8192c_set_FwJoinBssReport_cmd mstatus(1)
SetFwRsvdPagePkt
Set RSVD page location to Fw.
=>mlmeext_joinbss_event_callback
wlan0: RX EAPOL from ec:6c:9f:04:05:6c
RX EAPOL - hexdump(len=99): 01 03 00 5f 02 00 8a 00 10 00 00 0OnAction_back
OnAction_back, action=0
issue_action_BA, category=3, action=1, status=0
0 00 00 00 00 01 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
wlan0: Setting authentication timeout: 10 sec 0 usec
wlan0: IEEE 802.1X RX: version=1 type=3 length=95
wlan0: EAPOL-Key type=2
wlan0: key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack)
wlan0: key_length=16 key_data_length=0
replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 01
key_nonce - hexdump(len=32): 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82
key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00
key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
key_mic - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
WPA: RX EAPOL-Key - hexdump(len=99): 01 03 00 5f 02 00 8a 00 10 00 00 00 00 00 00 00 01 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
wlan0: State: ASSOCIATED -> 4WAY_HANDSHAKE
wlan0: WPA: RX message 1 of 4-Way Handshake from ec:6c:9f:04:05:6c (ver=2)
RSN: msg 1/4 key data - hexdump(len=0):
Get randomness: len=32 entropy=11
WPA: Renewed SNonce - hexdump(len=32): 1e 32 39 56 ff e3 d0 4d 07 b8 70 d4 03 45 f7 23 88 d2 5e a6 bf b9 24 bd 0f d7 19 74 92 d6 38 bd
WPA: PTK derivation - A1=08:10:76:34:80:f5 A2=ec:6c:9f:04:05:6c
WPA: Nonce1 - hexdump(len=32): 1e 32 39 56 ff e3 d0 4d 07 b8 70 d4 03 45 f7 23 88 d2 5e a6 bf b9 24 bd 0f d7 19 74 92 d6 38 bd
WPA: Nonce2 - hexdump(len=32): 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82
WPA: PMK - hexdump(len=32): [REMOVED]
WPA: PTK - hexdump(len=48): [REMOVED]
WPA: WPA IE for msg 2/4 - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
WPA: Replay Counter - hexdump(len=8): 00 00 00 00 00 00 00 01
wlan0: WPA: Sending EAPOL-Key 2/4
WPA: KCK - hexdump(len=16): [REMOVED]
WPA: Derived Key MIC - hexdump(len=16): 64 77 cb e5 5a 43 f8 c8 31 da 5d 83 d6 b8 59 9e
WPA: TX EAPOL-Key - hexdump(len=121): 01 03 00 75 02 01 0a 00 00 00 00 00 00 00 00 00 01 1e 32 39 56 ff e3 d0 4d 07 b8 70 d4 03 45 f7 23 88 d2 5e a6 bf b9 24 bd 0f d7 19 74 92 d6 38 bd 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64 77 cb e5 5a 43 f8 c8 31 da 5d 83 d6 b8 59 9e 00 16 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
wlan0: RX EAPOL from ec:6c:9f:04:05:6c
RX EAPOL - hexdump(len=155): 01 03 00 97 02 13 ca 00 10 00 00 00 00 00 00 00 02 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 a8 3c 63 b5 8e a1 56 90 3f 19 3b a9 9e 96 b7 00 38 eb f6 36 b0 1c 3e a8 f5 f0 34 fe d8 38 80 cf 25 0c 74 b7 60 65 41 fb 75 70 d8 65 c9 4b d4 dc e4 b5 b0 55 cc 2f de 59 da d8 7c 43 aa a5 bc 44 02 6a db 9f 38 2f cd 48 95
wlan0: IEEE 802.1X RX: version=1 type=3 length=151
wlan0: EAPOL-Key type=2
wlan0: key_info 0x13ca (ver=2 keyidx=0 rsvd=0 Pairwise Install Ack MIC Secure Encr)
wlan0: key_length=16 key_data_length=56
replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 02
key_nonce - hexdump(len=32): 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82
key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
key_rsc - hexdump(len=8): 58 03 00 00 00 00 00 00
key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
key_mic - hexdump(len=16): 70 a8 3c 63 b5 8e a1 56 90 3f 19 3b a9 9e 96 b7
WPA
~~~~stastakey:unicastkey
~~~~stastakey:groupkey
==> rtw_set_key algorithm(4),keyid(2),key_mask(4)
: RX EAPOL-Key - hexdump(len=155): 01 03 00 97 02 13 ca 00 10 00 00 00 00 00 00 00 02 47 55 75 73 1d bf 9d 29 4e ea 6d fd d8 c2 8c 19 f5 e4 0d f3 23 fc 9c 4e e0 bb 53 3f 82 c9 18 82 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 a8 3c 63 b5 8e a1 56 90 3f 19 3b a9 9e 96 b7 00 38 eb f6 36 b0 1c 3e a8 f5 f0 34 fe d8 38 80 cf 25 0c 74 b7 60 65 41 fb 75 70 d8 65 c9 4b d4 dc e4 b5 b0 55 cc 2f de 59 da d8 7c 43 aa a5 bc 44 02 6a db 9f 38 2f cd 48 95
RSN: encrypted key data - hexdump(len=56): eb f6 36 b0 1c 3e a8 f5 f0 34 fe d8 38 80 cf 25 0c 74 b7 60 65 41 fb 75 70 d8 65 c9 4b d4 dc e4 b5 b0 55 cc 2f de 59 da d8 7c 43 aa a5 bc 44 02 6a db 9f 38 2f cd 48 95
WPA: decrypted EAPOL-Key key data - hexdump(len=48): [REMOVED]
wlan0: State: 4WAY_HANDSHAKE -> 4WAY_HANDSHAKE
wlan0: WPA: RX message 3 of 4-Way Handshake from ec:6c:9f:04:05:6c (ver=2)
WPA: IE KeyData - hexdump(len=48): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00 dd 16 00 0f ac 01 02 00 f2 e1 ec 75 73 c2 9c 43 3a 34 a7 32 88 fc 8b 96 dd 00
WPA: RSN IE in EAPOL-Key - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00
WPA: GTK in EAPOL-Key - hexdump(len=24): [REMOVED]
wlan0: WPA: Sending EAPOL-Key 4/4
WPA: KCK - hexdump(len=16): [REMOVED]
WPA: Derived Key MIC - hexdump(len=16): 40 36 1e a5 c5 00 e9 d9 82 45 08 b3 85 9a 20 61
WPA: TX EAPOL-Key - hexdump(len=99): 01 03 00 5f 02 03 0a 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 36 1e a5 c5 00 e9 d9 82 45 08 b3 85 9a 20 61 00 00
wlan0: WPA: Installing PTK to the driver
wpa_driver_wext_set_key: alg=3 key_idx=0 set_tx=1 seq_len=6 key_len=16
EAPOL: External notification - portValid=1
wlan0: State: 4WAY_HANDSHAKE -> GROUP_HANDSHAKE
RSN: received GTK in pairwise handshake - hexdump(len=18): [REMOVED]
WPA: Group Key - hexdump(len=16): [REMOVED]
wlan0: WPA: Installing GTK to the driver (keyidx=2 tx=0 len=16)
WPA: RSC - hexdump(len=6): 58 03 00 00 00 00
wpa_driver_wext_set_key: alg=3 key_idx=2 set_tx=0 seq_len=6 key_len=16
wlan0: WPA: Key negotiation completed with ec:6c:9f:04:05:6c [PTK=CCMP GTK=CCMP]
wlan0: Cancelling authentication timeout
wlan0: State: GROUP_HANDSHAKE -> COMPLETED
wlan0: CTRL-EVENT-CONNECTED - Connection to ec:6c:9f:04:05:6c completed (auth) [id=0 id_str=]
wpa_driver_wext_set_operstate: operstate 0->1 (UP)
netlink: Operstate: linkmode=-1, operstate=6
EAPOL: External notification - portValid=1
EAPOL: External notification - EAP success=1
EAPOL: SUPP_PAE entering state AUTHENTICATING
EAPOL: SUPP_BE entering state SUCCESS
EAP: EAP entering state DISABLED
EAPOL: SUPP_PAE entering state AUTHENTICATED
EAPOL: Supplicant port status: Authorized
EAPOL: SUPP_BE entering state IDLE
EAPOL authentication completed successfully
RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
wlan0: Event 5 received on interface wlan0
EAPOL: startWhen --> 0
EAPOL: disable timer tick
rtl8192c_dm_RF_Saving(): RF_Save
[root@Xtramus6410 /opt]#
接下来我们ping下路由器,零点几毫秒,有这么快的响应么?错了,忘记关掉eth0,将eth0网卡关闭,它的网段也是192.168.1.x或改为其他网段。
[root@Xtramus6410 /opt]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=8.048 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=0.740 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=0.561 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=0.746 ms
^C
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.561/2.523/8.048 ms
[root@Xtramus6410 /opt]#
[root@Xtramus6410 /opt]#
关掉eth0如果不放心直接把网线拔掉。在ping网关,usb wifi达到几十毫秒
[root@Xtramus6410 /opt]# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 08:10:76:34:80:F5
inet addr:192.168.1.22 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:50 errors:0 dropped:50 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6416 (6.2 KiB) TX bytes:288 (288.0 B)
[root@Xtramus6410 /opt]# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=20.931 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=6.564 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=37.729 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=6.867 ms
64 bytes from 192.168.1.1: seq=4 ttl=64 time=19.028 ms
64 bytes from 192.168.1.1: seq=5 ttl=64 time=34.159 ms
64 bytes from 192.168.1.1: seq=6 ttl=64 time=8.358 ms
^C
--- 192.168.1.1 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 6.564/19.090/37.729 ms
[root@Xtramus6410 /opt]# 接着再ping外网,啥不通?网关忘了
[root@Xtramus6410 /opt]# ping www.baidu.com
PING www.baidu.com (119.75.218.77): 56 data bytes
ping: sendto: Network is unreachable
[root@Xtramus6410 /opt]# ping www.baidu.com
PING www.baidu.com (119.75.217.56): 56 data bytes
ping: sendto: Network is unreachable
[root@Xtramus6410 /opt]# ping www.sina.com
PING www.sina.com (221.236.31.140): 56 data bytes
ping: sendto: Network is unreachable
[root@Xtramus6410 /opt]#
[root@Xtramus6410 /opt]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
[root@Xtramus6410 /opt]#
[root@Xtramus6410 /opt]# route add default gw 192.168.1.1
[root@Xtramus6410 /opt]# ping www.baidu.com
PING www.baidu.com (119.75.218.77): 56 data bytes
64 bytes from 119.75.218.77: seq=0 ttl=56 time=54.385 ms
64 bytes from 119.75.218.77: seq=1 ttl=56 time=56.016 ms
64 bytes from 119.75.218.77: seq=2 ttl=56 time=47.137 ms
64 bytes from 119.75.218.77: seq=3 ttl=56 time=45.277 ms
--- www.baidu.com ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 45.277/50.703/56.016 ms
[root@Xtramus6410 /opt]#
大功告成,通过usb wifi可以正常访问外网
题外话:因为ping的是域名地址www.baidu.com需要进行DNS转化因此在etc目录下需要有个resov.conf的文件,文件内容如下:
nameserver 192.168.1.1
nameserver 8.8.8.8