在android 4.2.2上调试MU609步骤

1.修改kernel\drivers\usb\serial\option.c,添加MU609的ID号
[cpp]  view plain copy
  1. #define HUAWEI_PRODUCT_E353   0x1506  
[cpp]  view plain copy
  1. 更新了firmware之后ID号改为:  
[cpp]  view plain copy
  1. #define HUAWEI_PRODUCT_E353   0x1573  


2.对kernel进行配置,make menuconfig打开以下几项

[html]  view plain copy
  1. Device Drivers -> USB support -> USB Serial Converter support -> <*> USB driver for GSM and CDMA modems  
  2. Device Drivers -> Network device support -> PPP (point-to-point protocol) support -> <*> PPP MPPE compression (encryption) (EXPERIMENTAL)  
  3. Device Drivers -> Network device support -> PPP (point-to-point protocol) support -> <*> PPP support for async serial ports  

第一个选项打开之后开机就会识别到MU609为GSM modem,否则只会看到有USB插拔的信息,不会识别为GSM MODEM,正确识别后的Log如下:

[html]  view plain copy
  1. <6>[    1.929557] usb 3-1: new high-speed USB device number 2 using exynos-xhci  
  2. <6>[    1.949389] usb 3-1: New USB device found, idVendor=12d1idProduct=1506  
  3. <6>[    1.949483] usb 3-1: New USB device strings: Mfr=3Product=2SerialNumber=0  
  4. <6>[    1.949595] usb 3-1: Product: HUAWEI Mobile  
  5. <6>[    1.949645] usb 3-1: Manufacturer: Huawei Technologies  
  6. <6>[    1.949950] mmc_host mmc1: Bus speed (slot 0) = 25000000Hz (slot req 400000Hz, actual 390625HZ div = 32)  
  7. <6>[    1.956711] option 3-1:1.0: GSM modem (1-port) converter detected  
  8. <6>[    1.956911] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0  
  9. <6>[    1.957187] option 3-1:1.1: GSM modem (1-port) converter detected  
  10. <6>[    1.957353] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1  
  11. <6>[    1.957588] option 3-1:1.2: GSM modem (1-port) converter detected  
  12. <6>[    1.957729] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2  

第二和第三个选项打开之后pppd才可以建立ppp0接口,否则logcat会出现如下pppd错误信息:

[plain]  view plain copy
  1. Couldn't set tty to PPP discipline: Invalid argument  

此时虽然rild已经运行,apn也设置好了但是仍旧无法上网,netcfg看不到ppp0接口。

 

3.copy libhuawei-ril.so,ip-up,ip-down到指定位置,修改device.mk,添加:

[plain]  view plain copy
  1. # stone add mu609  
  2. PRODUCT_COPY_FILES += \  
  3.     $(LOCAL_PATH)/mu609/libhuawei-ril.so:system/lib/libhuawei-ril.so \  
  4.     $(LOCAL_PATH)/mu609/ip-up:system/etc/ppp/ip-up \  
  5.     $(LOCAL_PATH)/mu609/ip-down:system/etc/ppp/ip-down \  
  6.     $(LOCAL_PATH)/mu609/chat:system/bin/chat \  
  7.     $(LOCAL_PATH)/mu609/busybox:system/bin/busybox  

最后两个chat和busybox是为了调试方便加进去的。

4.修改android\system\core\rootdir\init.rc,添加ttyUSB权限和ril的加载

[plain]  view plain copy
  1. on boot  
  2. # stone add mu609  
  3.     chmod 777 /dev/ttyUSB0  
  4.     chmod 777 /dev/ttyUSB2  
  5.     chmod 777 /etc/ppp/ip-up  
  6.     chmod 777 /etc/ppp/ip-down  
  7.   
  8. # stone modify mu609  
  9. service ril-daemon /system/bin/rild -l libhuawei-ril.so  

 

5.修改android\hardware\ril\rild\rild.c,按照mu609 porting guide屏蔽掉switchUser();这行代码,如果不屏蔽掉会出现手动拨号正常,但是android下提示pppd缺少模块的情况,如下:

