Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adb command could be issued via socket #1

Open
newsham opened this issue Jul 3, 2013 · 1 comment
Open

adb command could be issued via socket #1

newsham opened this issue Jul 3, 2013 · 1 comment

Comments

@newsham
Copy link

newsham commented Jul 3, 2013

The adb.rb file executes the external "adb" utility to communicate with ADB. This can be avoided if you talk directly to the ADB server running on the localhost (assuming you require it already be running). Connect to localhost:5037 via tcp. To send a command, send 4-hex bytes of message length followed by the message. It should be acknowledged with 4-byes "OKAY". To redirect commands to the ADB server on a target device, send the "host:transport:TARGET" command where target is the device you wish to bridge to. All further comms on the socket will be directed to the adb server on the target. To execute shell commands on the target, send the "shell:cmd line here" command. All further comms on the socket will be IO to the shell. To communicate with JDWP, issue the "JDWP:PID" command where PID is the PID you wish to communicate with. All further comms on the socket will be IO to JDWP.
I can provide example code in python if helpful.

@wuntee
Copy link
Owner

wuntee commented Jul 5, 2013

I have started implementing this, the one thing I have been unable to figure out is:

Using adb/ddms libs, the workflow is as follows:

  1. set package to launch and wait for debugger (via adb shell command)
  2. launch package (via adb shell command)
  3. query for port for JDWP to communicate with (via ddms jar)
  4. launch JDWP debugger via port in #3

I have been unable to determine how #3 is performed. Which leads me to believe that the ddms library opens up a local port, then forwards the contents to the already established TCP session from the 'JDWP:PID' initiation command, but I have been unable to confirm...

Any clue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants