一、添加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. SylixOS与硬件设备连接问题——硬件设备串口、网口连接问题
  2. 解决Bootstrap中代码不高亮问题
  3. glide源码中包含了那种设计模式_推荐一个好用的拍照选图库,致敬Glide
  4. stl set求交集 并集 差集
  5. UA SIE545 优化理论基础5 搜索与整数规划1 DFS算法
  6. 第一百七十二节,jQuery,动画效果
  7. linux shell之删除当前文件夹不包含文件1和文件2的其他所有文件
  8. Effective Java~23. 类层次优于标签类
  9. PAT乙级 1027 打印沙漏
  10. 样式与include标签的使用及样式的继承和使用
  11. 集合类ArrayList、HashMap、HashSet线程不安全
  12. 32位的tetview and medit 在64bit的linux运行,有很多32bit的库没有安装,错误不断之解决办法。
  13. 干货来袭!java从入门到精通第五版pdf
  14. 楚留香pc端无法获取服务器信息,楚留香手游PC端无响应解决方法
  15. 开心网(http://www.kaixin001.com)的一些JS代码分享
  16. python贪吃蛇游戏手把手教学 第一课
  17. python 关键词 抓取网页_python网络爬虫爬取网页内容
  18. PS教程:紫色光晕效果实现
  19. 那些年,我们关注过的放大电路设计要点
  20. 戴尔Precision M6800加装西部数据NVMESSD-SN52固态硬盘 装4G模块

热门文章

  1. 第12期《大风起兮云飞扬》12月刊
  2. base64php加密,php文件base64加密与解密
  3. 杭州.Net 相关大公司,希望对大家有帮助
  4. 电子计算机承重,编辑暴力实测 PC主板能够负重多少硬件?
  5. 数据挖掘 基础知识 收集
  6. Java代码添加背景音乐
  7. 2022 APMCM亚太数学建模竞赛 C题 全球是否变暖 27页论文及代码
  8. E. 合并有序数组(指针)
  9. falcon 监控 tcp closewait
  10. 个人形象设计之服装配色技巧