Android 5.1.1,how to enable Ethernet network?

4,554 views
Skip to first unread message

Uy Van Duc

unread,
Oct 22, 2015, 10:36:09 AM10/22/15
to android-porting
Dear All,
I built android 5.1.1 and boot up on my development board. but no Ethernet network show in System Setting. Browser not work because DNS problem.
I think it would be some permission problem. but don't know how to define.

Checked at console, and i see there is no problem of ethernet. dhcp work fine and ip address was set correct.
DNS resolver not enable, so after set ndc resolver setnetdns eth0 "" 8.8.8.8. it can resolve but ROOT only.
for normal user, still unknown host.

Question:
1. if i want to enable Ethernet for Android 5.1.1, which step i need to do?
2. how is correct way to set DNS resolver for eth0
3. which parameters that we can use setprop/getprop to check problem?

Thanks
Uy

Vishal Mahaveer

unread,
Oct 22, 2015, 11:10:15 AM10/22/15
to android-porting
Make sure you have Ethernet hardware permission for your device.

Below lines in your device.mk

PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml

Uy Van Duc

unread,
Oct 26, 2015, 10:03:32 AM10/26/15
to android-porting
Thanks Vishal for answer,

I already have and checked in running system.

$ cat /system/etc/permissions/android.hardware.ethernet.xml                         <
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at


     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- This is the standard feature indicating that the device includes ethernet. -->
<permissions>
    <feature name="android.hardware.ethernet" />
</permissions>

Do we need any other parameter?

Thanks
Uy

Vishal Mahaveer

unread,
Oct 27, 2015, 10:52:02 AM10/27/15
to android-porting
Hi,

I don't have an Ethernet UI, but I have internet working on Ethernet.

Check if you have ethernet defined in "networkAttributes" and "radioAttributes" in frameworks config file.
device/<vendor>/<product>/overlay/frameworks/base/core/res/res/values/config.xml

Also make sure you have dhpcpcd_eth0 service defined in your init.rc.

Uy Van Duc

unread,
Oct 28, 2015, 4:33:07 PM10/28/15
to android-porting
Hi,
checked overlay and i have this
 <string-array translatable="false" name="networkAttributes">
        <item>"wifi,1,1,1,-1,true"</item>
        <item>"wifi_p2p,13,1,0,-1,true"</item>
        <item>"ethernet,9,9,2,-1,true"</item>
    </string-array>

    <!-- This string array should be overridden by the device to present a list of radio
         attributes.  This is used by the connectivity manager to decide which networks can coexist
         based on the hardware -->
    <!-- An Array of "[ConnectivityManager connectionType],
                      [# simultaneous connection types]"  -->
    <string-array translatable="false" name="radioAttributes">
        <item>"1,1"</item>
        <item>"9,1"</item>
    </string-array>

My init.rc also have following part at on boot sections

service dhcpcd_eth0 /system/bin/dhcpcd -aABDKL
    class main
    group dhcp
    oneshot

service iprenew_eth0 /system/bin/dhcpcd -n
     class late_start
     disabled
     oneshot

but i always get net::ERR_NAME_NOT_RESOLVED at browser.

checked from console using ifconfig and ip route, i can see all are corrected at kernel level.

but check systemprop seem not work.

# getprop | grep net
[ethernet.interface]: [eth0]
[gsm.network.type]: [Unknown]
[init.svc.netd]: [running]
[net.bt.name]: [Android]
[net.change]: [net.qtaguid_enabled]
[net.hostname]: [android-101222c089f1aeac]
[net.qtaguid_enabled]: [1]
[net.tcp.default_init_rwnd]: [60]


Any Ideas?
Thanks
Uy
Reply all
Reply to author
Forward
0 new messages