openwrt 添加4g全网通模块龙尚U9300C

硬件平台

MT7628A+128RAM+16FLASH

openwrt版本:19.07

一,修改内核USB驱动

/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/linux-4.14.180/drivers/usb/serial/option.c

找到 LONGCHEER_VENDOR_ID 添加新的产品ID: #define LONGSHANG_U9300_PRODUCT_ID        0x9b3c 

#define LONGCHEER_VENDOR_ID            0x1c9e

/* 4G Systems products */
/* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick *
 * It seems to contain a Qualcomm QSC6240/6290 chipset            */
#define FOUR_G_SYSTEMS_PRODUCT_W14        0x9603
#define FOUR_G_SYSTEMS_PRODUCT_W100        0x9b01

/* Fujisoft products */
#define FUJISOFT_PRODUCT_FS040U            0x9b02

/* iBall 3.5G connect wireless modem */
#define IBALL_3_5G_CONNECT            0x9605

/* Zoom */
#define ZOOM_PRODUCT_4597            0x9607

/* SpeedUp SU9800 usb 3g modem */
#define SPEEDUP_PRODUCT_SU9800            0x9800
/*U9300*/
#define LONGSHANG_U9300_PRODUCT_ID        0x9b3c 

添加该id到数组

{ USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) },
    { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, LONGSHANG_U9300_PRODUCT_ID, 0xff),
      .driver_info = RSVD(4) },

    { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 0x9801, 0xff),

配置menuconfig,kernel modules->USB Support->kmod-usb-serila->option编译后即可识别正确识别模块,识别到4个USBtty(0-3)

二,编译龙尚gobinet驱动

将官方驱动解压到package/gobinet/src/目录(新建目录),在package/gobinet目录下新建makefile,内容如下:

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
 
PKG_NAME:=gobinet
PKG_RELEASE:=1
 
include $(INCLUDE_DIR)/package.mk
 
define KernelPackage/gobinet
    SUBMENU:=Other modules
    TITLE:=Support Module for gobinet
    DEPENDS:=+kmod-usb-core +kmod-usb-net
    FILES:=$(PKG_BUILD_DIR)/GobiNet.ko
    AUTOLOAD:=$(call AutoLoad,81,GobiNet)
endef
 
define KernelPackage/gobinet/description
    This is a gobinet drivers
endef
 
MAKE_OPTS:=ARCH="$(LINUX_KARCH)" \
    CROSS_COMPILE="$(TARGET_CROSS)" \
    SUBDIRS="$(PKG_BUILD_DIR)"
    
define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)/
    $(CP) -R ./src/* $(PKG_BUILD_DIR)/
endef
 
define Build/Compile
    $(MAKE) -C "$(LINUX_DIR)" $(MAKE_OPTS) modules
endef
 
$(eval $(call KernelPackage,gobinet))

在menuconfig 中将该驱动编译进内核kernel modules->Other modules->kmod-gobinet

编译刷机后查看是否出现新的网卡eth0或者eth1

三,查看模块状态,拨号上网(安装minicom,选择USBtty2)

查询APN

AT+CGDCONT?

配置APN

AT+CGDCONT=1,"IP","CTNET"

CTNET(电信)
CMNET(移动)
3GNET(联通)

APN一般模块可以自动识别,无需配置

拨号上网

AT$QCRMCALL=1,1

加入开机启动rc.local,注意文件需要可执行权限

echo -e "at\$qcrmcall=1,1\r\n" >/dev/ttyUSB2 | cat /dev/ttyUSB2

添加新的wan接口

登录web页面,network->interfaces,点击add new interfaces ,任意起个名字,DHCP CLIENT,interface选择新的网口eth*,firewall 加入wan,刷新后看是否能够自动获取ip,获取ip成功即可联网!

 

你可能感兴趣的:(openwrt 添加4g全网通模块龙尚U9300C)