5

I can successfully execute ADB commands, but if the command has no output the command line just waits there and does not let me enter a new command until I press ctrl-c, the commands do work however. Is there anyway to prevent the command line waiting forever until I press ctrl-c?

Here is an example of what I mean. I have entered this command, and the command line waits there forever until I press ctrl-c

enter image description here

I am using Windows xp and the phone I am using is an HTC Incredible

6
  • I just tested this, with the latest SDK tools, connected to my FireTV (over TCP) my command runs and exits right after. Maybe it has to do with the device. Mar 11, 2015 at 0:57
  • can you try it as separate commands: first connect to adb shell, then in the shell run "input keyevent 22" and see if that command hangs. If not, it may have to do with the ADBD that runs on the device. Mar 11, 2015 at 0:59
  • @RyanConrad how do I connect to the shell first?
    – Arya
    Mar 11, 2015 at 1:10
  • run adb shell. then you will see $ (or something like that). From there run input keyevent 22 and see if that "waits" or if it then brings you back to the $. Mar 11, 2015 at 1:13
  • @RyanConrad it just waits there. It probably has to do with the device then.
    – Arya
    Mar 11, 2015 at 1:15

2 Answers 2

2

@Swing's solution works, but requires more information to be useful.

Running

netstat -nao | findstr 5037

will display all connections on port 5037, which is the TCP port that ADB daemon runs on.

Terminal should output something like this:

  TCP    127.0.0.1:3592         127.0.0.1:5037         ESTABLISHED     9984
  TCP    127.0.0.1:3603         127.0.0.1:5037         ESTABLISHED     6204
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       9904
  TCP    127.0.0.1:5037         127.0.0.1:3592         ESTABLISHED     9904
  TCP    127.0.0.1:5037         127.0.0.1:3603         ESTABLISHED     9904

The last column of numbers (like 9904) is the PID or Process ID that is running on the port that ADB uses. In some cases ADB doesn't end its previous process and cause future instances to hang/wait like you described.

If you're on Windows, open Task Manager, click Details, and find the matching ID in the PID column. Right click the process and end it, and try your adb command again.

1

use this command to find out if port 5037 is used by another process:

netstat -nao | findstr 5037

if in use, kill that process, than try it again.

1
  • 1
    Can you give some background on that? What is port 5037 for? Where is that command to be executed? Moreover, OP states the ADB command succeeds (and then hangs), and he simply wants to get rid of the neccesity to do a Ctrl-C. So how does your proposed solution improve that?
    – Izzy
    Jul 16, 2015 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .