-
Notifications
You must be signed in to change notification settings - Fork 92
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
Detect chrome remote debug targets over ADB like chrome://inspect #37
Comments
I had a quick look at all the open sockets on my machine using lsof. Was not able to find anything that looked like it would help. Did a bit of digging into the chrome://inspect page and that page is being updated from c++ directly (not over the network). This is the function being called https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/resources/inspect/inspect.js&q=PopulateTargets&sq=package:chromium&l=100&type=cs It looks like it is being called from here https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/webui/inspect_ui.cc&q=PopulateTargets&sq=package:chromium&l=514&type=cs I tried to trace that back to where it is being called. Looks like there is some sort of internal notification centre which it is subscribing to for updates https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/devtools/devtools_targets_ui.cc&sq=package:chromium&rcl=1424438238&l=195&type=cs My c++ foo is very weak but hopefully this info might help |
For Android it looks like it binds to the port I still haven't found the discovery. |
Here's the discovery and mapping of sockets to processes: |
Debugged this further. We need to use ADB in order to connect to the device, then run a port query, and then use ADB to setup a forward: Steps how to find remote debug devices using ADB:
|
Got a working prototype here https://github.com/auchenberg/chrome-devtools-app/tree/adb-devices |
Nice!! |
For the curious of heart: Here's the diff off of master |
Yeah, I wrote a little node module to abstract the ADB communication away, https://github.com/auchenberg/adb-devtools-devices |
Just to make things crystal clear:
|
By browsing the Stetho source code, it seems like
chrome://inspect
is using Unix sockets to discover remote debug endpoints on the network.At least Stetho opening a socket on
stetho_PROCESSNAME_devtools_remote
, which seem to be the convention used bychrome://inspect
, so it should be possible to emulate this behavior by simply probing on sockets with the suffix_devtools_remote
.Link: https://github.com/facebook/stetho/blob/master/stetho/src/main/java/com/facebook/stetho/server/LocalSocketHttpServer.java
The text was updated successfully, but these errors were encountered: