ec20模块可以连接pptp协议的服务器,树莓派4+lede+移远5G模组RM500Q

0. 环境

win10

树莓派4 + lede

rm500q

// 内核文件夹

// /home/xxjianvm/lede/build_dir/toolchain-aarch64_cortex-a72_gcc-8.4.0_musl/linux

1. 打开[KERNEL]/drivers/usb/serial/option.c

1.1 Add VID and PID

static const struct usb_device_id option_ids[] = {

#if 1 //Added by Quectel

{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC20 R2.0/EC20 R2.1/EC25/EG25-G/EM05 */

{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21/EG21-G */

{ USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */

{ USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */

{ USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */

{ USB_DEVICE(0x2C7C, 0x0512) }, /* Quectel EG12/EM12/EG18 */

{ USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */

{ USB_DEVICE(0x2C7C, 0x0700) }, /* Quectel BG95/BG77/BG600L-M3/BC69 */

{ USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */

{ USB_DEVICE(0x2C7C, 0x0415) }, /* Quectel AG15 */

{ USB_DEVICE(0x2C7C, 0x0452) }, /* Quectel AG520R */

{ USB_DEVICE(0x2C7C, 0x0455) }, /* Quectel AG550R */

{ USB_DEVICE(0x2C7C, 0x0620) }, /* Quectel EG20 */

{ USB_DEVICE(0x2C7C, 0x0800) }, /* Quectel RG500Q/RM500Q/RG510Q/RM510Q */

#endif

1.2  Add Reset-resume Mechanism

static struct usb_serial_driver option_1port_device = {

……

#ifdef CONFIG_PM

.suspend = usb_wwan_suspend,

.resume = usb_wwan_resume,

#if 1 //Added by Quectel

.reset_resume = usb_wwan_resume,

#endif

#endif

};

1.3 Use MBIM, GobiNet or QMI_WWAN Driver

static int option_probe(struct usb_serial *serial, const struct usb_device_id *id) {

struct usb_wwan_intf_private *data;

……

#if 1 //Added by Quectel

//Quectel modules’s interface 4 can be used as USB network device

if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {

//some interfaces can be used as USB Network device (ecm, rndis, mbim)

if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF) {

return -ENODEV;

}

//interface 4 can be used as USB Network device (qmi)

else if (serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) {

return -ENODEV;

}

}

#endif

/* Store device id so we can use it during attach. */

usb_set_serial_data(serial, (void *)id);

return 0;

}

2. 打开[KERNEL]/drivers/usb/serial/usb_wwan.c

2.1 Add the Zero Packet Mechanism

[KERNEL]/drivers/usb/serial/usb_wwan.c.

static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint,

int dir, void *ctx, char *buf, int len,void (*callback) (struct urb *))

{

……

usb_fill_bulk_urb(urb, serial->dev,

usb_sndbulkpipe(serial->dev, endpoint) | dir,

buf, len, callback, ctx);

#if 1 //Added by Quectel for zero packet

if (dir == USB_DIR_OUT) {

struct usb_device_descriptor *desc = &serial->dev->descriptor;

if (desc->idVendor == cpu_to_le16(0x2C7C))

urb->transfer_flags |= URB_ZERO_PACKET;

}

#endif

return urb;

}

3.内核添加USB网络配置选项,与EC20无太大差异:

总体来说是这几个驱动添加:

kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch kmod-usb-wdm

步骤:

1).顶层目录下执行:

# make menuconfig

2).配置 kmod-usb-serial:

Kernel modules ---> USB Support ---> kmod-usb-serial..................... Support for USB-to-Serial converters

3). 配置 kmod-usb-serial-option

Kernel modules ---> USB Support ---> kmod-usb-serial-option................... Support for Option HSDPA modems

4). 配置 kmod-usb-serial-wwan

Kernel modules ---> USB Support ---> -*- kmod-usb-serial-wwan..................... Support for GSM and CDMA modems

lede没有这个选项,因此我试下这几个可否替代wwan

Kernel modules ---> USB Support ---> -*- kmod-usb-net-rndis

Kernel modules ---> USB Support ---> -*- kmod-usb-serial-qualcomm

5). 配置 kmod-usb-net

Kernel modules ---> USB Support ---> kmod-usb-net............... Kernel modules for USB-to-Ethernet convertors

Kernel modules ---> USB Support ---> kmod-usb-wdm.............................. USB Wireless Device Management   //qmi_wwan_q 依赖

6). 配置 usb-modeswitch

Utilities ---> usb-modeswitch................................ USB mode switching utility

7). 最后, 保存退出配置界面即可。

8).内核修改

# make kernel_menuconfig

Device Drivers ---> [*] USB support ---> Support for Host-side USB

Device Drivers ---> [*] Network device support ---> USB Network Adapters ---> Multi-purpose USB Networking Framework

Device Drivers ---> [*] Network device support ---> USB Network Adapters --->  QMI WWAN driver for Qualcomm MSM based 3G and LTE modems //qmi Device Device Drivers ---> [*] Network device support --->  [*] PPP (point-to-point protocol) support

  PPP (point-to-point protocol) support                               │ │

│ │         PPP BSD-Compress compression                                      │ │

│ │         PPP Deflate compression                                           │ │

│ │    [*]     PPP filtering                                                     │ │

│ │         PPP MPPE compression (encryption)                                 │ │

│ │    [*]     PPP multilink support                                             │ │

│ │         PPP over Ethernet                                                 │ │

│ │    < >     PPP over IPv4 (PPTP)                                              │ │

│ │         PPP support for async serial ports                                │ │

│ │         PPP support for sync tty ports

最后, 保存退出配置界面即可。

4. GobiNet Driver

[KERNEL]/drivers/net/usb/

4.1 添加源码到内核

把Quectel_Linux&Android_GobiNet_Driver_V1.6.2.9\GobiNet内的源文件和头文件都复制到[KERNEL]/drivers/net/usb/

4.2 修改同目录内的Makefile

添加

obj-y += GobiNet.o

GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o

5.  QMI_WWAN Driver

5.1 添加源码到内核

复制qmi_wwan_q.c到[KERNEL]/drivers/net/usb/

5.2 修改同目录内的Makefile

Please add the following statements to the file [KERNEL]/drivers/net/usb/Makefile.

# must insert qmi_wwan_q.o before qmi_wwan.o

obj-${CONFIG_USB_NET_QMI_WWAN} += qmi_wwan_q.o

obj-${CONFIG_USB_NET_QMI_WWAN} += qmi_wwan.o

6. 编译固件

make menuconfig

make -j2 V=s

用openwrt-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz。通过web可以更新固件。

[    8.365435] usbcore: registered new interface driver brcmfmac

[    8.372299] usbcore: registered new interface driver cdc_mbim

[    8.378841] usbcore: registered new interface driver option

[    8.384500] usbserial: USB Serial support registered for GSM modem (1-port)

[    8.391613] option 1-1.4:1.0: GSM modem (1-port) converter detected

[    8.398059] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0

[    8.405187] option 1-1.4:1.1: GSM modem (1-port) converter detected

[    8.411657] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1

[    8.418740] option 1-1.4:1.2: GSM modem (1-port) converter detected

[    8.425155] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2

[    8.432228] option 1-1.4:1.3: GSM modem (1-port) converter detected

[    8.438647] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB3

[    8.447579] usbcore: registered new interface driver qcserial

[    8.453430] usbserial: USB Serial support registered for Qualcomm USB modem

7. 拨号工具

复制Quectel_QConnectManager_Linux_V1.6.0.16\quectel-CM到ubuntu18

交叉编译拨号工具

<1> lede arm交叉编译链配置

sudo  vi /etc/bash.bashrc

export PATH=$PATH:/home/xxjianvm/lede/staging_dir/toolchain-aarch64_cortex-a72_gcc-8.4.0_musl/bin/

source  /etc/bash.bashrc

<2> warning: environment variable 'STAGING_DIR' not defined

sudo  vi /etc/bash.bashrc

export STAGING_DIR=$STAGING_DIR:/home/xxjianvm/lede/staging_dir/

source  /etc/bash.bashrc

<3> 修改Makefile

CROSS_COMPILE=aarch64-openwrt-linux-

make

把quectel-CM上传到板子上。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值