一、添加VID、PID

在linux_src/drivers/usb/serial/option.c 文件中的
static const struct usb_device_id option_ids[]的id 列表中增加如下语句:

{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },

如何测试驱动不成功,在安装option.ko的情况下,可以直接写入usb-serial 的pid

 echo 05c6 9025 >/sys/bus/usb-serial/drivers/option1/new_id

openwrt-1407在如下位置:
build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620n/linux-3.10.49/drivers/usb/serial/option.c

二、内核的编译配置

包括USB串口驱动和PPP拨号相关的配置项:

1、USB 串口驱动相关的配置项:
   CONFIG_USB_SERIAL=y
   CONFIG_USB_SERIAL_OPTION=y
   CONFIG_USB_SERIAL_WWAN=y

make kernel_menuconfig

Device Drivers --->
  USB support --->
    USB Serial Converter support ---> (默认是M,且不能设为*)

习惯上=y 使得编译进内核而不是作为模块,那么得配置好一些USB相关
<*>  Support for Host-side USB (默认M,选择* 方便USB Serial可以=y)
<*>  USB announce new devices
[*]  Enable USB persist by default
<*>  EHCI HCD(USB 2.0) support
[*]  Root Hub Transaction Translators
[*]  Improved Transaction Translator scheduling
<*>  OHCI HCD support
<*>  USB Modem (CDC ACM) support
<*>  USB Printer support
<*>  USB Wireless Device Management support

USB Serial Converter support --->
  <*>  USB driver for GSM and CDMA modems

退出后保存,git status查看会修改target/linux/ramips/mt7620n/config-3.10 这里便是内核的默认编译配置文件

2、PPP 拨号的相关配置项:
   CONFIG_PPP=y
   CONFIG_PPP_MULTILINK=y
   CONFIG_PPP_FILTER=y
   CONFIG_PPP_ASYNC=y
   CONFIG_PPP_SYNC_TTY=y
   CONFIG_PPP_DEFLATE=y
   CONFIG_PPP_BSDCOMP=y

make kernel_menuconfig

Device Drivers --->
  [*] Network device support --->
      <*> PPP (point-to-point protocol) support
      <*> PPP BSD-Compress compression
      <*> PPP Deflate compression
      [*] PPP filtering
      [*] PPP multilink support
      <*> PPP MPPE compression (encryption)
      [*] PPP multilink support
      <*> PPP over Ethernet
      <*> PPP support for async serial ports
      <*> PPP support for sync tty ports

三、其它配置

make menuconfig

1、界面LuCI配置(web页面管理程序)
LuCI --->
  1. Collections --->
       <*> luci
  3. Applications --->
       <*> luci-app-commands
       <*> luci-app-ddns
       <*> luci-app-ntpc

2、网络配置
Netmowrk --->
  File Transfer --->
    <*> wget
  SSH --->
    <*> openssh-client
    <*> openssh-sftp-server

3、工具配置
Utilities --->
  <*> comgt

四、添加ppp0网络节点

target/linux/ramips/base-files/etc/uci-defaults/02_network

+       m201)
+               ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+               ucidef_set_interfaces_3g "ppp0"
+               ;;
+
        ur-336un)

package/base-files/files/lib/functions/uci-defaults.sh

+ucidef_set_interface_ppp0() {
+       local ifname=$1
+       
+       uci batch <<EOF
+set network.ppp0='interface'
+set network.ppp0.ifname='$ifname'
+set network.ppp0.proto='3g'
+set network.ppp0.apn='3gnet'
+set network.ppp0.service='umts'
+set network.ppp0.dialnumber='*99#'
+set network.ppp0.device='/dev/ttyUSB0'
+EOF
+}

+ucidef_set_interfaces_3g() {
+       local ppp0_ifname=$1
+       
+       ucidef_set_interface_ppp0 "$ppp0_ifname"
+}
+

package/network/config/firewall/files/firewall.config

config zone
+       option network          'wan ppp0'

调试的时候可以手动设置(我这里是华为MU709s-2 WCDMA 联通3G):
进入etc/config/修改network,增加一个3G 网络节点

config interface 'ppp0'
        option ifname 'ppp0'
        option proto '3g'
        option apn '3gnet'
        option service 'umts'
        option dialnumber '*99#'
        option device '/dev/ttyUSB0'

注:联通apn:3gnet 电信apn:ctnet 移动apn:cmnet/cmwap
联通dialnumber:3G为*99# 电信:3G为#777 移动为:*99***1# LTE为:*99#

拨号成功:
ifconfig
3g-ppp0   Link encap:Point-to-Point Protocol  
          inet addr:10.229.7.143  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:844 (844.0 B)  TX bytes:854 (854.0 B)

五、参考资料
openwrt官网

Use 3g/UMTS USB Dongle for WAN connection:
http://wiki.openwrt.org/doc/recipes/3gdongle

Wired WAN + 3G dongle:
http://wiki.openwrt.org/doc/howto/wired.wan.with.3g.dongle

Get your WAN interface up using ifup wan (or /etc/init.d/network restart if you changed more stuff; a reboot if you changed even more).

小笔记:

