全志A33-USB虚拟网卡的配置与使用
開發環境
開發板:A33-Vstar
開發板系統:Linux
USB網卡:三星S4、華為P8(USB共享網絡)
------------------------------------------------
?
1. 配置內核
運行:make menuconfig ARCH=arm
依次進入: Device Drivers --->Network device support ---> USB Network Adapters
將以下三項編譯進內核:
Multi-purpose USB Networking Framework [ m--y ]
CDC Ethernet support (smart devices such as cable modems) [ m--y ]
Host for RNDIS and ActiveSync devices (EXPERIMENTAL) [ n--y ]
注:當將Multi-purpose USB Networking Framework 和 Host for RNDIS and ActiveSync devices (EXPERIMENTAL) 同時選y時,CDC Ethernet support (smart devices such as cable modems) 選項將自動選為y。
?
1)Multi-purpose USB Networking Framework
即usbnet,對應模塊為usbnet.ko。
在linux-3.4/drivers/net/usb/Kconfig中描述如下:
This driver supports several kinds of network links over USB,
with "minidrivers" built around a common network driver core
that supports deep queues for efficient transfers. (This gives
better performance with small packets and at high speeds).
?
The USB host runs "usbnet", and the other end of the link might be:
- Another USB host, when using USB "network" or "data transfer"
cables. These are often used to network laptops to PCs, like
"Laplink" parallel cables or some motherboards. These rely
on specialized chips from many suppliers.
- An intelligent USB gadget, perhaps embedding a Linux system.
These include PDAs running Linux (iPaq, Yopy, Zaurus, and
others), and devices that interoperate using the standard
CDC-Ethernet specification (including many cable modems).
- Network adapter hardware (like those for 10/100 Ethernet) which
uses this driver framework.
?
The link will appear with a name like "usb0", when the link is
a two-node link, or "eth0" for most CDC-Ethernet devices. Those
two-node links are most easily managed with Ethernet Bridging
(CONFIG_BRIDGE) instead of routing.
?
For more information see <http://www.linux-usb.org/usbnet/>.
To compile this driver as a module, choose M here: the module will be called usbnet.
?
2)CDC Ethernet support (smart devices such as cable modems)
對應模塊為cdc_ether.ko。
在linux-3.4/drivers/net/usb/Kconfig中描述如下:
This option supports devices conforming to the Communication Device
Class (CDC) Ethernet Control Model, a specification that's easy to
implement in device firmware. The CDC specifications are available
from <http://www.usb.org/>.
?
CDC Ethernet is an implementation option for DOCSIS cable modems
that support USB connectivity, used for non-Microsoft USB hosts.
The Linux-USB CDC Ethernet Gadget driver is an open implementation.
This driver should work with at least the following devices:
* Dell Wireless 5530 HSPA
* Ericsson PipeRider (all variants)
* Ericsson Mobile Broadband Module (all variants)
* Motorola (DM100 and SB4100)
* Broadcom Cable Modem (reference design)
* Toshiba (PCX1100U and F3507g/F3607gw)
* ...
?
This driver creates an interface named "ethX", where X depends on
what other networking devices you have in use. However, if the
IEEE 802 "local assignment" bit is set in the address, a "usbX"
name is used instead.
?
?
3)Host for RNDIS and ActiveSync devices (EXPERIMENTAL)
即RNDIS_HOST,對應模塊為rndis_host.ko。
在linux-3.4/drivers/net/usb/Kconfig中描述如下:
This option enables hosting "Remote NDIS" USB networking links,
as encouraged by Microsoft (instead of CDC Ethernet!) for use in
various devices that may only support this protocol. A variant
of this protocol (with even less public documentation) seems to
be at the root of Microsoft's "ActiveSync" too.
Avoid using this protocol unless you have no better options.
The protocol specification is incomplete, and is controlled by
(and for) Microsoft; it isn't an "Open" ecosystem or market.
?
注:
1)對于僅支持RNDIS的USB network device,host需要加載以上3個驅動,例如測試的S4和p8;
2)對于支持cdc_ether的device,host只需加載usbnet.ko和cdc_ether.ko,例如配置成cdc_ether gadget的開發板;
3)rndis_host.ko依賴cdc_ether.ko,兩者都依賴usbnet.ko。
4)以下是FreeBSD doc中摘錄:
Many cellphones provide the option to share their data connection over USB (often called "tethering"). This feature uses either the?RNDIS,?CDC?or a custom?Apple??iPhone?/iPad? protocol.
- Android? devices generally use the?urndis?driver.
- Apple? devices use the?ipheth?driver.
- Older devices will often use the?cdce driver.
?
2. 識別USB虛擬網卡
將手機接入開發板USB,打開USB共享網絡。
在minicom中輸入:ifconfig usb0 up
然后:ifconfig
識別USB虛擬網卡成功。
?
3. 使用(ping測試)
1)在手機終端輸入:busybox ifconfig 查看rndis0 ip地址為:192.168.42.129
2)在minicom中配置開發板usb0 IP地址:ifconfig usb0 192.168.42.170
3)在minicom中輸入:ping -c 3 192.168.42.129
ping測試通過。
?
?
?
?
總結
以上是生活随笔為你收集整理的全志A33-USB虚拟网卡的配置与使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 纽约要求优步和 Lyft 到 2030
- 下一篇: C语言高级编程:二级指针的赋值