Comments (9)
Just to make things crystal clear:
-
If you just have one device connected, you don't need the
-s
option, thereforeadb <cmd>
is a useful short -
To get the service name `adb shell "cat /proc/net/unix | grep devtools_remote", which will give you something like this output:
00000000: 00000002 00000000 00010000 0001 01 423897 @webview_devtools_remote_18279
-
Now we need to make a port forwarding between the open socket on the android device and your local machine:
adb forward tcp:9222 localabstract:webview_devtools_remote_18279
(assuming thatwebview_devtools_remote_18279
was returned by the command on step 2. -
To make sure it worked, just open http://localhost:9222 in your browser, and you should see something like this
- Now you can curl the JSON endpoint to get the so much desired
webSocketDebuggerUrl
:curl localhost:9222/json
orcurl localhost:9222/json/version
(varies depending on the Chrome/Chromium version)
from chrome-devtools-app.
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:
adb devices
<choose device>
adb -s <device> shell “cat /proc/net/unix |grep devtools_remote”
adb -s <device> forward tcp:9222 local abstract:<service name>
http://localhost:9222/json
Bam!
from chrome-devtools-app.
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
from chrome-devtools-app.
For Android it looks like it binds to the port cast_shell_devtools_remote
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/android/dev_tools_server.cc&q=_devtools_remote&sq=package:chromium&dr=C&l=65
I still haven't found the discovery.
from chrome-devtools-app.
Here's the discovery and mapping of sockets to processes:
https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/devtools/device/android_device_info_query.cc&q=_devtools_remote&sq=package:chromium&dr=C&l=126
from chrome-devtools-app.
Got a working prototype here https://github.com/auchenberg/chrome-devtools-app/tree/adb-devices
from chrome-devtools-app.
Nice!!
from chrome-devtools-app.
For the curious of heart:
Here's the diff off of master
https://github.com/auchenberg/chrome-devtools-app/compare/adb-devices
from chrome-devtools-app.
Yeah, I wrote a little node module to abstract the ADB communication away, https://github.com/auchenberg/adb-devtools-devices
from chrome-devtools-app.
Related Issues (20)
- Video Demo HOT 2
- Grunt runDebug error HOT 1
- Grunt build error HOT 2
- Copying requests as cURL does not work HOT 2
- Collaboration with Sandip's DevToolsApp HOT 7
- TypeError: undefined is not a function
- integration with other inspectors? HOT 3
- After move to Electron, clipboard doesn't work anymore.
- 404 in readme HOT 3
- Usage in combination with bugger HOT 3
- Ability to use without a target HOT 4
- Where are the dev tools source? HOT 2
- can't get targets to show up HOT 2
- Discontinued project? HOT 5
- get url failed HOT 1
- why there is no websocket url HOT 1
- Doesn't discover app on port 5959
- Use for remote debugging non Android devices? HOT 1
- Can't open context menu on elements tab in chrome devtools
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrome-devtools-app.