android4.0.4 增加ethernet
这个是对android4.0.3增加ethernet我是直接拿过来对android4.0.4增加,过程中有些是不同的,错误比较容易解决这里我就不作具体说明了。只是其中有一点需要修改的在这个地方:
2. system\core\libnetutils\dhcp_utils.c的 dhcp_do_request函数中,把
snprintf(daemon_cmd,sizeof(daemon_cmd),"%s","dhcpcd_wlan0");改成
snprintf(daemon_cmd,sizeof(daemon_cmd),"%s","dhcpcd_eth0");
要是改成这样无线网络就用不了,所以我稍微改了下
[java]
/* Erase any previous setting of the dhcp result property */
property_set(result_prop_name, "");
#if 0
/* Start the daemon and wait until it's ready */
if (property_get(HOSTNAME_PROP_NAME, prop_value, NULL) && (prop_value[0] != '\0'))
snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:-h %s %s", DAEMON_NAME, daemon_suffix,
prop_value, inte易做图ce);
else
snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:%s", DAEMON_NAME, daemon_suffix, inte易做图ce);
/////////// modfiy by dao ///////////////////////////////////
//snprintf(daemon_cmd,sizeof(daemon_cmd),"%s","dhcpcd_wlan0");
snprintf(daemon_cmd,sizeof(daemon_cmd),"%s","dhcpcd_wlan0");
//////////////////////////////////////////////////////////////
#else
#if 1
/* Start the daemon and wait until it's ready */
if (property_get(HOSTNAME_PROP_NAME, prop_value, NULL) && (prop_value[0] != '\0'))
//snprintf(daemon_cmd, sizeof(daemon_cmd), "%s:-h %s %s", DAEMON_NAME,
// prop_value, inte易做图ce);
snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s", DAEMON_NAME, inte易做图ce);
else
#endif
snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s", DAEMON_NAME, inte易做图ce);
#endif
memset(prop_value, '\0', PROPERTY_VALUE_MAX);
把原来的注释掉,然后改成上面那样。
同时在init.rc中加上这个服务:
[html]
service dhcpcd_eth0 /system/bin/dhcpcd -o domain_name_servers -dd -ABKL eth0
class main
disabled
oneshot
现在有线和无线就都能正常连接了。
补充:移动开发 , Android ,