This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

adb connect over windows

I'm attempting to get adb working over tcp so I don't need usb. adb connect over tcp works however when I disconnect the micro usb from host PC (running Windows), I cannot connect to the AM335 EVM

Here is the configuration

AM335 EVM running Android4.x

Host: Win XP

Using micro-USB the following cmds used to configure adb on target

setprop service.adb.tcp.port 5555 
stop adbd
start adbd

On Win host
adb connect 192.168.0.101

Any solution?

  • I guess its abd over ethernet via usb. you need to connect usb at same time you can access adb from other pc in connected in same LAN connection but i am not sure about it. consider this as additional point.

  • Try adding next line before adb connect command?

    export ADBHOST=<Board IP>

  • I did some more digging about the tcp connect. The adbd (adb daemon) that running on the EVM is stopped when the USB is disconnected. Here is the log when USB is disconnected and connected showing adbd is stopped

    D/Vold    (   68): Service ADBD stopped
    D/Vold    (   68): platform usb is disconnected,wake lock deleted
    D/dalvikvm(  216): GC_CONCURRENT freed 538K, 30% free 7067K/10055K, paused 3ms+s
    D/dalvikvm(  216): GC_CONCURRENT freed 498K, 31% free 6964K/10055K, paused 3ms+s
    D/Vold    (   68): mUsbPlatformConnected mode b_peripheral
    D/Vold    (   68): platform usb is connected,wake lock written!!!
    D/Vold    (   68): Service ADBD started
    E/UsbDeviceManager(  135): No known USB function in updateUsbNotification
    E/UsbDeviceManager(  135): No known USB function in updateUsbNotification
    D/dalvikvm(  216): GC_CONCURRENT freed 279K, 29% free 7159K/10055K, paus

  • Then that means that doing "adb connect x.x.x.x" again should reestablish the communication? in the device the adbd service should be restarted by default if no modifications were made to how adbd is started.

    You may try without connecting the USB cable at all.

  • I think what I'm seeing is that adbd is started only when usb is connected.

  • I see,I checked this code for GB before but not for ICS, it changed.

    In ICS there are some locks for USB as you mention, by what it says you could try from serial terminal

    setprop service.adb.root 1

    to go for the option to restart the service when disconnecting the USB, I mean it seems a side effect of setting the property there are no checks for restart adbd.

    The other change could be to modify init.rc to start it by default and remove the USB conditions that turn if off/on for USB events, it is mentioned that this behavior is to be used when Board bring up. At least this is what I can think in order to enable it, modfiying init.rc procedure could vary.

    The conditions to enable adbd from GB are not valid anymore.

  • But setting the root property could be not possible if the console is started as user and not as root, try doing su command to see if root access is possible from serial terminal.

  • Here is what I tried. I created a file adb_restart.sh with the following content

    setprop service.adb.tcp.port 5555                                                          
    setprop service.adb.root 1

    chmod 777 adb_restart.sh

    The I appended the following line at the end of init.rc

    sh adb_restart.sh

    adb daemon still does not start when device is powered up with usb disconnected. Any ideas?

  • You can try:

    1. doing chmod to x bit on the script, it could require access as root user if you are using terminal, or change the user  for console command in init.rc.

    2. adding the command inside init.rc when adbd commands are called, you can find information about init.rc in /mydroid/system/core/init/readme.txt.

    3. at build time in

    /mydroid/device/ti/blaze/system.prop

    or

    /mydroid/device/ti/blaze_tablet/system.prop

    Did it work using the command from terminal and root user? is adbd working without USB cable connected?

  • Please excuse me, I misunderstood the question, I thought it was about permissions running the script.

    The way that seems to work without modifying init.rc is

    1. booting the device

    2. check netcfg for IP address, IP changes every boot time,

    3. at terminal by default for me is giving root user, do

    setprop service.adb.tcp.port 5555                                                          
    setprop service.adb.root 1

    4. from PC terminal, like I did many tries I do next to clean the values (tried adding sudo)

    ./adb kill-server

    ./adb start-server

    5. then

    ./adb connect x.x.x.x

    and the result is connected.

    connected to x.x.x.x:5555

    I didn't tried using the script but then my previous post should apply ok.

  • What are the changes need to be made to init.rc so adb daemon always run?

    -Preyas

  • The last time I tried to modify init.rc and init.omap4blazeboard.rc to get it running but all that I tried didn't work.

    In next 2 files are all the rules in order to use adb and adbd, at least the most important.

    /mydroid/system/core/adb/adb.c
    /mydroid/system/core/adb/services.c

    In function adb_main in adb.c there is a comment almost at the end of the function that says USB is used when either service.adb.tcp.port or persist.adb.tcp.port are not set, the comment in the source code explains it better, but basically by defining the TCP port property is getting ETHERNET connection to work instead of USB one. Later when root property is changed it causes adbd to restart and use ETH instead of USB connection.

    Then I think adding TCP port property configuration in init.rc should do the trick, matter to test it without setting root property, I haven't tried it yet.

    There are more rules that you may need to check for definitive solution, one of them is not enabling ADB in production devices and related to secure property.

    Other possibility is to contact Google's forum to avoid modifying init.rc in some incorrect way if you plan to add this change in a production device.

  • Manuel, setting the service.adb.tcp.port property solved the problem. Thanks. Here is the snippet for AM335xevm_sk init.rc

    on boot

    # set ADB tcp port
        setprop service.adb.tcp.port 5555
     
    # basic network init
        ifup lo

    .......