技术专栏
全志平台华为4G模块调试记录1
1. 前言
因为需要适配4G模块,这里总结下整个调试过程;
2. linux部分
linux 部分主要是硬件识别,当拿到模块后,插入板子上,打印如下:
[ 185.120132] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[ 185.141610] usb 3-1: New USB device found, idVendor=12d1, idProduct=15c1
[ 185.149447] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 185.157830] usb 3-1: Product: HUAWEI Mobile V7R11
[ 185.164667] usb 3-1: Manufacturer: Huawei Technologies Co., Ltd.
[ 185.171450] usb 3-1: SerialNumber: 0123456789ABCDEF
[ 185.251621] cdc_ether 3-1:2.0 usb0: register 'cdc_ether' at usb-xhci-hcd.0.auto-1, CDC Ethernet Device, 02:1e:10:1f:00:00
[ 185.271723] option 3-1:2.2: GSM modem (1-port) converter detected
[ 185.286827] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 185.295963] option 3-1:2.3: GSM modem (1-port) converter detected
[ 185.304478] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 185.313672] option 3-1:2.4: GSM modem (1-port) converter detected
[ 185.320886] CPU1: Booted secondary processor
[ 185.320886] CPU1: update cpu_power 1024
[ 185.332151] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 185.341133] option 3-1:2.5: GSM modem (1-port) converter detected
[ 185.350048] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 185.358760] option 3-1:2.6: GSM modem (1-port) converter detected
[ 185.367116] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB4
从打印可以看出如下信息:
(1)USB串口驱动正常工作,设备加载正常。
(2)CDC ECM驱动正常工作。
(3)一共生成了5个虚拟的串口。
3. android部分
3.1 RIL库的移植
在init.rc中添加服务如下:service ril-daemon /system/bin/rild -l libhuawei-ril.so
其中rild源码在/hardware/ril/rild/目录下,
然后将libhuawei-ril.so放到system/lib/目录中,在device/softwinner/common/目录下,新建文件夹LTE/,在该目录中添加文件firmware-LTE.mk,
然后将libhuawei-ril.so文件放入该目录,在firmware-LTE.mk中添加内容如下:
修改device/softwinner/petrel-p1,添加内容如下:
3.2 修改使用的USB或者PCM端口的权限
device/softwinner/petrel-p1目录中,添加如下内容:
3.3 手动测试模组拨号过程
(1)这时候可以借用SDK中PPP源码(对应目录为external/ppp)编译出来的pppoe可执行程序。
首先将部分linux-ppp-script中的相关文件拷贝到SDK中的对应目录,如下:
(2)同时,需要修改huawei-ppp-on脚本,内容如下:
#!/bin/sh
#
# Script to initiate a ppp connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
# Modify: fangxiaozhi <huananhu@huawei.com>
programName=${0##*/}
# These are the parameters. Change as needed.
#DEVICE=/dev/usb/tts/0
#DEVICE=/dev/ttyACM0 #The modem file name of the data card
DEVICE=/dev/ttyUSB0 #The modem file name of the data card
TELEPHONE=*99# # The telephone number for the connection, by default, it will be *99#
ACCOUNT="" # The account name for logon, by default, it will be null
PASSWORD="" # The password for this account, by default, it will be null
AUTH="" # Authentic protocol,byi default, it will be null
APN=1234
STR_USER="user \"card\""
STR_PASSWD="password \"card\""
show_usage(){
echo "usage:"
echo " $programName [--usr=username] [--pwd=password] [--pn=phonenumber][--apn=apn][--auth=authentic protocol]"
echo " [--local_ip=local_ip] [--remote_ip=remote_ip] [--usepeernds=usepeernds]"
echo "username: The account name get from your ISP, by default, it will be null"
echo "password: The password for your account, by default, it will be null"
echo "phonenumber: The phone number for dialing up, by default, it will be *99#"
echo "apn: access point name"
echo "auth: chap/pap. for example: --auth=chap"
exit 0
}
PID=`ps -ef | grep -v grep | grep "huawei-dial" | grep "pppd" | busybox awk '{ print $2; exit }'`
if test $PID; then
echo "PPP link is active"
exit 1
fi
if [ $# -eq 1 -a "$1" = "--help" ]
then
show_usage
fi
for i in "$@"
do
case $i in
--device=*)
echo "--device*=$i"
DEVICE=${i#--device=}
;;
--usr=*)
echo "--usr*=$i"
ACCOUNT=${i#--usr=}
;;
--pwd=*)
echo "--pwd*=$i"
PASSWORD=${i#--pwd=}
;;
--pn=*)
echo "--pn*$i"
TELEPHONE=${i#--pn=}
;;
--apn=*)
echo "--apn*=$i"
APN=${i#--apn=}
;;
--auth=*)
echo "--auth*=$i"
AUTH=${i#--auth=}
if [ "$AUTH" = "chap" ]; then
AUTH=-pap
fi
if [ "$AUTH" = "pap" ]; then
AUTH=-chap
fi
;;
--local_ip=*)
echo "--local_ip*=$i"
PAR_LOCAL=${i#--local_ip=}
;;
--remote_ip=*)
echo "--remote_ip*=$i"
PAR_REMOTE=${i#--remote_ip=}
;;
--usepeernds=*)
echo "--usepeernds*=$i"
PAR_USEERDNS=${i#--usepeernds=}
;;
*)
echo "*=$i"
esac
done
if [ "$PAR_LOCAL" = "" ]; then
LOCAL_IP=0.0.0.0
else
LOCAL_IP=$PAR_LOCAL
fi
if [ "$PAR_REMOTE" = "" ]; then
REMOTE_IP=0.0.0.0
else
REMOTE_IP=$PAR_REMOTE
fi
if [ ! "$PAR_USEERDNS" = "" ]; then
USEPEERDNS=''
for NAMESERVER in `echo $PAR_USEERDNS | awk -F: '{for (i=1;i<=NF;i++) print $i}'`
do
echo "nameserver $NAMESERVER" >> /etc/ppp/resolv.conf
done
else
USEPEERDNS='usepeerdns'
fi
NETMASK=255.255.255.0 # The proper netmask if needed
#
# Export them so that they will be available at 'ppp-on-dialer' time.
export TELEPHONE APN ACCOUNT PASSWORD
#
# This is the location of the script which dials the phone and logs
# in. Please use the absolute file name as the $PATH variable is not
# used on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)
#
# Initiate the connection
#
# I put most of the common options on this command. Please, don't
# forget the 'lock' option or some programs such as mgetty will not
# work. The asyncmap and escape will permit the PPP link to work with
# a telnet or rlogin connection. You are welcome to make any changes
# as desired. Don't use the 'defaultroute' option if you currently
# have a default route to an ethernet gateway.
#
if [ ! -d "/data/ppp" ]
then
mkdir /data/ppp
fi
if [ -f "/data/ppp/options" ]
then
echo "" > /data/ppp/options
fi
if [ -f "/data/ppp/pap-secrets" ]
then
chmod 700 /data/ppp/pap-secrets
fi
if [ -f "/data/ppp/chap-secrets" ]
then
chmod 700 /data/ppp/chap-secrets
fi
if [ ! "$ACCOUNT" = "" ]
then
echo "$ACCOUNT * $PASSWORD *" > /data/ppp/pap-secrets
echo "$ACCOUNT * $PASSWORD *" > /data/ppp/chap-secrets
STR_USER="user \"$ACCOUNT\""
STR_PASSWD="password \"$PASSWORD\""
else
echo "* * * *" > /data/ppp/pap-secrets
echo "* * * *" > /data/ppp/chap-secrets
fi
chmod 400 /data/ppp/pap-secrets
chmod 400 /data/ppp/chap-secrets
if [ "$TELEPHONE" = "*99#" ]; then
echo " ABORT \"NO CARRIER\"
ABORT \"NO DIALTONE\"
ABORT \"ERROR\"
ABORT \"NO ANSWER\"
ABORT \"BUSY\"
ABORT \"Username/Password Incorrect\"
\"\" AT
\"OK-+++\c-OK\" ATH0
OK AT+CGDCONT=1,\"IP\",\"$APN\"
OK ATDT$TELEPHONE
CONNECT \"\"
" > /data/ppp/huawei-chat
fi
if [ "$TELEPHONE" = "#777" ]; then
echo -e "at^pppcfg=\"$ACCOUNT\",\"$PASSWORD\"\r\n" > $DEVICE
echo " ABORT \"NO CARRIER\"
ABORT \"NO DIALTONE\"
ABORT \"ERROR\"
ABORT \"NO ANSWER\"
ABORT \"BUSY\"
TIMEOUT 120
ABORT \"Username/Password Incorrect\"
\"\" AT
OK ATDT#777
CONNECT \"\"
" > /data/ppp/huawei-chat
fi
if [ ! -d "/data/ppp/peers" ]
then
mkdir /data/ppp/peers
fi
echo "$DEVICE
115200
crtscts
modem
debug
nodetach
usepeerdns
noipdefault
defaultroute
$LOCAL_IP:$REMOTE_IP
$STR_USER
$STR_PASSWD
noauth
$AUTH
-mschap
-mschap-v2
ipcp-accept-local
ipcp-accept-remote
connect '/system/bin/chat -s -v -f /data/ppp/huawei-chat'
" > /data/ppp/peers/huawei-dial
#/bin/cp ./ip-up /etc/ppp/ip-up
#/bin/cp ./ip-down /etc/ppp/ip-down
exec /system/bin/pppoe call huawei-dial&
exit 0
(3)需要修改external/pppd/pathname.h文件
#define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/"
改成
#define _PATH_PEERFILES _ROOT_PATH "/data/ppp/peers/"
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
96
8
评论
打赏
- 分享
- 举报
评论
0个
手气红包
暂无数据
相关专栏
-
浏览量:6549次2021-01-08 15:16:17
-
浏览量:4264次2020-09-23 19:01:05
-
浏览量:10312次2020-11-26 15:59:29
-
浏览量:8449次2020-11-26 14:22:19
-
浏览量:11378次2020-12-16 19:13:45
-
浏览量:11011次2020-12-16 18:56:54
-
浏览量:6934次2020-11-26 17:02:47
-
浏览量:8797次2020-09-08 19:26:12
-
浏览量:6250次2021-01-15 17:26:20
-
浏览量:8394次2021-01-20 17:16:00
-
浏览量:10190次2021-01-22 16:07:20
-
浏览量:4938次2022-10-14 08:34:42
-
浏览量:8412次2021-01-20 17:04:49
-
浏览量:7066次2020-09-10 09:46:52
-
浏览量:6778次2020-09-28 16:30:39
-
浏览量:1985次2020-12-30 16:54:40
-
浏览量:6982次2021-01-22 15:28:47
-
浏览量:1478次2024-01-12 15:17:33
-
浏览量:14568次2021-01-16 15:43:02
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者
free-jdx
您的支持将鼓励我继续创作!
打赏金额:
¥1
¥5
¥10
¥50
¥100
支付方式:
微信支付
打赏成功!
感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注