导入:usb 3g上网卡 (kxw0620)


  • administrators

    1. 添加VID/PID;
      a) 修改文件
      \build_dir\target-mipsel_24kec+dsp_uClibc-0.9.33.2\linux-ramips_mt7688\linux-3.18.29\drivers\usb\serial\option.c文件中的static const struct usb_device_id option_ids[]的id 列表中增加如下语句:{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }.
      多数情况下该操作已经完成.
    2. make kernel_menuconfig配置
      a) USB串口驱动及其他配置
      Device Drivers --->
      USB support --->
      <> Support for Host-side USB
      <
      > 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
    b) PPP配置
    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

    1. make menuconfig
      a) 界面LuCI配置(web页面管理程序)
      LuCI --->

    2. Collections --->
      <*> luci

    3. Applications --->
      <> luci-app-commands
      <
      > luci-app-ddns
      <> luci-app-ntpc
      b) 网络配置
      Netmowrk --->
      File Transfer --->
      <
      > wget
      SSH --->
      <> openssh-client
      <
      > openssh-sftp-server
      c) 工具配置
      Utilities --->
      <*> comgt

    4. 配置ppp网络节点
      修改文件\target\linux\ramips\base-files\etc\board.d\02_network,
      因为没搞清楚应该加在哪里,所以每个ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"下方都加了ucidef_set_interfaces_3g “ppp0”

    5. \package\base-files\files\lib\functions\uci-defaults-new.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"
    

    }

    1. \package\base-files\files\bin\config_generate文件中增加ppp0接口
      next_vlan=3
      generate_network() {
      local vlan

      json_select network
      json_select $1
      json_get_vars ifname create_vlan macaddr
      json_select ..
      json_select ..

      uci -q batch <<EOF
      delete network.ppp0
      set network.ppp0='interface'
      set network.ppp0.ifname='ppp0'
      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

      [ -n "$ifname" ] || return
      [ "$create_vlan" -eq 1 ] && case $1 in
      lan) vlan=1;;

    2. package/network/config/firewall/files/firewall.config文件中
      config zone
      option network 'wan ppp0'

    3. 后面就是写程序打开ttyUSB0,然后发送AT指令操作模块了.

    4. 我这边操作的是华为MU709s-2

    折腾了好几天,最后发现是otg线的问题, 坑啊……..

    上面的配置可能有些步骤可以省略, 没具体尝试,有兴趣的朋友可以尝试下. 希望可以把结果也分享出来.