Search code examples
androidadbpingandroid-sourceethernet

Ping and others over ethernet eth0 interface on Android


I have a Android 7.1.2 development kit with one USB for ADB access. For my project, I need to connect a ethernet interface on this USB.

OK, I have used a USB/Ethernet and setup the init.rc to up my IP on eth0.

When connected the eth from kit directly to my laptop, and access the ADB shell via Wifi, its possible execute the command from Android:

ping -I eth0 172.17.140.81
(where 172.17.140.81 is the laptop IP) and it works! - they have a ping response

But in the laptop shell, making the same (to the kit IP obviesly), the kit do not response. Executing via Wifi IP's, both they its ok.

When, after trying ping from laptop, exec a ifconfig in ADB shell, its possible to see RX packets of eth0 interface increasing, and some TX packets too.

Its have some configuration, propriety or service to able for this eth0 works like the wlan interface?

The final purpose is to get ADB / SSH connection on ethernet.

Thanks for the helpping and best reg.


Solution

  • I did solve this problem with support and some steps.

    Previously, I did have configure/compile the kernel with SMSC Usb/Ethernet support.

    1 - Receiving a source code update packet from manufacturer of the module (in my case, Quectel). They did send me some patches file to made modification on the AOSP source code. So, to apply this was necessary remove all git and repo files from directory, and create a new git on root of the source. Then aply the patches with git am.

    2 - With the ifconfig command to set the static IP on ethernet, the ping and ssh only had works if the wi-fi was turned off. That is, that mean the route on some framework of ethernet doesn't was correctly configured with ifconfig command (that 's was what I used in the script called by init.)rc.

    To set correctly the ethernet ip, and work with the wifi and ethernet both on, I needed set it on the UI on the touchscreen display of the kit, accessing by the 'configurations', ethernet, etc..

    It's possible too define the default IP on ethernet in the file: packages/apps/Settings/src/com/android/settings/ethernet/EthernetDielog.java

    With a command like a normal Linux terminal, I dont discovery how to do. I hope that can be useful for someone...someday..rsrs.