Air720模块在linux设备上的RNDIS网卡使用

本文章介绍了在linux系统下,如何使用Air720的RNDIS功能进行上网。

在使用RNDIS功能之前,确保模块固件版本为AT版本,且版本号为AirM2M_720_V296_LTE_AT_NAND及以后版本

Air720正常启动后,通过USB连接到linux设备上,驱动正常加载后会产生一个可以联网的RNDIS网卡:

模块 VID PID Device
Air720 0x1286 0x4e3d eth网卡(RNDIS网卡)

一,当做普通网卡设备即插即用

由于Air720模块内置了自动拨号技术(支持全球大部分运营商),所以只要网络可用的情况下无需对模块进行任何设置就可以正常使用RNDIS网卡。对于不太懂通信和AT的用户来说最简单不过了。

1. 通过USB连接Air720模块和linux设备

目前linux大部分发行版本都已经默认支持RNDIS驱动了,只要通过USB连接Air720模块就可以直接用了,模块开机后就会在linux设备端看到新的网卡,如下图:
eth

注意:

2. RNDIS功能测试

二,内核修改(非必需)

linux内核修改只针对如下情况,才需要修改:

1. 增加rndis设备驱动(配置内核)

对于较老版本或者嵌入式设备默认可能关闭了RNDIS驱动,我们以linux-3.13为例,描述如何打开linux自带的RNDIS驱动:

make

将编译好的内核重新下载到设备

2. ttyUSB设备驱动修改(如果需要发AT)

** For Linux Kernel Version newer than 2.6.30
File: [KERNEL]/drivers/usb/serial/option.c **

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
static int option_probe(struct usb_serial *serial,
const struct usb_device_id *id)
{
struct usb_interface_descriptor *iface_desc =
&serial->interface->cur_altsetting->desc;
struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;

/* Never bind to the CD-Rom emulation interface */
if (iface_desc->bInterfaceClass == 0x08)
i return -ENODEV;
//+add by airm2m for Air72x
if(dev_desc->idVendor == cpu_to_le16(0x1286) &&
dev_desc->idProduct == cpu_to_le16(0x4e3d) &&
iface_desc->bInterfaceNumber <= 1)
return -ENODEV;
//-add by airm2m for Air72x
/*
* Don't bind reserved interfaces (like network ones) which often have
* the same class/subclass/protocol as the serial interfaces. Look at
* the Windows driver .INF files for reserved interface numbers.
*/
if (is_blacklisted(
iface_desc->bInterfaceNumber,
OPTION_BLACKLIST_RESERVED_IF,
(const struct option_blacklist_info *) id->driver_info))
return -ENODEV;

**For Linux Kernel Version older than 2.6.31
File: [KERNEL]/drivers/usb/serial/option.c **

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
static int option_startup(struct usb_serial *serial)
{
int i, j, err;
struct usb_serial_port *port;
struct option_port_private *portdata;
u8 *buffer;

dbg("%s", __func__);

//+add by airm2m for Air72x
if(serial->dev->descriptor.idVendor == cpu_to_le16(0x1286) && serial->dev->descriptor.idProduct == cpu_to_le16(0x4e3d)
&& serial->interface->cur_altsetting->desc.bInterfaceNumber <= 1)
{
return -ENODEV;
}
//-add by airm2m for Air72x

...

}

3. ttyUSB设备测试 (如果需要发AT)

加入ttyUSB设备驱动支持后,Air720模块会提供如下设备:

模块 VID PID Device
Air720 0x1286 0x4e3d RNDIS网卡
ttyUSB0 AT口
ttyUSB1 AT+ppp口
ttyUSB2 log输出口

ttyUSB
测试AT指令可以用minicom等工具,运行命令sudo minicom -D /dev/ttyUSB0,测试结果如下:
at

上次更新 2021-01-28