1

Problem:

I own an android device in a remote location that I use to run various tests and operations. I need to be able to send ADB commands while also connect the phone to a wired internet connection. For various reasons, I cannot connect the device to WiFi, nor can I root the device. Due to USB Enumeration structure, if I connect a USB hub to the phone with an Ethernet port and a USB connection to a PC, the options are either Phone in Host + Internet but no ADB, or phone in Peripheral mode with ADB but no ethernet connection.

What I have tried:

  • Setting adb tcpip 5555 to enable ADB over a network connection (TCP mode). This means connecting the phone through USB, setting adb tcpip 5555 to enable ADB over network, and then disconnecting the USB and replacing the connection with the Ethernet dongle in host mode. This works fine until the phone is rebooted and then manual intervention is needed.
  • Various USB dongle/hub set ups.
  • LADB workaround where the phone connects to itself through wireless ADB, then sets the adbd to TCP mode, etc. For this, I need a WiFi network so it does not meet the requirements. It's also very flaky.

What I want to do: I'm wondering if I can purchase a Raspberry Pi or some other microcontroller, and implement a solution using Session Request Protocol (SRP) and/or Host negotiation Protocol (HNP) described in On-The-Go (OTG) as follows:

  • Connect Android device using USB-C (as OTG cable) to companion device.
  • Connect companion device to internet through ethernet port
  • Setup states
  1. Software in Android/external code detects when adbd is in USB mode, and renegotiates the connection to Android being in device mode. Companion uses USB connection to send adb tcpip 5555.
  2. Once adbd is set to TCP mode, software (using getprop) checks that phone accepts ADB over network, and renegotiates the usb connection such that the Android is now Host, and accepts the companion device as an Ethernet dongle, and internet flows to the device.

This way, the network connection to the device (including sending ADB commands) remains stable even after device reset. There are also power considerations, but they are secondary.

3
  • I don't think that you can solve this problem in a reliable way. Instead I would try to establish a network connection using adb port forwarding. Install an HTTP proxy on the connected PC, forward the proxy port through adb to the device and then set the forwarded port as global proxy in Android. That way you should be able to establish some sort of reverse tethering without root.
    – Robert
    Mar 6 at 8:24
  • Thanks Robert. What you're saying is try to instead connect the android to the internet via a proxy port while maintaining the USB connection, right? Can you expand on what steps I should take to try to implement this solution? The only way I know of is using the VPN workaround, which causes a host of other problems.
    – K-man
    Mar 6 at 15:38
  • 1
    In short: Install proxy, use adb forward ... and finally configure proxy to localhost:forwarded_port. Never tried it so I am not sure if it will work as expected.
    – Robert
    Mar 6 at 15:44

0

You must log in to answer this question.