|
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 系统内核,配置方法如下:- cd linux-3.4/
- make ARCH=arm menuconfig
- device drivers--->usb support--->usb serial converter support
复制代码 选中如下组件:- USB driver for GSM and CDMA modems
复制代码 2.2 添加设备 VID 和 PID
找到内核源码文件 option.c(一般情况下,路径在..\linux-3.4\drivers\usb\serial\option.c)
在源码中查找如下代码(蓝色部分),查找到后,添加红色部分驱动代码:- <font color="#0000ff">static struct usb_device_id option_ids[] = {</font>
- <font color="#ff0000">{ USB_DEVICE(0x19d2, 0x0117},</font>
复制代码 0x19d2 为 ZTE 厂商 ID
0x0117 为 MF210V2 设备 ID
上面的 ID 根据具体的模块来定,不同的模块 ID 不同。
2.3 PPP组件添加
Ril 驱动联网功能底层使用 ppp 协议创建数据链路,因此需要在内核中配置对 ppp
协议的支持。配置方法如下:- cd linux-3.4/
- make ARCH=arm menuconfig
- device drivers--->network device support--->ppp surport
复制代码 选中如下组件:- ppp filtering
- ppp support for async serial ports
- ppp support for sync tty ports
- ppp deflate compression
- 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- # Bluetooth
- # TSCalibration2
- +PRODUCT_PACKAGES += \
- + ip-up-ppp0 \
- + chat \
- + Stk \
- + rild \
- + pppd \
- + ip-down-ppp0
- +
- +PRODUCT_COPY_FILES += \
- + device/third_part/zte/init.gprs-pppd:system/etc/init.gprs-pppd \
- + device/third_part/zte/ip-up-ppp0:system/etc/ppp/ip-up-ppp0 \
- + device/third_part/zte/chat:system/bin/chat \
- + device/third_part/zte/ip-down-ppp0:system/etc/ppp/ip-down-ppp0 \
- + device/third_part/zte/libreference-ril.so:system/lib/libreference-ril.so
- +
- # wifi & bt config file
- 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 打开系统语音电话权限- diff --git a/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res
- index e321075..b7365f0 100755
- --- a/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res/res/va
- +++ b/device/softwinner/sugar-cubietruck/overlay/frameworks/base/core/res/res/va
- @@ -45,7 +45,7 @@
- PackageManager.FEATURE_TELEPHONY system feature, which is
- available on *any* device with a telephony radio, even if the
- device is data-only. -->
- - <bool name="config_voice_capable">false</bool>
- + <bool name="config_voice_capable">true</bool>
- <!-- List of regexpressions describing the interface (if any) that represen
- bluetooth interfaces. If the device doesn't want to support tethering
- should be empty. -->
复制代码 3.2.2 指定系统rild库路径及修改系统语言- diff --git a/device/softwinner/wing-common/ProductCommon.mk b/device/softwinner/wing-common/Pro
- index 1e2483f..85a8bb5 100755
- --- a/device/softwinner/wing-common/ProductCommon.mk
- +++ b/device/softwinner/wing-common/ProductCommon.mk
- @@ -117,15 +117,15 @@ PRODUCT_COPY_FILES += \
- PRODUCT_PROPERTY_OVERRIDES += \
- ro.kernel.android.checkjni=0 \
- persist.sys.timezone=Asia/Shanghai \
- - persist.sys.language=en \
- - persist.sys.country=US \
- + persist.sys.language=zh \
- + persist.sys.country=CN \
- wifi.interface=wlan0 \
- wifi.supplicant_scan_interval=15 \
- debug.egl.hw=1 \
- ro.display.switch=1 \
- ro.opengles.version=131072 \
- rild.libargs=-d/dev/ttyUSB2 \
- - rild.libpath=/system/lib/libsoftwinner-ril.so \
- + rild.libpath=/system/lib/libreference-ril.so \
- keyguard.no_require_sim=true \
- persist.sys.strictmode.visual=0 \
- persist.sys.strictmode.disable=1 \
复制代码 3.2.3 修改驱动设备文件的权限、添加 rild 服务,-d 表示模块接收 AT 服务的端口参数,-u 表示 DATA 端口,- diff --git a/device/softwinner/wing-common/init.rc b/device/softwinner/wing-common/init.rc
- index 7f1105f..652452e 100755
- --- a/device/softwinner/wing-common/init.rc
- +++ b/device/softwinner/wing-common/init.rc
- @@ -339,6 +339,24 @@ on boot
- setprop net.tcp.buffersize.hspa 4094,87380,262144,4096,16384,262144
- setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
- setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
- +
- + setprop service.down.firmware false
- + setprop service.ap.infoget false
- + setprop service.bp.infoget false
- +on property:service.down.firmware=true
- + stop ril-daemon
- +chmod 777 /dev/ttyUSB0
- + chmod 777 /dev/ttyUSB1
- + chmod 777 /dev/ttyUSB2
- + chmod 777 /dev/ttyUSB3
- + chmod 777 /dev/ttyUSB4
- +on property:service.down.firmware=false
- + start ril-daemon
- +chmod 777 /dev/log/radio
- + chmod 777 /dev/log/system
- + chmod 777 /dev/log/events
- + chmod 777 /dev/log/main
- +
- # Set this property so surfaceflinger is not started by system_init
- setprop system_init.startsurfaceflinger 0
- @@ -437,12 +455,21 @@ service netd /system/bin/netd
- service debuggerd /system/bin/debuggerd
- class main
- -service ril-daemon /system/bin/rild
- +service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
- + -- -d /dev/ttyUSB2 -u /dev/ttyUSB1
- class main
- socket rild stream 660 root radio
- socket rild-debug stream 660 radio system
- user root
- group radio cache inet misc audio sdcard_rw log
- + ###添加重启 rild 的机制###
- + on property:ril.reset.rild=1
- + stop ril-daemon
- + start ril-daemon
- + setprop ril.reset.rild 0
- ###添加重启模块的机制,其中 ResetModem ()为用户自己实现的重启模块的函数###
- +on property:ril.reset.modem=1
- + on property:ril.reset.modem=1
- + /system/bin/ResetModem:
- service surfaceflinger /system/bin/surfaceflinger
- class main
- @@ -476,6 +503,12 @@ service bootanim /system/bin/bootanimation
- disabled
- oneshot
- ###添加 pppd_gprs 服务###
- +service pppd_gprs /system/etc/init.gprs-pppd
- + user root
- + group radio cache inet misc
- + disabled
- + oneshot
- +
- service installd /system/bin/installd
- class main
- socket installd stream 600 system system
复制代码 3.2.4 修改android_filesystem_config.h 文件- diff --git a/system/core/include/private/android_filesystem_config.h b/system/core/include/priv
- old mode 100644
- new mode 100755
- index 7e34da8..3d38c1f
- --- a/system/core/include/private/android_filesystem_config.h
- +++ b/system/core/include/private/android_filesystem_config.h
- @@ -194,7 +194,8 @@ static struct fs_path_config android_files[] = {
- { 00550, AID_DHCP, AID_SHELL, "system/etc/dhcpcd/dhcpcd-run-hooks" },
- { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" },
- { 00444, AID_RADIO, AID_AUDIO, "system/etc/AudioPara4.csv" },
- - { 00555, AID_ROOT, AID_ROOT, "system/etc/ppp/*" },
- + { 00777, AID_ROOT, AID_SHELL, "system/etc/init.gprs-pppd" },
- + { 00777, AID_ROOT, AID_ROOT, "system/etc/ppp/*" },
- { 00555, AID_ROOT, AID_ROOT, "system/etc/rc.*" },
- { 00644, AID_SYSTEM, AID_SYSTEM, "data/app/*" },
- { 00644, AID_MEDIA_RW, AID_MEDIA_RW, "data/media/*" },
复制代码 3.2.5 修改property_service.c- diff --git a/system/core/init/property_service.c b/system/core/init/property_service.c
- index dfe62ed..9ec7ebe 100755
- --- a/system/core/init/property_service.c
- +++ b/system/core/init/property_service.c
- @@ -65,6 +65,7 @@ struct {
- } property_perms[] = {
- { "net.rmnet0.", AID_RADIO, 0 },
- { "net.gprs.", AID_RADIO, 0 },
- + { "net.ppp0.", AID_RADIO, 0 },
- { "net.ppp", AID_RADIO, 0 },
- { "net.qmi", AID_RADIO, 0 },
- { "ril.pcui", AID_RADIO, 0 },
- @@ -112,8 +113,7 @@ struct {
- unsigned int uid;
- unsigned int gid;
- } control_perms[] = {
- - { "dumpstate",AID_SHELL, AID_LOG },
- - { "ril-daemon",AID_RADIO, AID_RADIO },
- + {"pppd_gprs", AID_RADIO, AID_LOG },
- {NULL, 0, 0 }
- };
复制代码 3.2.6 修改ueventd.rc- diff --git a/system/core/rootdir/ueventd.rc b/system/core/rootdir/ueventd.rc
- old mode 100644
- new mode 100755
- index b1664f4..6f79380
- --- a/system/core/rootdir/ueventd.rc
- +++ b/system/core/rootdir/ueventd.rc
- @@ -7,7 +7,11 @@
- /dev/urandom 0666 root root
- /dev/ashmem 0666 root root
- /dev/binder 0666 root root
- -
- +/dev/ttyUSB0 0660 radio radio
- +/dev/ttyUSB1 0660 radio radio
- +/dev/ttyUSB2 0660 radio radio
- +/dev/ttyUSB3 0660 radio radio
- +/dev/ttyUSB4 0660 radio radio
- # Anyone can read the logs, but if they're not in the "logs"
- # group, then they'll only see log entries for their UID.
- /dev/log/* 0666 root log
复制代码 4.调试方法
如果系统调试过程中出现问题,可以通过在 cmd 中输入 adb shell 后进入 ADB 中,并输
入以下命令抓取 LOG 来分析:- $ netcfg
- $ logcat –b radio –v time
- $ getprop
- $ logcat –v time –s pppd
- $ logcat –v time
- $ 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
|
|