caiwang / board2ihost

0 stars 0 forks source link

rtl8192cu无线网卡测试 - mainstream kernel driver #74

Open unissoft-bj opened 9 years ago

unissoft-bj commented 9 years ago

用rt2x00方法,编译kernel自带的rtl8192cu driver

参考: 注意,与 冲突,需要在wireless下的Kconfig和Makefile中把相关的内容注释掉,否则make的时候报错

choice范围之外;循环引用

insmod

root@ihost:~# cat ins_rtl8192cu.sh

!/bin/bash

insmod /root/rtl8192cu.k3036/rtlwifi.ko insmod /root/rtl8192cu.k3036/rtl8192c-common.ko insmod /root/rtl8192cu.k3036/rtl8192cu.ko root@ihost:~#

root@ihost:~# lsmod Module Size Used by rtl8192cu 91078 0 rtl8192c_common 53680 1 rtl8192cu rtlwifi 67241 1 rtl8192cu

root@ihost:~# usb-devices T: Bus=02 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0bda ProdID=8178 Rev=02.00 S: Manufacturer=Realtek S: Product=802.11n WLAN Adapter S: SerialNumber=00e04c000001 C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) root@ihost:~#

fix

http://www.acmesystems.it/dlink_wifi

root@ihost:/sys/bus/usb/drivers/rtl8192cu# ls -l total 0 --w------- 1 root root 4096 May 10 17:59 bind lrwxrwxrwx 1 root root 0 May 10 17:59 module -> ../../../../module/rtl8192cu --w------- 1 root root 4096 May 10 17:59 new_id --w------- 1 root root 4096 May 10 17:59 remove_id --w------- 1 root root 4096 May 10 17:58 uevent --w------- 1 root root 4096 May 10 17:59 unbind root@ihost:/sys/bus/usb/drivers/rtl8192cu# cat new_id cat: new_id: Permission denied root@ihost:/sys/bus/usb/drivers/rtl8192cu#

root@ihost:/sys/bus/usb/drivers/rtl8192cu# echo 0bda 8178 > /sys/bus/usb/drivers/rtl8192cu/new_id rock@ihost:~$

root@ihost:~# usb-devices T: Bus=02 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0bda ProdID=8178 Rev=02.00

执行不成功;dmesg会报大量信息 [ 4353.321378] Unable to handle kernel NULL pointer dereference at virtual address 0000000c [ 4353.329801] pgd = dc424000 [ 4353.333524] [0000000c] pgd=7d160831, pte=00000000, *ppte=00000000 [ 4353.340056] Internal error: Oops: 17 [#1] PREEMPT SMP [ 4353.345192] CPU: 1 Not tainted (3.0.36+ #33) [ 4353.349899] PC is at rtl_usb_probe+0x174/0x7ac [rtlwifi] [ 4353.355304] LR is at rtl_usb_probe+0x10c/0x7ac [rtlwifi]

检查kernel driver源码,没有定义 0bda:8178

root@ihost:/home/sd/linux-rockchip/drivers/net/wireless/rtlwifi/rtl8192cu# nano sw.c

    /****** 8192CU ********/
    /* 8191cu 1*2 */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)},
    /* 8192cu 2*2 */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)},
    /* 8192CE-VAU USB minCard */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)},
   /****** 8192CU ********/               
    /* 8191cu 1*2 */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8177, rtl92cu_hal_cfg)},
    /* 8192cu 2*2 */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817b, rtl92cu_hal_cfg)},
    /* 8192CE-VAU USB minCard */
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x817c, rtl92cu_hal_cfg)},
    /* 8192CU*/                 
    {RTL_USB_DEVICE(USB_VENDER_ID_REALTEK, 0x8178, rtl92cu_hal_cfg)},

重新编译驱动

root@ihost:/usr/src/linux-rockchip# make modules CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: `include/generated/mach-types.h' is up to date. CALL scripts/checksyscalls.sh CC [M] drivers/net/wireless/rtlwifi/rtl8192cu/sw.o LD [M] drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.o Building modules, stage 2. MODPOST 277 modules CC drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.mod.o LD [M] drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.ko root@ihost:/usr/src/linux-rockchip# rm -rf modules root@ihost:/usr/src/linux-rockchip# mkdir modules root@ihost:/usr/src/linux-rockchip# make INSTALL_MOD_PATH=./modules modules_install

insmod root@ihost:~# cat ins_rtl8192cu.sh

!/bin/bash

insmod /root/rtl8192cu.new.k3036/rtlwifi.ko insmod /root/rtl8192cu.new.k3036/rtl8192c-common.ko insmod /root/rtl8192cu.new.k3036/rtl8192cu.ko root@ihost:~#

如果带着网卡执行 root@ihost:~# bash ins_rtl8192cu.sh

命令会卡住,ctrl c退不出来

如果不带着网卡执行bash ins_rtl8192cu.sh ,正常,lsmod正常 但是usb-devices命令会卡住

结论

kernel 3.0.36源码中的driver不能驱动0bda:8178芯片