[plain]  view plain copy
  1. E/pppd    ( 2082): This system lacks kernel support for PPP.  This could be because  
  2. E/pppd    ( 2082): the PPP kernel module could not be loaded, or because PPP was not  
  3. E/pppd    ( 2082): included in the kernel configuration.  If PPP was included as a  
  4. E/pppd    ( 2082): module, try `/sbin/modprobe -v ppp'.  If that fails, check that  
  5. E/pppd    ( 2082): ppp.o exists in /lib/modules/`uname -r`/net.  
  6. E/pppd    ( 2082): See README.linux file in the ppp distribution for more details.  


到此就已经porting完了,如果出问题了还要排查,现在从底层开始一步步排查验证。

1.首先要确定mu609模块识别到了没有,可以在shell下busybox lsusb查看usb设备,如果出现如下信息,就是已经识别到mu609了。

[plain]  view plain copy
  1. shell@android:/ # busybox lsusb  
  2. Bus 003 Device 002: ID 12d1:1506  


2.查看ttyUSB接口属性是否修改为0777

[plain]  view plain copy
  1. shell@android:/ # ll /dev/ttyUSB*  
  2. crwxrwxrwx root     root     188,   0 2013-05-15 12:01 ttyUSB0  
  3. crw------- root     root     188,   1 2013-05-15 12:00 ttyUSB1  
  4. crwxrwxrwx root     root     188,   2 2013-05-15 12:00 ttyUSB2  

 

3.模块已经识别了,ttyUSB接口都有,现在手动发AT命令看mu609是否响应。

[plain]  view plain copy
  1. shell@android:/ # cd /dev/  
  2. shell@android:/dev # cat ttyUSB0 &                                               
  3. [1] 869  
  4. shell@android:/dev # echo AT+CGMI > ttyUSB0                                      
  5. shell@android:/dev #   
  6.   
  7. Huawei Technologies Co., Ltd.  
  8.   
  9.   
  10.   
  11. OK  
  12.   
  13.   
  14. shell@android:/dev # echo AT+CGMM > ttyUSB0                                      
  15. shell@android:/dev #   
  16.   
  17. MU609  
  18.   
  19.   
  20.   
  21. OK  
  22.   
  23.   
  24. shell@android:/dev #   

OK,mu609正常响应了。

4.现在先抛开上层RIL不管,单纯从shell手动拨号看能否正常工作。需要自己写两个脚本,拷贝到/etc/ppp目录下
第一个脚本是/etc/ppp/chat/unicom,内容如下:

[plain]  view plain copy
  1. # this is the chat script for unicom  
  2. ABORT "NO CARRIER"  
  3. ABORT "NO DIALTONE"  
  4. ABORT "ERROR"  
  5. ABORT "NO ANSWER"  
  6. ABORT "BUSY"  
  7. TIMEOUT 120  
  8. "" at  
  9. OK AT+CGDCONT=1,"IP","3gnet"  
  10. OK atdt*99***1#  
  11. CONNECT  

第二个脚本是/etc/ppp/peers/unicom,内容如下:

[plain]  view plain copy
  1. # /system/etc/ppp/peers/unicom  
  2. /dev/ttyUSB0  
  3. 115200  
  4. crtscts  
  5. connect '/system/bin/chat -s -v -f /system/etc/ppp/chat/unicom'  
  6. debug  
  7. nodetach  
  8. ipcp-accept-local  
  9. ipcp-accept-remote  
  10. defaultroute  
  11. usepeerdns  
  12. user card  
  13. password card  

chat和peers两个目录没有,需要自己mkdir。还需要用到chat,就是之前在device.mk中copy过来的,android自身不带,在我的资源中有编译好的。因为rild一开始就会启动,把pppd搞起来,影响手动拨号,所以要先把rild改个名字,这样rild服务就不会起来了

[plain]  view plain copy
  1. mv /system/bin/rild /system/bin/ril-d  

改完后记得重启机器。好了,现在可以手动拨号了:

[plain]  view plain copy
  1. shell@android:/ # pppd call unicom &  
  2. [1] 912  
  3. shell@android:/ # abort on (NO CARRIER)  
  4. abort on (NO DIALTONE)  
  5. abort on (ERROR)  
  6. abort on (NO ANSWER)  
  7. abort on (BUSY)  
  8. timeout set to 120 seconds  
  9. send (at^M)  
  10. expect (OK)  
  11. ^M  
  12. OK  
  13.  -- got it  
  14.   
  15. send (AT+CGDCONT=1,"IP","3gnet"^M)  
  16. expect (OK)  
  17. ^M  
  18. ^M  
  19. OK  
  20.  -- got it  
  21.   
  22. send (atdt*99***1#^M)  
  23. expect (CONNECT)  
  24. ^M  
  25. ^M  
  26. CONNECT  
  27.  -- got it  
  28.   
  29. shell@android:/ #  

好了,到这里就算是拨号成功了,然后看ppp0接口是否建立。

[plain]  view plain copy
  1. shell@android:/ # netcfg  
  2. ip6tnl0  DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00  
  3. lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00  
  4. ppp0     UP                              10.105.219.114/32  0x000010d1 00:00:00:00:00:00  
  5. sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00  
  6. shell@android:/ #   

好了,ppp0接口也建立了,ip地址也获得了,ping一下baidu试试看。

[plain]  view plain copy
  1. shell@android:/ # ping www.baidu.com     
  2. PING www.a.shifen.com (220.181.112.143) 56(84) bytes of data.  
  3. 64 bytes from 220.181.112.143: icmp_seq=1 ttl=48 time=164 ms  
  4. 64 bytes from 220.181.112.143: icmp_seq=2 ttl=48 time=172 ms  
  5. 64 bytes from 220.181.112.143: icmp_seq=3 ttl=48 time=160 ms  
  6. ^C64 bytes from 220.181.112.143: icmp_seq=4 ttl=48 time=148 ms  
  7.   
  8. --- www.a.shifen.com ping statistics ---  
  9. 4 packets transmitted, 4 received, 0% packet loss, time 3005ms  
  10. rtt min/avg/max/mdev = 148.703/161.427/172.377/8.508 ms  
  11. shell@android:/ #  

OK,一切正常,现在可以确定拨号没有问题了,剩下验证android上层ril是否工作正常了。

 

5.把rild的名字改回来,进入系统设置一下APN,

[plain]  view plain copy
  1. APN:3gnet  
  2. MCC:460  
  3. MNC:01  

保存,然后重启,起来后就可以在状态栏看到3G的图标了,当然要打开“启动数据网络”选项。
如果没有工作,就"logcat -b radio &"看一下ril的log,ril是否认到ttyUSB的接口了。

调试时候经常用到的几个小命令。
netcfg : 查看当前所有网络接口
getprop net.dns1 : 查看dns(有时候dns不对也会上不了网,比如8.8.8.8,这时候需要修改pppd)
logcat -s pppd : 查看pppd log
logcat -b radio &: 查看radio log
cat ttyUSB0 &然后echo AT+CMD > ttyUSB0: 对modem发命令看是否有应答。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
Android 4.2.2通用升级包是为了提升Android 4.2.2操作系统的性能和功能而推出的更新版本。通常,Android设备厂商会在发现操作系统存在漏洞、安全问题或者希望增加新功能时发布这样的升级包。 通过安装Android 4.2.2通用升级包,用户可以享受到一些列的改进。例如,在新版本中,可能会修复一些已知的漏洞和安全问题,以保证用户在使用过程中的安全性。此外,还有可能改善系统的稳定性和流畅度,提升用户的使用体验。 另外,Android 4.2.2通用升级包也可能会增加一些新功能和特性。这些功能可能包括更好的通知管理、更快的界面响应速度、更强大的多任务处理能力、更好的电池管理以及更全面的隐私保护等。这些功能的增加可以让用户在使用设备时更加便利和舒适。 为了安装Android 4.2.2通用升级包,用户需要先下载升级包文件,并将其保存到设备的存储空间中。然后,在设备的设置菜单中,找到软件更新选项,并点击检查更新。系统会自动检测到升级包文件的存在,并询问用户是否愿意安装更新。用户可以选择同意,并等待系统完成更新过程。 需要注意的是,在升级过程中,用户的设备可能需要重启一次或者在一段时间内无法使用。因此,在安装升级包之前,用户应该备份好设备中的重要数据,以防止数据丢失。另外,在升级过程中,用户还应该确保设备有足够的电量,以避免升级被中断。 总之,Android 4.2.2通用升级包是为了改善操作系统的性能和功能而发布的更新版本。用户可以通过下载和安装升级包来享受到更好的安全性、稳定性和功能体验。但在升级前,用户需要备份数据并确保设备有足够的电量。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值