RK: 调试4G模块 合宙Air720

合宙4G 模块 安卓RIL驱动 https://doc.openluat.com/article/1099
安卓ril 无法上网初步分析 https://doc.openluat.com/article/590/0
4G模块Air720系列 android RIL驱动源码发布! http://oldask.openluat.com/article/95

 

一.Android RIL对应的驱动

编译ril   hardware\ril\reference-ril\

ip-up

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>

static int property_set(const char *key, const char *value) {
    char cmd[128];
    snprintf(cmd, sizeof(cmd), "/system/bin/setprop %s %s", key, (value && value[0]) ? value : "\"\"");
    return system(cmd);
}

int main(int argc, char *argv[]) {
    argc = argc;
    argv = argv;    
    char *dns1 = getenv("DNS1");
    char *dns2 = getenv("DNS2");
    char *iplcocal = getenv("IPLOCAL");
    char *ipremote = getenv("IPREMOTE");

	system("/system/bin/setprop net.dns1 8.8.8.8");
	system("/system/bin/setprop net.dns1 8.8.8.8");
	system("/system/bin/setprop net.dns1 8.8.8.8");

    property_set("net.ppp0.dns1", dns1 ? dns1 : "");
    property_set("net.ppp0.dns2", dns2 ? dns2 : "");
    property_set("net.ppp0.local-ip", iplcocal ? iplcocal : "");
    property_set("net.ppp0.remote-ip", ipremote ? ipremote : "");
    property_set("net.ppp0.gw", ipremote ? ipremote : "");
	system("/system/bin/ip route add default dev ppp0 table ppp0");
	system("/system/bin/ip route add default dev ppp0 table ppp0");
	system("/system/bin/ip route add default dev ppp0 table ppp0");
	system("/system/bin/ip route add default dev ppp0 table ppp0");
	system("/system/bin/ifconfig wlan0 down");
	system("/system/bin/ifconfig wlan0 down");
	system("/system/bin/ifconfig wlan0 down");
    return 0;
}

  

 二.安卓ril 无法上网初步分析 https://doc.openluat.com/article/590/0

1.2.1. 有分配IP,则在命令行 输入ifconfig 查看是否出现ppp0 网卡

1.2.2. 出现ppp 输入 ping 115.239.210.27

1.2.3. 出现 connect:Networkis unreachable 则输入命令 ip route add default dev ppp0 table ppp0 ,然后再 ping ,如果能 ping 通 这是路由问题,需要修改ip-up 文件

1.2.4. 可以ping 通 则输入 ping www.baidu.com ,如果出现 pingunknown host www.baidu.com 则 是dns 解析问题

 

 

三.调试4G模块 Air720 未成功!

问题:ppp 拨号后需要设置成默认路由才可以上网

posted @ 2021-04-21 16:20  CrushGirl  阅读(742)  评论(0编辑  收藏  举报