全志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测试通过。

猜你喜欢

转载自blog.csdn.net/u012247418/article/details/81428769