Closed Bug 970797 Opened 11 years ago Closed 10 years ago

[LayerScope] One-click connection using firefox addon

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: mtseng, Assigned: boris)

References

Details

Attachments

(2 files)

Currently, Layerscope still need to type ip address manually. We want to develop a addon which will detect ip address automatically and then redirect to layerview tool by one click operation.
Assignee: nobody → mtseng
How does the ip address detection work? Via adb?
(In reply to Dan Glastonbury :djg :kamidphish from comment #1)
> How does the ip address detection work? Via adb?

Yes, I'll grep IP address from "adb shell netcfg" command.
Leverage what BenWa had done in GeckoProfiler add on
Reuse two js from that repository
https://github.com/bgirard/Gecko-Profiler-Addon/blob/master/data/CmdRunner.jsm
https://github.com/bgirard/Gecko-Profiler-Addon/blob/master/data/CmdRunWorker.js

Then, you can get IP address in addon:
let cmdRunnerModule = Cu.import(data.url("CmdRunner.jsm"));

function adb_get_netconfig(callback) {
    cmdRunnerModule.runCommand("/bin/bash -l -c 'adb shell netcfg'", function(r) {
      // parse netcfg stdout strings
      var lines = r.split("\n");
      // TODO
    }
We can already do something like that with the devtools (binding device IP port to local port). By default, on the device we use a unix socket that we bind to a localhost tcp socket. But it's possible to do TCP->TCP.

See the first 10 seconds of the video here: https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager

Maybe there's something we can do with the layer scope and the app manager.
I am not familiar with the implementation of app-manager, by looking through bugzilla and MDN, I think app-manager using adb helper add-on to execute adb command in about:app-manager page:
https://github.com/ochameau/adbhelper

Paul, please correct me if I am wrong, and thanks for your great information
Flags: needinfo?(paul)
(In reply to C.J. Ku[:CJKu] from comment #5)
> I am not familiar with the implementation of app-manager, by looking through
> bugzilla and MDN, I think app-manager using adb helper add-on to execute adb
> command in about:app-manager page:
> https://github.com/ochameau/adbhelper
> 
> Paul, please correct me if I am wrong, and thanks for your great information

Yes, we use the adb helper, which only job is to do a adb forward. And we are also working on a wireless solution (tcp based).
Flags: needinfo?(paul)
I work with Paul on the App Manager.  I think it would be great to integrate this tool with the App Manager in some way.  We could:

* Make the App Manager capable of detecting devices where Layer Scope is enabled
* When it is enabled, show a button that opens the Layer Scope viewer tool connected to the right IP and port

In the "future" / sometime, it would be great for the App Manager to take advantage of this functionality to recreate a live view of the device's screen.

So, I think it would be nice to start by taking advantage of the App Manager to at least ease connection to the existing Layer Scope viewer tool.  That way there's no add-on to write and have people install.
WIP LayerScope-Addon repo here, https://github.com/mephisto41/LayerScope-Addon
And this addon needs modified version of adbhelper. Modified version of adbhelper link: https://github.com/mephisto41/adbhelper

Right now when you open the addon's panel. It will detect adb device automatically. Then select device and press connect and then layerview tool will open and connect to device.
Morris, awesome, it's work!
Some suggestion:
1. Please pull-request what you change into original adbhelper repository - looks like you need an API to setup forward port number.
2. Listen to device connected event - list connected device id in drop down list automatically
In the LayerScope, we have to connect to custom remote port instead of debugger-socket. So I slightly modify main.js to support custom remote port.
Attachment #8378841 - Flags: review?(paul)
Attachment #8378841 - Flags: review?(paul) → review?(poirot.alex)
Attachment #8378841 - Flags: review?(poirot.alex) → review+
Note that there is also libadb.js addon being hosted here:
  https://github.com/mozilla/libadb.js/
So far, it isn't stable enough, but at some point we may be switching to it.
It could be worth also patching it.
Morris, please update wiki page before bug close.
We do give two choices for user, he may use this add-on or execute adb command and manually key in port number. The second one is more like a backup solution in case something wrong in plug-in or a user just doesn't want to use add-on.
Attachment #8547420 - Flags: review?(mtseng)
Comment on attachment 8547420 [details] [review]
Fix for newer sdk and gecko.

Nice job!!!
Attachment #8547420 - Flags: review?(mtseng) → review+
Assignee: mtseng → boris.chiou
Merged to github!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: