CubieBoard中文论坛

 找回密码
 立即注册
搜索
热搜: unable
查看: 11244|回复: 3

ct调试中兴3G dongle(MF210V2)

[复制链接]
发表于 2014-11-1 12:02:54 | 显示全部楼层 |阅读模式
ct调试中兴3G dongle(MF210V2)

1.驱动版本说明:
1.1目录结构
     script
     so
     userguide
1.2 文件说明
    驱动版本中文件说明:
    /script    拨号脚本
             /源文件编译结果
              chat
              ip-down-ppp0
              ip-up-ppp0
              readme.txt
             chat.c
             init.gprs-pppd
             ip-down-ppp0.c
             ip-up-ppp0.c
     /so    要移植的ril库
            /Android4.x   android4.0版本以上
                        libreference-ril.so
     /userguide    使用说明参考文档
                Android系统RIL适配用户参考-V0.8.pdf
        额外说明.pdf

2.添加内核模块
2.1 添加驱动
模块驱动的添加需要配置系统  android  系统内核,配置方法如下:
  1. cd linux-3.4/
  2. make ARCH=arm menuconfig
  3. device drivers--->usb support--->usb serial converter support
复制代码
选中如下组件:
  1. USB driver for GSM and CDMA modems
复制代码
2.2 添加设备 VID 和 PID
找到内核源码文件 option.c(一般情况下,路径在..\linux-3.4\drivers\usb\serial\option.c)
在源码中查找如下代码(蓝色部分),查找到后,添加红色部分驱动代码:
  1. <font color="#0000ff">static struct usb_device_id option_ids[] = {</font>
  2. <font color="#ff0000">{ USB_DEVICE(0x19d2, 0x0117},</font>
复制代码
0x19d2 为  ZTE  厂商  ID
0x0117  为  MF210V2 设备  ID
上面的  ID  根据具体的模块来定,不同的模块  ID  不同。
2.3 PPP组件添加
Ril  驱动联网功能底层使用  ppp  协议创建数据链路,因此需要在内核中配置对  ppp
协议的支持。配置方法如下:
  1. cd linux-3.4/
  2. make ARCH=arm menuconfig
  3. device drivers--->network device support--->ppp surport
复制代码
选中如下组件:
  1. ppp filtering
  2. ppp support for async serial ports
  3. ppp support for sync tty ports
  4. ppp deflate compression
  5. ppp BSD-compress compression
复制代码
3  集成驱动文件
   3.1 集成拨号脚本
3.1.1  拷贝文件
将编译好的chat,ip-down-ppp0,ip-up-ppp0,libreference-ril.so拷贝到../device/third_part/zte (此目录没有,需要新建)目录下
3.1.2  打包文件到系统中
修改device/softwinner/sugar-cubietruck/sugar_cubietruck.mk
  1. #      Bluetooth
  2. #      TSCalibration2

  3. +PRODUCT_PACKAGES += \
  4. +        ip-up-ppp0  \
  5. +        chat  \
  6. +       Stk  \
  7. +       rild \
  8. +       pppd   \
  9. +        ip-down-ppp0
  10. +
  11. +PRODUCT_COPY_FILES += \
  12. +        device/third_part/zte/init.gprs-pppd:system/etc/init.gprs-pppd  \
  13. +        device/third_part/zte/ip-up-ppp0:system/etc/ppp/ip-up-ppp0  \
  14. +        device/third_part/zte/chat:system/bin/chat  \
  15. +        device/third_part/zte/ip-down-ppp0:system/etc/ppp/ip-down-ppp0  \
  16. +        device/third_part/zte/libreference-ril.so:system/lib/libreference-ril.so
  17. +
  18. # wifi & bt config file
  19. PRODUCT_COPY_FILES += \
复制代码
注意:当系统编译后,应该在 out 目录下对应平台的 system/etc/下找到 init.gprs-pppd;
在 out 目录下对应平台的 system/etc/ppp 下找到 ip-up-ppp0 和 ip-down-ppp0;在 out 目录下对应平台的 system/lib 下找到 libreference-ril.so。如果文件未找到说明相关文件未打包到系统中去,请检查相关配置是否正确。
3.2 修改系统配置
3.2.1 打开系统语音电话权限
  1. diff --git a/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res
  2. index e321075..b7365f0 100755
  3. --- a/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res/res/va
  4. +++ b/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res/res/va
  5. @@ -45,7 +45,7 @@
  6.           PackageManager.FEATURE_TELEPHONY system feature, which is
  7.           available on *any* device with a telephony radio, even if the
  8.           device is data-only. -->
  9. -    <bool name="config_voice_capable">false</bool>
  10. +    <bool name="config_voice_capable">true</bool>
  11.      <!-- List of regexpressions describing the interface (if any) that represen
  12.           bluetooth interfaces.  If the device doesn't want to support tethering
  13.           should be empty. -->
复制代码
3.2.2 指定系统rild库路径及修改系统语言
  1. diff --git a/device/softwinner/wing-common/ProductCommon.mk b/device/softwinner/wing-common/Pro
  2. index 1e2483f..85a8bb5 100755
  3. --- a/device/softwinner/wing-common/ProductCommon.mk
  4. +++ b/device/softwinner/wing-common/ProductCommon.mk
  5. @@ -117,15 +117,15 @@ PRODUCT_COPY_FILES += \
  6. PRODUCT_PROPERTY_OVERRIDES += \
  7. ro.kernel.android.checkjni=0 \
  8. persist.sys.timezone=Asia/Shanghai \
  9. - persist.sys.language=en \
  10. - persist.sys.country=US \
  11. + persist.sys.language=zh \
  12. + persist.sys.country=CN \
  13. wifi.interface=wlan0 \
  14. wifi.supplicant_scan_interval=15 \
  15. debug.egl.hw=1 \
  16. ro.display.switch=1 \
  17. ro.opengles.version=131072 \
  18. rild.libargs=-d/dev/ttyUSB2 \
  19. - rild.libpath=/system/lib/libsoftwinner-ril.so \
  20. + rild.libpath=/system/lib/libreference-ril.so \
  21. keyguard.no_require_sim=true \
  22. persist.sys.strictmode.visual=0 \
  23. persist.sys.strictmode.disable=1 \
复制代码
3.2.3  修改驱动设备文件的权限、添加 rild 服务,-d 表示模块接收 AT 服务的端口参数,-u 表示 DATA 端口,
  1. diff --git a/device/softwinner/wing-common/init.rc b/device/softwinner/wing-common/init.rc
  2. index 7f1105f..652452e 100755
  3. --- a/device/softwinner/wing-common/init.rc
  4. +++ b/device/softwinner/wing-common/init.rc
  5. @@ -339,6 +339,24 @@ on boot
  6.      setprop net.tcp.buffersize.hspa    4094,87380,262144,4096,16384,262144
  7.      setprop net.tcp.buffersize.edge    4093,26280,35040,4096,16384,35040
  8.      setprop net.tcp.buffersize.gprs    4092,8760,11680,4096,8760,11680
  9. +
  10. +       setprop service.down.firmware  false
  11. + setprop service.ap.infoget   false
  12. + setprop service.bp.infoget   false
  13. +on property:service.down.firmware=true
  14. +     stop ril-daemon
  15. +chmod 777 /dev/ttyUSB0
  16. +     chmod 777 /dev/ttyUSB1
  17. +     chmod 777 /dev/ttyUSB2
  18. +     chmod 777 /dev/ttyUSB3
  19. +     chmod 777 /dev/ttyUSB4
  20. +on property:service.down.firmware=false
  21. +     start ril-daemon
  22. +chmod 777 /dev/log/radio
  23. +     chmod 777 /dev/log/system
  24. +     chmod 777 /dev/log/events
  25. +     chmod 777 /dev/log/main
  26. +

  27. # Set this property so surfaceflinger is not started by system_init
  28.      setprop system_init.startsurfaceflinger 0
  29. @@ -437,12 +455,21 @@ service netd /system/bin/netd
  30. service debuggerd /system/bin/debuggerd
  31.      class main

  32. -service ril-daemon /system/bin/rild
  33. +service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
  34. +    --  -d   /dev/ttyUSB2   -u /dev/ttyUSB1
  35.      class main
  36.      socket rild stream 660 root radio
  37.      socket rild-debug stream 660 radio system
  38.      user root
  39.      group radio cache inet misc audio sdcard_rw log
  40. +   ###添加重启 rild 的机制###
  41. +    on property:ril.reset.rild=1
  42. +    stop ril-daemon
  43. +    start ril-daemon
  44. +    setprop ril.reset.rild    0
  45. ###添加重启模块的机制,其中 ResetModem ()为用户自己实现的重启模块的函数###
  46. +on property:ril.reset.modem=1   
  47. +    on property:ril.reset.modem=1
  48. +    /system/bin/ResetModem:

  49. service surfaceflinger /system/bin/surfaceflinger
  50.      class main
  51. @@ -476,6 +503,12 @@ service bootanim /system/bin/bootanimation
  52.      disabled
  53.      oneshot
  54. ###添加 pppd_gprs 服务###
  55. +service pppd_gprs /system/etc/init.gprs-pppd
  56. +    user root
  57. +    group radio cache inet misc
  58. +    disabled
  59. +    oneshot
  60. +
  61. service installd /system/bin/installd
  62.      class main
  63.      socket installd stream 600 system system
复制代码
3.2.4 修改android_filesystem_config.h 文件
  1. diff --git a/system/core/include/private/android_filesystem_config.h b/system/core/include/priv
  2. old mode 100644
  3. new mode 100755
  4. index 7e34da8..3d38c1f
  5. --- a/system/core/include/private/android_filesystem_config.h
  6. +++ b/system/core/include/private/android_filesystem_config.h
  7. @@ -194,7 +194,8 @@ static struct fs_path_config android_files[] = {
  8.      { 00550, AID_DHCP,      AID_SHELL,     "system/etc/dhcpcd/dhcpcd-run-hooks" },
  9.      { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" },
  10.      { 00444, AID_RADIO,     AID_AUDIO,     "system/etc/AudioPara4.csv" },
  11. -    { 00555, AID_ROOT,      AID_ROOT,      "system/etc/ppp/*" },
  12. +    { 00777, AID_ROOT,      AID_SHELL,     "system/etc/init.gprs-pppd" },
  13. +    { 00777, AID_ROOT,      AID_ROOT,      "system/etc/ppp/*" },
  14.      { 00555, AID_ROOT,      AID_ROOT,      "system/etc/rc.*" },
  15.      { 00644, AID_SYSTEM,    AID_SYSTEM,    "data/app/*" },
  16.      { 00644, AID_MEDIA_RW,  AID_MEDIA_RW,  "data/media/*" },
复制代码
3.2.5  修改property_service.c
  1. diff --git a/system/core/init/property_service.c b/system/core/init/property_service.c
  2. index dfe62ed..9ec7ebe 100755
  3. --- a/system/core/init/property_service.c
  4. +++ b/system/core/init/property_service.c
  5. @@ -65,6 +65,7 @@ struct {
  6. } property_perms[] = {
  7.      { "net.rmnet0.",      AID_RADIO,    0 },
  8.      { "net.gprs.",        AID_RADIO,    0 },
  9. +    { "net.ppp0.",        AID_RADIO,    0 },
  10.      { "net.ppp",          AID_RADIO,    0 },
  11.      { "net.qmi",          AID_RADIO,    0 },
  12.      { "ril.pcui",            AID_RADIO,    0 },
  13. @@ -112,8 +113,7 @@ struct {
  14.      unsigned int uid;
  15.      unsigned int gid;
  16. } control_perms[] = {
  17. -    { "dumpstate",AID_SHELL, AID_LOG },
  18. -    { "ril-daemon",AID_RADIO, AID_RADIO },
  19. +    {"pppd_gprs", AID_RADIO, AID_LOG },
  20.       {NULL, 0, 0 }
  21. };
复制代码
3.2.6  修改ueventd.rc
  1. diff --git a/system/core/rootdir/ueventd.rc b/system/core/rootdir/ueventd.rc
  2. old mode 100644
  3. new mode 100755
  4. index b1664f4..6f79380
  5. --- a/system/core/rootdir/ueventd.rc
  6. +++ b/system/core/rootdir/ueventd.rc
  7. @@ -7,7 +7,11 @@
  8. /dev/urandom              0666   root       root
  9. /dev/ashmem               0666   root       root
  10. /dev/binder               0666   root       root
  11. -
  12. +/dev/ttyUSB0              0660   radio      radio
  13. +/dev/ttyUSB1              0660   radio      radio
  14. +/dev/ttyUSB2              0660   radio      radio
  15. +/dev/ttyUSB3              0660   radio      radio
  16. +/dev/ttyUSB4              0660   radio      radio
  17. # Anyone can read the logs, but if they're not in the "logs"
  18. # group, then they'll only see log entries for their UID.
  19. /dev/log/*                0666   root       log
复制代码
4.调试方法
如果系统调试过程中出现问题,可以通过在 cmd 中输入 adb shell 后进入 ADB 中,并输
入以下命令抓取 LOG 来分析:
  1. $ netcfg
  2. $ logcat –b radio –v time
  3. $ getprop
  4. $ logcat –v time –s pppd
  5. $ logcat –v time
  6. $ dmesg
复制代码
5.常见参数详解
at+cgmi   查询制造商名称
ZTE WELINK CORPORATION

at+cgmm 查询模块型号
MF210V2

at+csq
+CSQ: 0,99 返回0就是没信号

at+csq
+CSQ: 3,99 返回3信号很弱(一般要6左右才能正常上网)

atd15889428164;
OK               拨号成功返回OK
RINGBACK






回复

使用道具 举报

 楼主| 发表于 2014-11-1 12:04:27 | 显示全部楼层
惯例,占2楼
回复 支持 反对

使用道具 举报

发表于 2014-11-4 13:48:55 | 显示全部楼层
调试好驱动,就可以通话和数据业务吧
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-11-4 17:07:27 | 显示全部楼层
是的,另外也要看信号的强度,上网需要打开数据连接
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|粤ICP备13051116号|cubie.cc---深刻的嵌入式技术讨论社区

GMT+8, 2024-5-4 12:47 , Processed in 0.023549 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2012 Comsenz Inc. | Style by Coxxs

返回顶部