OpenWRT添加无线USB网卡

说明

要完成网线网卡的驱动需要在内核中添加驱动,同时还需要将固件放入rootfs中正确的位置,如果需要固件的话。


内核驱动添加

因为内核中对常规的USB网卡均支持,所以直接添加即可, 例如下面是对9170的支持:

OpenWRT添加无线USB网卡_第1张图片


Firmware添加

在menuconfig中直接添加:

OpenWRT添加无线USB网卡_第2张图片

启动确认

启动后,我们需要等待rootfs完成后再插入, 这样子可以比较容易看到log, 对于TPLink的其中一款,对应的log如下:

[ 1015.718981] usb 1-1.2.4: new high-speed USB device number 9 using ci_hdrc
[ 1015.978998] usb 1-1.2.4: reset high-speed USB device number 9 using ci_hdrc
[ 1016.136841] usb 1-1.2.4: driver   API: 1.9.7 2012-12-15 [1-1]
[ 1016.145314] usb 1-1.2.4: firmware API: 1.9.6 2012-07-07
[ 1016.497852] ath: EEPROM regdomain: 0x809c
[ 1016.497905] ath: EEPROM indicates we should expect a country code
[ 1016.497942] ath: doing EEPROM country->regdmn map search
[ 1016.497976] ath: country maps to regdmn code: 0x52
[ 1016.498010] ath: Country alpha2 being used: CN
[ 1016.498040] ath: Regpair used: 0x52
[ 1016.500103] ieee80211 phy3: Selected rate control algorithm 'minstrel_ht'
[ 1016.510419] input: phy3 WPS Button as /devices/soc0/soc.0/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4:1.0/ieee80211/phy3/input4
[ 1016.526387] evbug: Connected device: input4 (phy3 WPS Button at ieee80211/phy3/input0)
[ 1016.526430] usb 1-1.2.4: Atheros AR9170 is registered as 'phy3'

从log看,加载了对应的固件。配置country code。这个FW位于:

root@(none):/# ls /lib/firmware/carl9170-1.fw -lu
-rw-r--r--    1 root     root         13388 Feb  1 02:53 /lib/firmware/carl9170-1.fw
root@(none):/# 

因为这个网卡具备WPS功能,有一个按键,所以有一个input设备。

对于另外一个USB网卡:

[ 1022.368886] usb 1-1.2.1: new high-speed USB device number 10 using ci_hdrc
[ 1022.608872] usb 1-1.2.1: reset high-speed USB device number 10 using ci_hdrc
[ 1022.740356] ieee80211 phy4: rt2x00_set_rt: Info - RT chipset 3070, rev 0201 detected
[ 1022.804614] ieee80211 phy4: rt2x00_set_rf: Info - RF chipset 0005 detected
[ 1022.813948] ieee80211 phy4: Selected rate control algorithm 'minstrel_ht'


然后就可以看到对应的网卡设备了:

wlan0     Link encap:Ethernet  HWaddr 7c:dd:90:b2:73:b1  
          BROADCAST 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)

wlan1     Link encap:Ethernet  HWaddr 94:0c:6d:7c:12:f6  
          BROADCAST 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)

网卡功能查询

使用USB网卡来做AP那么就需要确定时候具备AP功能

使用iw list命令, 然后找到对应的modes:

Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * P2P-client
                 * P2P-GO

另外一个网卡具备的modes:

       Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * WDS
                 * monitor
因此可以确定两个网卡均具备AP模式, 还有一个具备monitor模式。生成了Network Interface后,接下来我们将完成AP功能。

你可能感兴趣的:(EmbeddedSystem,工业路由器OpenWRT实践)