1、使用cat /sys/kernel/debug/usb/devices 看USB的VID, PID

2、gcom -d /dev/ttyUSB0 info

本例子中上传移柯的4G模块为修改示例

lynq linux下ppp拨号流程V1.2_20161121

链接:http://pan.baidu.com/s/1jHJSBXk 密码:5qdg

Openwrt 3G拨号上网相关推荐

  1. linux下3G拨号上网

    Linux下3G拨号上网 开发板型号 :FL2440 内核版本:linux-3.0 3G上网卡:ZTE MF626 SIM卡:中国移动 1. usb_modeswitch移植 usb_modeswit ...

  2. ARM+llinux系统移植3G拨号上网收发短信(一)【转】

    本文转载自:http://blog.csdn.net/hanmengaidudu/article/details/17099737 一.      PPP移植 各项工作具体说明 向Linux内核添加3 ...

  3. 4g模块注册上网 移远_移远EC20(4G模块)通过openwrt路由器拨号上网

    移远EC20是一个兼容性比较强的4G模块.我入手的这个是EC20 R2.1版本,pcie接口的,这个版本是增强版,支持最高150Mbps的下载速率,而普通的EC20只有100Mbps下载速率.这个是全 ...

  4. linux 编译3g驱动_linux下使用3G拨号上网 以及3g驱动设置

    中兴WCDMA模块 Linux拨号流程 Version 1.0 目录 1. 测试准备--------------------..-3 2. 拨号脚本---------------------13 3. ...

  5. openwrt 3g模块上网

    硬件环境:     开发板为RT5053F        3G模块为中兴 MC2176 电信版 以下是操作步骤 加入VID .PID VID . PID 的获取方法是 将设备插入电脑在linux下执行 ...

  6. ARM+llinux系统移植3G拨号上网收发短信(一)

    一.      PPP移植 各项工作具体说明 向linux内核添加3G模块的驱动(USB转串口驱动)和PPP协议的支持,然后编译内核并下载到开发板.当然如果之前已经移植好内核,那么只需要增加几个选项就 ...

  7. ARM+linux系统移植3G拨号上网收发短信(三)【转】

    本文转载自:http://blog.csdn.net/hanmengaidudu/article/details/17099755 一.用text查看模式 下面的"发"是指我敲的命 ...

  8. 移远EC20设置RNDIS模式拨号上网

    背景 4G模块原本使用QMI方式拨号上网,客户反馈某种定制卡不能上网,切换下拨号模式看下设备能不能正常上网: 过程 openwrt中如果使用RNDIS模式上网需要在kernel配置中使能以下项: Km ...

  9. openwrt 使用 usb 实现4G拨号上网功能

    上班一年了,最近才觉得应该把学到的东西好好用博客展示出来,而不是排的整整齐齐的放在浏览器收藏夹里!也开始从头发一些博客,但是觉得手头上的工作,也应该及时总结,这篇文章是关于 openwrt 拨号上网的 ...

最新文章

  1. 如何在github发布个人网站或开源项目-手把手教您制作并发布个人网站或主页(二)
  2. 我去,还在这样读写 excel 这也太低效了吧,好办法来了
  3. boost::interprocess::intrusive_ptr用法的测试程序
  4. Showdoc使用——接口文档
  5. 小米12 mini曝光:骁龙898加持
  6. amazeui学习笔记--css(基本样式2)--基础设置Base
  7. php请求要通过什么协议,php – 发送多个应用程序协议请求(类似于mailto:)
  8. 字节跳动面试真题:java高级编程考试题及答案
  9. ncbi查找目的基因序列_献给初学者:如何使用 NCBI 查找基因序列、mRNA、Promoter...
  10. python处理excel教程视频-从零基础开始用Python处理Excel数据 视频教程
  11. 矩阵平方差公式成立条件的探讨
  12. 昨天见到了原来飘渺水云间(浙江大学BBS站)的FLASH版主小兵甲
  13. AI 工程师职业指南
  14. JavaEE的RESTful标准技术JAX-RS,jersey-client客户端使用介绍【享学Java】
  15. 海淀区第九届单片机竞赛获奖名单_第九届蓝桥杯国赛电子类单片机设计与开发组获奖名单...
  16. 计算机财务管理知识点,财务管理知识点梳理(财务基础必背知识点整理篇)
  17. 使用GPU进行神经网络计算详解
  18. 串口接收不定长数据的几种方式
  19. VMware上使用Ubuntu的问题集合
  20. MATLAB闪退,无法打开

热门文章

  1. 惠普服务器如何装系统
  2. openshift php.ini,openshift环境变量
  3. 自己动手做QQ木马--文件绑定篇(转)
  4. 取消快捷方式图标箭头(注册表)
  5. 烦恼不是在于我们想要什么
  6. 计算机网络应用基础论文5000字,计算机网络应用基础研究论文
  7. 【AI创新者】TensorFlow贡献者黄文坚:解读对比13个深度学习框架后的选择
  8. python指令集_Tensorflow不支持AVX2指令集的解决方法
  9. 2022 年面试工具篇 Postman 面试题及答案
  10. 深入浅出kubernetes之client-go的SharedInformerFactory