GithubHelp home page GithubHelp logo

happy-ferret / libadb.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozilla/libadb.js

0.0 2.0 0.0 2.68 MB

ADB Javascript library for mozilla runtime

Makefile 0.84% JavaScript 7.40% C 48.14% C++ 42.84% Batchfile 0.24% Objective-C 0.54%

libadb.js's Introduction

libadb.js

Building

Using a precompiled libadb:

$ make

Compiling locally:

$ make LIBADB_LOCATION=local

Running

$ make run BIN=<PATH TO FIREFOX BINARY>

Testing

$ make test BIN=<PATH TO FIREFOX BINARY>

Debugging

Logging

Use the environment variable ADB_TRACE with flags defined in adb_trace_init() in adb.cpp e.g. ADB_TRACE=all.

Attaching A Debugger

Add --no-run as an argument to cfx in the run target in the makefile. This will then dump the command to run Firefox when make run is used.

Start lldb/gdb

$ lldb -- <COMMAND FROM ABOVE>

About the JS side libadb.js

Main (adb.js) - Starts and shuts down all the various workers below. Also, responsible for forwarding events on.

Server (adb-server-thread.js) - The worker is mainly responsible for initialization and receiving messages such as when a device status changes or starting the IO threads when a device is connected to. It loops forever until the kill server file descriptor is written to, which happens on the main thread.

Device Poll (adb-device-poll-thread.js) - This thread is only responsible for starting a polling loop that looks for new device connections (not on Linux, Linux uses pthreads). The C code does not send message directly back to this thread when devices are connected, it instead will send an event to the server thread. It is terminated when kill_device_loop is called.

File Descriptor IO (adb-io-thread.js) - Used for reading and writing to file descriptors.

Utility (adb-utility-thread.js) - Currently only used for queries where you ask ADB for a service and it will return a file descriptor to communicate with that service e.g. shell or port forwarding (See SERVICES.TXT).

Device Input & Output (adb-io-thread-spawner.js) - These workers are used as an IO pump reading and writing data to a device. They share the same code.

More Information

mozilla/r2d2b2g#663

  • android-tools/adb-bin/OVERVIEW.txt
  • android-tools/adb-bin/protocol.txt
  • android-tools/adb-bin/SERVICES.txt

libadb.js's People

Contributors

mykmelez avatar brendandahl avatar ochameau avatar jryans avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.