因为工作需要,要求设备通过RTL8152外置网卡上网,但是驱动加载之后死活也不能建立连接。为此,在网上看到
第十一篇 ANDROID 系统网络连接和管理机制与架构_natureXin的博客-CSDN博客
这两篇文章。
尝试在 frameworks\base\core\res\res\values 下的 config.xml 添加
<string-array translatable="false" name="networkAttributes">
......
<item>"ethernet,9,9,9,-1,true"</item>
</string-array>
<string-array translatable="false" name="radioAttributes">
......
<item>"9,1"</item>
</string-array>
结果发现没有效果,几番尝试后发现应该在会覆盖,所以在以下文件也应该添加,
device/sprd/sharkle/common/overlay/frameworks/base/core/res/res/values/config.xml 。
并且在 device/sprd/sharkle/common/rootdir/root/init.common.rc 添加
#lichang
# DHCPCD
# # eth0
service dhcpcd_eth0 /system/bin/dhcpcd -ABKL
class main
disabled
oneshot
# IP Renew
# # eth0
service iprenew_eth0 /system/bin/dhcpcd -n
class main
disabled
oneshot
然后重新编译就可以了。
另外,我们用的 Android4.4 是支持 Ethernet 网络模式的,只是缺少了配置,在插入网卡加载完驱动后,会主动添加这种网络模式,如有其他的问题我们可以共同探讨。