You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2015/04/01 16:22:56 UTC
[29/52] [abbrv] [partial] cordova-firefoxos git commit: CB-4548
Install new node-firefox-* dependencies in node_modules
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/trackjdwp.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/trackjdwp.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/trackjdwp.js
new file mode 100644
index 0000000..07ec6a9
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/trackjdwp.js
@@ -0,0 +1,123 @@
+(function() {
+ var Command, EventEmitter, Parser, Promise, Protocol, TrackJdwpCommand,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ EventEmitter = require('events').EventEmitter;
+
+ Promise = require('bluebird');
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ Parser = require('../../parser');
+
+ TrackJdwpCommand = (function(_super) {
+ var Tracker;
+
+ __extends(TrackJdwpCommand, _super);
+
+ function TrackJdwpCommand() {
+ return TrackJdwpCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ TrackJdwpCommand.prototype.execute = function() {
+ this._send('track-jdwp');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return new Tracker(_this);
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ Tracker = (function(_super1) {
+ __extends(Tracker, _super1);
+
+ function Tracker(command) {
+ this.command = command;
+ this.pids = [];
+ this.pidMap = Object.create(null);
+ this.reader = this.read()["catch"](Parser.PrematureEOFError, (function(_this) {
+ return function(err) {
+ return _this.emit('end');
+ };
+ })(this))["catch"](Promise.CancellationError, (function(_this) {
+ return function(err) {
+ _this.command.connection.end();
+ return _this.emit('end');
+ };
+ })(this))["catch"]((function(_this) {
+ return function(err) {
+ _this.command.connection.end();
+ _this.emit('error', err);
+ return _this.emit('end');
+ };
+ })(this));
+ }
+
+ Tracker.prototype.read = function() {
+ return this.command.parser.readValue().cancellable().then((function(_this) {
+ return function(list) {
+ var maybeEmpty, pids;
+ pids = list.toString().split('\n');
+ if (maybeEmpty = pids.pop()) {
+ pids.push(maybeEmpty);
+ }
+ return _this.update(pids);
+ };
+ })(this));
+ };
+
+ Tracker.prototype.update = function(newList) {
+ var changeSet, newMap, pid, _i, _j, _len, _len1, _ref;
+ changeSet = {
+ removed: [],
+ added: []
+ };
+ newMap = Object.create(null);
+ for (_i = 0, _len = newList.length; _i < _len; _i++) {
+ pid = newList[_i];
+ if (!this.pidMap[pid]) {
+ changeSet.added.push(pid);
+ this.emit('add', pid);
+ newMap[pid] = pid;
+ }
+ }
+ _ref = this.pids;
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
+ pid = _ref[_j];
+ if (!newMap[pid]) {
+ changeSet.removed.push(pid);
+ this.emit('remove', pid);
+ }
+ }
+ this.pids = newList;
+ this.pidMap = newMap;
+ this.emit('changeSet', changeSet, newList);
+ return this;
+ };
+
+ Tracker.prototype.end = function() {
+ this.reader.cancel();
+ return this;
+ };
+
+ return Tracker;
+
+ })(EventEmitter);
+
+ return TrackJdwpCommand;
+
+ })(Command);
+
+ module.exports = TrackJdwpCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/uninstall.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/uninstall.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/uninstall.js
new file mode 100644
index 0000000..0fdb286
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/uninstall.js
@@ -0,0 +1,47 @@
+(function() {
+ var Command, Protocol, UninstallCommand,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ UninstallCommand = (function(_super) {
+ __extends(UninstallCommand, _super);
+
+ function UninstallCommand() {
+ return UninstallCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ UninstallCommand.prototype.execute = function(pkg) {
+ this._send("shell:pm uninstall " + pkg + " 2>/dev/null");
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readAscii(7).then(function(reply) {
+ switch (reply) {
+ case 'Success':
+ case 'Failure':
+ return true;
+ default:
+ return _this.parser.unexpected(reply, "'Success' or 'Failure'");
+ }
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, "OKAY or FAIL");
+ }
+ };
+ })(this));
+ };
+
+ return UninstallCommand;
+
+ })(Command);
+
+ module.exports = UninstallCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/usb.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/usb.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/usb.js
new file mode 100644
index 0000000..8c5e797
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/usb.js
@@ -0,0 +1,51 @@
+(function() {
+ var Command, LineTransform, Protocol, UsbCommand,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ LineTransform = require('../../linetransform');
+
+ UsbCommand = (function(_super) {
+ var RE_OK;
+
+ __extends(UsbCommand, _super);
+
+ function UsbCommand() {
+ return UsbCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ RE_OK = /restarting in/;
+
+ UsbCommand.prototype.execute = function() {
+ this._send('usb:');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readAll().then(function(value) {
+ if (RE_OK.test(value)) {
+ return true;
+ } else {
+ throw new Error(value.toString().trim());
+ }
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return UsbCommand;
+
+ })(Command);
+
+ module.exports = UsbCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/waitbootcomplete.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/waitbootcomplete.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/waitbootcomplete.js
new file mode 100644
index 0000000..739e397
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/waitbootcomplete.js
@@ -0,0 +1,45 @@
+(function() {
+ var Command, Protocol, WaitBootCompleteCommand, debug,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ debug = require('debug')('adb:command:waitboot');
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ WaitBootCompleteCommand = (function(_super) {
+ __extends(WaitBootCompleteCommand, _super);
+
+ function WaitBootCompleteCommand() {
+ return WaitBootCompleteCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ WaitBootCompleteCommand.prototype.execute = function() {
+ this._send('shell:while getprop sys.boot_completed 2>/dev/null; do sleep 1; done');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.searchLine(/^1$/)["finally"](function() {
+ return _this.connection.end();
+ }).then(function() {
+ return true;
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return WaitBootCompleteCommand;
+
+ })(Command);
+
+ module.exports = WaitBootCompleteCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/connect.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/connect.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/connect.js
new file mode 100644
index 0000000..fd9da1c
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/connect.js
@@ -0,0 +1,49 @@
+(function() {
+ var Command, ConnectCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ ConnectCommand = (function(_super) {
+ var RE_OK;
+
+ __extends(ConnectCommand, _super);
+
+ function ConnectCommand() {
+ return ConnectCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ RE_OK = /connected to|already connected/;
+
+ ConnectCommand.prototype.execute = function(host, port) {
+ this._send("host:connect:" + host + ":" + port);
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readValue().then(function(value) {
+ if (RE_OK.test(value)) {
+ return "" + host + ":" + port;
+ } else {
+ throw new Error(value.toString());
+ }
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return ConnectCommand;
+
+ })(Command);
+
+ module.exports = ConnectCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/devices.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/devices.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/devices.js
new file mode 100644
index 0000000..e9d5a46
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/devices.js
@@ -0,0 +1,67 @@
+(function() {
+ var Command, HostDevicesCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ HostDevicesCommand = (function(_super) {
+ __extends(HostDevicesCommand, _super);
+
+ function HostDevicesCommand() {
+ return HostDevicesCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostDevicesCommand.prototype.execute = function() {
+ this._send('host:devices');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this._readDevices();
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ HostDevicesCommand.prototype._readDevices = function() {
+ return this.parser.readValue().then((function(_this) {
+ return function(value) {
+ return _this._parseDevices(value);
+ };
+ })(this));
+ };
+
+ HostDevicesCommand.prototype._parseDevices = function(value) {
+ var devices, id, line, type, _i, _len, _ref, _ref1;
+ devices = [];
+ if (!value.length) {
+ return devices;
+ }
+ _ref = value.toString('ascii').split('\n');
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ line = _ref[_i];
+ if (line) {
+ _ref1 = line.split('\t'), id = _ref1[0], type = _ref1[1];
+ devices.push({
+ id: id,
+ type: type
+ });
+ }
+ }
+ return devices;
+ };
+
+ return HostDevicesCommand;
+
+ })(Command);
+
+ module.exports = HostDevicesCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/deviceswithpaths.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/deviceswithpaths.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/deviceswithpaths.js
new file mode 100644
index 0000000..a63cdf1
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/deviceswithpaths.js
@@ -0,0 +1,68 @@
+(function() {
+ var Command, HostDevicesWithPathsCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ HostDevicesWithPathsCommand = (function(_super) {
+ __extends(HostDevicesWithPathsCommand, _super);
+
+ function HostDevicesWithPathsCommand() {
+ return HostDevicesWithPathsCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostDevicesWithPathsCommand.prototype.execute = function() {
+ this._send('host:devices-l');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this._readDevices();
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ HostDevicesWithPathsCommand.prototype._readDevices = function() {
+ return this.parser.readValue().then((function(_this) {
+ return function(value) {
+ return _this._parseDevices(value);
+ };
+ })(this));
+ };
+
+ HostDevicesWithPathsCommand.prototype._parseDevices = function(value) {
+ var devices, id, line, path, type, _i, _len, _ref, _ref1;
+ devices = [];
+ if (!value.length) {
+ return devices;
+ }
+ _ref = value.toString('ascii').split('\n');
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ line = _ref[_i];
+ if (line) {
+ _ref1 = line.split(/\s+/), id = _ref1[0], type = _ref1[1], path = _ref1[2];
+ devices.push({
+ id: id,
+ type: type,
+ path: path
+ });
+ }
+ }
+ return devices;
+ };
+
+ return HostDevicesWithPathsCommand;
+
+ })(Command);
+
+ module.exports = HostDevicesWithPathsCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/disconnect.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/disconnect.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/disconnect.js
new file mode 100644
index 0000000..9cf978e
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/disconnect.js
@@ -0,0 +1,49 @@
+(function() {
+ var Command, DisconnectCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ DisconnectCommand = (function(_super) {
+ var RE_OK;
+
+ __extends(DisconnectCommand, _super);
+
+ function DisconnectCommand() {
+ return DisconnectCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ RE_OK = /^$/;
+
+ DisconnectCommand.prototype.execute = function(host, port) {
+ this._send("host:disconnect:" + host + ":" + port);
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readValue().then(function(value) {
+ if (RE_OK.test(value)) {
+ return "" + host + ":" + port;
+ } else {
+ throw new Error(value.toString());
+ }
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return DisconnectCommand;
+
+ })(Command);
+
+ module.exports = DisconnectCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/kill.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/kill.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/kill.js
new file mode 100644
index 0000000..74d531c
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/kill.js
@@ -0,0 +1,39 @@
+(function() {
+ var Command, HostKillCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ HostKillCommand = (function(_super) {
+ __extends(HostKillCommand, _super);
+
+ function HostKillCommand() {
+ return HostKillCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostKillCommand.prototype.execute = function() {
+ this._send('host:kill');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return true;
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return HostKillCommand;
+
+ })(Command);
+
+ module.exports = HostKillCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/trackdevices.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/trackdevices.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/trackdevices.js
new file mode 100644
index 0000000..103793a
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/trackdevices.js
@@ -0,0 +1,43 @@
+(function() {
+ var Command, HostDevicesCommand, HostTrackDevicesCommand, Protocol, Tracker,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ Tracker = require('../../tracker');
+
+ HostDevicesCommand = require('./devices');
+
+ HostTrackDevicesCommand = (function(_super) {
+ __extends(HostTrackDevicesCommand, _super);
+
+ function HostTrackDevicesCommand() {
+ return HostTrackDevicesCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostTrackDevicesCommand.prototype.execute = function() {
+ this._send('host:track-devices');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return new Tracker(_this);
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return HostTrackDevicesCommand;
+
+ })(HostDevicesCommand);
+
+ module.exports = HostTrackDevicesCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/transport.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/transport.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/transport.js
new file mode 100644
index 0000000..8264c4f
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/transport.js
@@ -0,0 +1,39 @@
+(function() {
+ var Command, HostTransportCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ HostTransportCommand = (function(_super) {
+ __extends(HostTransportCommand, _super);
+
+ function HostTransportCommand() {
+ return HostTransportCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostTransportCommand.prototype.execute = function(serial) {
+ this._send("host:transport:" + serial);
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return true;
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ };
+ })(this));
+ };
+
+ return HostTransportCommand;
+
+ })(Command);
+
+ module.exports = HostTransportCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/version.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/version.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/version.js
new file mode 100644
index 0000000..48accc1
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host/version.js
@@ -0,0 +1,45 @@
+(function() {
+ var Command, HostVersionCommand, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Command = require('../../command');
+
+ Protocol = require('../../protocol');
+
+ HostVersionCommand = (function(_super) {
+ __extends(HostVersionCommand, _super);
+
+ function HostVersionCommand() {
+ return HostVersionCommand.__super__.constructor.apply(this, arguments);
+ }
+
+ HostVersionCommand.prototype.execute = function() {
+ this._send('host:version');
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readValue().then(function(value) {
+ return _this._parseVersion(value);
+ });
+ case Protocol.FAIL:
+ return _this.parser.readError();
+ default:
+ return _this._parseVersion(reply);
+ }
+ };
+ })(this));
+ };
+
+ HostVersionCommand.prototype._parseVersion = function(version) {
+ return parseInt(version, 16);
+ };
+
+ return HostVersionCommand;
+
+ })(Command);
+
+ module.exports = HostVersionCommand;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/connection.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/connection.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/connection.js
new file mode 100644
index 0000000..bccd503
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/connection.js
@@ -0,0 +1,108 @@
+(function() {
+ var Connection, EventEmitter, Net, Parser, debug, execFile,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Net = require('net');
+
+ debug = require('debug')('adb:connection');
+
+ EventEmitter = require('events').EventEmitter;
+
+ execFile = require('child_process').execFile;
+
+ Parser = require('./parser');
+
+ Connection = (function(_super) {
+ __extends(Connection, _super);
+
+ function Connection(options) {
+ this.options = options;
+ this.socket = null;
+ this.parser = null;
+ this.triedStarting = false;
+ }
+
+ Connection.prototype.connect = function() {
+ this.socket = Net.connect(this.options);
+ this.parser = new Parser(this.socket);
+ this.socket.on('connect', (function(_this) {
+ return function() {
+ return _this.emit('connect');
+ };
+ })(this));
+ this.socket.on('end', (function(_this) {
+ return function() {
+ return _this.emit('end');
+ };
+ })(this));
+ this.socket.on('drain', (function(_this) {
+ return function() {
+ return _this.emit('drain');
+ };
+ })(this));
+ this.socket.on('timeout', (function(_this) {
+ return function() {
+ return _this.emit('timeout');
+ };
+ })(this));
+ this.socket.on('error', (function(_this) {
+ return function(err) {
+ return _this._handleError(err);
+ };
+ })(this));
+ this.socket.on('close', (function(_this) {
+ return function(hadError) {
+ return _this.emit('close', hadError);
+ };
+ })(this));
+ return this;
+ };
+
+ Connection.prototype.end = function() {
+ this.socket.end();
+ return this;
+ };
+
+ Connection.prototype.write = function(data, callback) {
+ this.socket.write(data, callback);
+ return this;
+ };
+
+ Connection.prototype.startServer = function(callback) {
+ debug("Starting ADB server via '" + this.options.bin + " start-server'");
+ return this._exec(['start-server'], {}, callback);
+ };
+
+ Connection.prototype._exec = function(args, options, callback) {
+ debug("CLI: " + this.options.bin + " " + (args.join(' ')));
+ execFile(this.options.bin, args, options, callback);
+ return this;
+ };
+
+ Connection.prototype._handleError = function(err) {
+ if (err.code === 'ECONNREFUSED' && !this.triedStarting) {
+ debug("Connection was refused, let's try starting the server once");
+ this.triedStarting = true;
+ this.startServer((function(_this) {
+ return function(err) {
+ if (err) {
+ return _this._handleError(err);
+ }
+ return _this.connect();
+ };
+ })(this));
+ } else {
+ debug("Connection had an error: " + err.message);
+ this.emit('error', err);
+ this.end();
+ }
+ };
+
+ return Connection;
+
+ })(EventEmitter);
+
+ module.exports = Connection;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/framebuffer/rgbtransform.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/framebuffer/rgbtransform.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/framebuffer/rgbtransform.js
new file mode 100644
index 0000000..e759722
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/framebuffer/rgbtransform.js
@@ -0,0 +1,58 @@
+(function() {
+ var Assert, RgbTransform, Stream,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Assert = require('assert');
+
+ Stream = require('stream');
+
+ RgbTransform = (function(_super) {
+ __extends(RgbTransform, _super);
+
+ function RgbTransform(meta, options) {
+ this.meta = meta;
+ this._buffer = new Buffer('');
+ Assert.ok(this.meta.bpp === 24 || this.meta.bpp === 32, 'Only 24-bit and 32-bit raw images with 8-bits per color are supported');
+ this._r_pos = this.meta.red_offset / 8;
+ this._g_pos = this.meta.green_offset / 8;
+ this._b_pos = this.meta.blue_offset / 8;
+ this._a_pos = this.meta.alpha_offset / 8;
+ this._pixel_bytes = this.meta.bpp / 8;
+ RgbTransform.__super__.constructor.call(this, options);
+ }
+
+ RgbTransform.prototype._transform = function(chunk, encoding, done) {
+ var b, g, r, sourceCursor, target, targetCursor;
+ if (this._buffer.length) {
+ this._buffer = Buffer.concat([this._buffer, chunk], this._buffer.length + chunk.length);
+ } else {
+ this._buffer = chunk;
+ }
+ sourceCursor = 0;
+ targetCursor = 0;
+ target = this._pixel_bytes === 3 ? this._buffer : new Buffer(Math.max(4, chunk.length / this._pixel_bytes * 3));
+ while (this._buffer.length - sourceCursor >= this._pixel_bytes) {
+ r = this._buffer[sourceCursor + this._r_pos];
+ g = this._buffer[sourceCursor + this._g_pos];
+ b = this._buffer[sourceCursor + this._b_pos];
+ target[targetCursor + 0] = r;
+ target[targetCursor + 1] = g;
+ target[targetCursor + 2] = b;
+ sourceCursor += this._pixel_bytes;
+ targetCursor += 3;
+ }
+ if (targetCursor) {
+ this.push(target.slice(0, targetCursor));
+ this._buffer = this._buffer.slice(sourceCursor);
+ }
+ done();
+ };
+
+ return RgbTransform;
+
+ })(Stream.Transform);
+
+ module.exports = RgbTransform;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/keycode.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/keycode.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/keycode.js
new file mode 100644
index 0000000..0ca3c08
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/keycode.js
@@ -0,0 +1,228 @@
+(function() {
+ module.exports = {
+ KEYCODE_UNKNOWN: 0,
+ KEYCODE_SOFT_LEFT: 1,
+ KEYCODE_SOFT_RIGHT: 2,
+ KEYCODE_HOME: 3,
+ KEYCODE_BACK: 4,
+ KEYCODE_CALL: 5,
+ KEYCODE_ENDCALL: 6,
+ KEYCODE_0: 7,
+ KEYCODE_1: 8,
+ KEYCODE_2: 9,
+ KEYCODE_3: 10,
+ KEYCODE_4: 11,
+ KEYCODE_5: 12,
+ KEYCODE_6: 13,
+ KEYCODE_7: 14,
+ KEYCODE_8: 15,
+ KEYCODE_9: 16,
+ KEYCODE_STAR: 17,
+ KEYCODE_POUND: 18,
+ KEYCODE_DPAD_UP: 19,
+ KEYCODE_DPAD_DOWN: 20,
+ KEYCODE_DPAD_LEFT: 21,
+ KEYCODE_DPAD_RIGHT: 22,
+ KEYCODE_DPAD_CENTER: 23,
+ KEYCODE_VOLUME_UP: 24,
+ KEYCODE_VOLUME_DOWN: 25,
+ KEYCODE_POWER: 26,
+ KEYCODE_CAMERA: 27,
+ KEYCODE_CLEAR: 28,
+ KEYCODE_A: 29,
+ KEYCODE_B: 30,
+ KEYCODE_C: 31,
+ KEYCODE_D: 32,
+ KEYCODE_E: 33,
+ KEYCODE_F: 34,
+ KEYCODE_G: 35,
+ KEYCODE_H: 36,
+ KEYCODE_I: 37,
+ KEYCODE_J: 38,
+ KEYCODE_K: 39,
+ KEYCODE_L: 40,
+ KEYCODE_M: 41,
+ KEYCODE_N: 42,
+ KEYCODE_O: 43,
+ KEYCODE_P: 44,
+ KEYCODE_Q: 45,
+ KEYCODE_R: 46,
+ KEYCODE_S: 47,
+ KEYCODE_T: 48,
+ KEYCODE_U: 49,
+ KEYCODE_V: 50,
+ KEYCODE_W: 51,
+ KEYCODE_X: 52,
+ KEYCODE_Y: 53,
+ KEYCODE_Z: 54,
+ KEYCODE_COMMA: 55,
+ KEYCODE_PERIOD: 56,
+ KEYCODE_ALT_LEFT: 57,
+ KEYCODE_ALT_RIGHT: 58,
+ KEYCODE_SHIFT_LEFT: 59,
+ KEYCODE_SHIFT_RIGHT: 60,
+ KEYCODE_TAB: 61,
+ KEYCODE_SPACE: 62,
+ KEYCODE_SYM: 63,
+ KEYCODE_EXPLORER: 64,
+ KEYCODE_ENVELOPE: 65,
+ KEYCODE_ENTER: 66,
+ KEYCODE_DEL: 67,
+ KEYCODE_GRAVE: 68,
+ KEYCODE_MINUS: 69,
+ KEYCODE_EQUALS: 70,
+ KEYCODE_LEFT_BRACKET: 71,
+ KEYCODE_RIGHT_BRACKET: 72,
+ KEYCODE_BACKSLASH: 73,
+ KEYCODE_SEMICOLON: 74,
+ KEYCODE_APOSTROPHE: 75,
+ KEYCODE_SLASH: 76,
+ KEYCODE_AT: 77,
+ KEYCODE_NUM: 78,
+ KEYCODE_HEADSETHOOK: 79,
+ KEYCODE_FOCUS: 80,
+ KEYCODE_PLUS: 81,
+ KEYCODE_MENU: 82,
+ KEYCODE_NOTIFICATION: 83,
+ KEYCODE_SEARCH: 84,
+ KEYCODE_MEDIA_PLAY_PAUSE: 85,
+ KEYCODE_MEDIA_STOP: 86,
+ KEYCODE_MEDIA_NEXT: 87,
+ KEYCODE_MEDIA_PREVIOUS: 88,
+ KEYCODE_MEDIA_REWIND: 89,
+ KEYCODE_MEDIA_FAST_FORWARD: 90,
+ KEYCODE_MUTE: 91,
+ KEYCODE_PAGE_UP: 92,
+ KEYCODE_PAGE_DOWN: 93,
+ KEYCODE_PICTSYMBOLS: 94,
+ KEYCODE_SWITCH_CHARSET: 95,
+ KEYCODE_BUTTON_A: 96,
+ KEYCODE_BUTTON_B: 97,
+ KEYCODE_BUTTON_C: 98,
+ KEYCODE_BUTTON_X: 99,
+ KEYCODE_BUTTON_Y: 100,
+ KEYCODE_BUTTON_Z: 101,
+ KEYCODE_BUTTON_L1: 102,
+ KEYCODE_BUTTON_R1: 103,
+ KEYCODE_BUTTON_L2: 104,
+ KEYCODE_BUTTON_R2: 105,
+ KEYCODE_BUTTON_THUMBL: 106,
+ KEYCODE_BUTTON_THUMBR: 107,
+ KEYCODE_BUTTON_START: 108,
+ KEYCODE_BUTTON_SELECT: 109,
+ KEYCODE_BUTTON_MODE: 110,
+ KEYCODE_ESCAPE: 111,
+ KEYCODE_FORWARD_DEL: 112,
+ KEYCODE_CTRL_LEFT: 113,
+ KEYCODE_CTRL_RIGHT: 114,
+ KEYCODE_CAPS_LOCK: 115,
+ KEYCODE_SCROLL_LOCK: 116,
+ KEYCODE_META_LEFT: 117,
+ KEYCODE_META_RIGHT: 118,
+ KEYCODE_FUNCTION: 119,
+ KEYCODE_SYSRQ: 120,
+ KEYCODE_BREAK: 121,
+ KEYCODE_MOVE_HOME: 122,
+ KEYCODE_MOVE_END: 123,
+ KEYCODE_INSERT: 124,
+ KEYCODE_FORWARD: 125,
+ KEYCODE_MEDIA_PLAY: 126,
+ KEYCODE_MEDIA_PAUSE: 127,
+ KEYCODE_MEDIA_CLOSE: 128,
+ KEYCODE_MEDIA_EJECT: 129,
+ KEYCODE_MEDIA_RECORD: 130,
+ KEYCODE_F1: 131,
+ KEYCODE_F2: 132,
+ KEYCODE_F3: 133,
+ KEYCODE_F4: 134,
+ KEYCODE_F5: 135,
+ KEYCODE_F6: 136,
+ KEYCODE_F7: 137,
+ KEYCODE_F8: 138,
+ KEYCODE_F9: 139,
+ KEYCODE_F10: 140,
+ KEYCODE_F11: 141,
+ KEYCODE_F12: 142,
+ KEYCODE_NUM_LOCK: 143,
+ KEYCODE_NUMPAD_0: 144,
+ KEYCODE_NUMPAD_1: 145,
+ KEYCODE_NUMPAD_2: 146,
+ KEYCODE_NUMPAD_3: 147,
+ KEYCODE_NUMPAD_4: 148,
+ KEYCODE_NUMPAD_5: 149,
+ KEYCODE_NUMPAD_6: 150,
+ KEYCODE_NUMPAD_7: 151,
+ KEYCODE_NUMPAD_8: 152,
+ KEYCODE_NUMPAD_9: 153,
+ KEYCODE_NUMPAD_DIVIDE: 154,
+ KEYCODE_NUMPAD_MULTIPLY: 155,
+ KEYCODE_NUMPAD_SUBTRACT: 156,
+ KEYCODE_NUMPAD_ADD: 157,
+ KEYCODE_NUMPAD_DOT: 158,
+ KEYCODE_NUMPAD_COMMA: 159,
+ KEYCODE_NUMPAD_ENTER: 160,
+ KEYCODE_NUMPAD_EQUALS: 161,
+ KEYCODE_NUMPAD_LEFT_PAREN: 162,
+ KEYCODE_NUMPAD_RIGHT_PAREN: 163,
+ KEYCODE_VOLUME_MUTE: 164,
+ KEYCODE_INFO: 165,
+ KEYCODE_CHANNEL_UP: 166,
+ KEYCODE_CHANNEL_DOWN: 167,
+ KEYCODE_ZOOM_IN: 168,
+ KEYCODE_ZOOM_OUT: 169,
+ KEYCODE_TV: 170,
+ KEYCODE_WINDOW: 171,
+ KEYCODE_GUIDE: 172,
+ KEYCODE_DVR: 173,
+ KEYCODE_BOOKMARK: 174,
+ KEYCODE_CAPTIONS: 175,
+ KEYCODE_SETTINGS: 176,
+ KEYCODE_TV_POWER: 177,
+ KEYCODE_TV_INPUT: 178,
+ KEYCODE_STB_POWER: 179,
+ KEYCODE_STB_INPUT: 180,
+ KEYCODE_AVR_POWER: 181,
+ KEYCODE_AVR_INPUT: 182,
+ KEYCODE_PROG_RED: 183,
+ KEYCODE_PROG_GREEN: 184,
+ KEYCODE_PROG_YELLOW: 185,
+ KEYCODE_PROG_BLUE: 186,
+ KEYCODE_APP_SWITCH: 187,
+ KEYCODE_BUTTON_1: 188,
+ KEYCODE_BUTTON_2: 189,
+ KEYCODE_BUTTON_3: 190,
+ KEYCODE_BUTTON_4: 191,
+ KEYCODE_BUTTON_5: 192,
+ KEYCODE_BUTTON_6: 193,
+ KEYCODE_BUTTON_7: 194,
+ KEYCODE_BUTTON_8: 195,
+ KEYCODE_BUTTON_9: 196,
+ KEYCODE_BUTTON_10: 197,
+ KEYCODE_BUTTON_11: 198,
+ KEYCODE_BUTTON_12: 199,
+ KEYCODE_BUTTON_13: 200,
+ KEYCODE_BUTTON_14: 201,
+ KEYCODE_BUTTON_15: 202,
+ KEYCODE_BUTTON_16: 203,
+ KEYCODE_LANGUAGE_SWITCH: 204,
+ KEYCODE_MANNER_MODE: 205,
+ KEYCODE_3D_MODE: 206,
+ KEYCODE_CONTACTS: 207,
+ KEYCODE_CALENDAR: 208,
+ KEYCODE_MUSIC: 209,
+ KEYCODE_CALCULATOR: 210,
+ KEYCODE_ZENKAKU_HANKAKU: 211,
+ KEYCODE_EISU: 212,
+ KEYCODE_MUHENKAN: 213,
+ KEYCODE_HENKAN: 214,
+ KEYCODE_KATAKANA_HIRAGANA: 215,
+ KEYCODE_YEN: 216,
+ KEYCODE_RO: 217,
+ KEYCODE_KANA: 218,
+ KEYCODE_ASSIST: 219,
+ KEYCODE_BRIGHTNESS_DOWN: 220,
+ KEYCODE_BRIGHTNESS_UP: 221,
+ KEYCODE_MEDIA_AUDIO_TRACK: 222
+ };
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/linetransform.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/linetransform.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/linetransform.js
new file mode 100644
index 0000000..05efce1
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/linetransform.js
@@ -0,0 +1,58 @@
+(function() {
+ var LineTransform, Stream,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Stream = require('stream');
+
+ LineTransform = (function(_super) {
+ __extends(LineTransform, _super);
+
+ function LineTransform(options) {
+ this.savedR = null;
+ LineTransform.__super__.constructor.call(this, options);
+ }
+
+ LineTransform.prototype._transform = function(chunk, encoding, done) {
+ var hi, last, lo;
+ lo = 0;
+ hi = 0;
+ if (this.savedR) {
+ if (chunk[0] !== 0x0a) {
+ this.push(this.savedR);
+ }
+ this.savedR = null;
+ }
+ last = chunk.length - 1;
+ while (hi <= last) {
+ if (chunk[hi] === 0x0d) {
+ if (hi === last) {
+ this.savedR = chunk.slice(last);
+ break;
+ } else if (chunk[hi + 1] === 0x0a) {
+ this.push(chunk.slice(lo, hi));
+ lo = hi + 1;
+ }
+ }
+ hi += 1;
+ }
+ if (hi !== lo) {
+ this.push(chunk.slice(lo, hi));
+ }
+ done();
+ };
+
+ LineTransform.prototype._flush = function(done) {
+ if (this.savedR) {
+ this.push(this.savedR);
+ }
+ return done();
+ };
+
+ return LineTransform;
+
+ })(Stream.Transform);
+
+ module.exports = LineTransform;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/parser.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/parser.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/parser.js
new file mode 100644
index 0000000..65c50f6
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/parser.js
@@ -0,0 +1,247 @@
+(function() {
+ var Parser, Promise, Protocol,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Promise = require('bluebird');
+
+ Protocol = require('./protocol');
+
+ Parser = (function() {
+ Parser.FailError = (function(_super) {
+ __extends(FailError, _super);
+
+ function FailError(message) {
+ Error.call(this);
+ this.name = 'FailError';
+ this.message = "Failure: '" + message + "'";
+ Error.captureStackTrace(this, Parser.FailError);
+ }
+
+ return FailError;
+
+ })(Error);
+
+ Parser.PrematureEOFError = (function(_super) {
+ __extends(PrematureEOFError, _super);
+
+ function PrematureEOFError(howManyMissing) {
+ Error.call(this);
+ this.name = 'PrematureEOFError';
+ this.message = "Premature end of stream, needed " + howManyMissing + " more bytes";
+ this.missingBytes = howManyMissing;
+ Error.captureStackTrace(this, Parser.PrematureEOFError);
+ }
+
+ return PrematureEOFError;
+
+ })(Error);
+
+ Parser.UnexpectedDataError = (function(_super) {
+ __extends(UnexpectedDataError, _super);
+
+ function UnexpectedDataError(unexpected, expected) {
+ Error.call(this);
+ this.name = 'UnexpectedDataError';
+ this.message = "Unexpected '" + unexpected + "', was expecting " + expected;
+ this.unexpected = unexpected;
+ this.expected = expected;
+ Error.captureStackTrace(this, Parser.UnexpectedDataError);
+ }
+
+ return UnexpectedDataError;
+
+ })(Error);
+
+ function Parser(stream) {
+ this.stream = stream;
+ }
+
+ Parser.prototype.raw = function() {
+ return this.stream;
+ };
+
+ Parser.prototype.readAll = function() {
+ var all, endListener, errorListener, resolver, tryRead;
+ all = new Buffer(0);
+ resolver = Promise.defer();
+ tryRead = (function(_this) {
+ return function() {
+ var chunk, _results;
+ _results = [];
+ while (chunk = _this.stream.read()) {
+ _results.push(all = Buffer.concat([all, chunk]));
+ }
+ return _results;
+ };
+ })(this);
+ this.stream.on('readable', tryRead);
+ this.stream.on('error', errorListener = function(err) {
+ return resolver.reject(err);
+ });
+ this.stream.on('end', endListener = function() {
+ return resolver.resolve(all);
+ });
+ tryRead();
+ return resolver.promise.cancellable()["finally"]((function(_this) {
+ return function() {
+ _this.stream.removeListener('readable', tryRead);
+ _this.stream.removeListener('error', errorListener);
+ return _this.stream.removeListener('end', endListener);
+ };
+ })(this));
+ };
+
+ Parser.prototype.readAscii = function(howMany) {
+ return this.readBytes(howMany).then(function(chunk) {
+ return chunk.toString('ascii');
+ });
+ };
+
+ Parser.prototype.readBytes = function(howMany) {
+ var endListener, errorListener, resolver, tryRead;
+ resolver = Promise.defer();
+ tryRead = (function(_this) {
+ return function() {
+ var chunk;
+ if (howMany) {
+ if (chunk = _this.stream.read(howMany)) {
+ howMany -= chunk.length;
+ if (howMany === 0) {
+ return resolver.resolve(chunk);
+ }
+ }
+ } else {
+ return resolver.resolve(new Buffer(0));
+ }
+ };
+ })(this);
+ endListener = function() {
+ return resolver.reject(new Parser.PrematureEOFError(howMany));
+ };
+ errorListener = function(err) {
+ return resolver.reject(err);
+ };
+ this.stream.on('readable', tryRead);
+ this.stream.on('error', errorListener);
+ this.stream.on('end', endListener);
+ tryRead();
+ return resolver.promise.cancellable()["finally"]((function(_this) {
+ return function() {
+ _this.stream.removeListener('readable', tryRead);
+ _this.stream.removeListener('error', errorListener);
+ return _this.stream.removeListener('end', endListener);
+ };
+ })(this));
+ };
+
+ Parser.prototype.readByteFlow = function(howMany) {
+ var endListener, errorListener, resolver, tryRead;
+ resolver = Promise.defer();
+ tryRead = (function(_this) {
+ return function() {
+ var chunk, _results;
+ if (howMany) {
+ _results = [];
+ while (chunk = _this.stream.read(howMany) || _this.stream.read()) {
+ howMany -= chunk.length;
+ if (howMany === 0) {
+ resolver.progress(chunk);
+ resolver.resolve();
+ break;
+ }
+ _results.push(resolver.progress(chunk));
+ }
+ return _results;
+ } else {
+ return resolver.resolve();
+ }
+ };
+ })(this);
+ endListener = function() {
+ return resolver.reject(new Parser.PrematureEOFError(howMany));
+ };
+ errorListener = function(err) {
+ return resolver.reject(err);
+ };
+ this.stream.on('readable', tryRead);
+ this.stream.on('error', errorListener);
+ this.stream.on('end', endListener);
+ tryRead();
+ return resolver.promise.cancellable()["finally"]((function(_this) {
+ return function() {
+ _this.stream.removeListener('readable', tryRead);
+ _this.stream.removeListener('error', errorListener);
+ return _this.stream.removeListener('end', endListener);
+ };
+ })(this));
+ };
+
+ Parser.prototype.readError = function() {
+ return this.readValue().then(function(value) {
+ return Promise.reject(new Parser.FailError(value.toString()));
+ });
+ };
+
+ Parser.prototype.readValue = function() {
+ return this.readAscii(4).then((function(_this) {
+ return function(value) {
+ var length;
+ length = Protocol.decodeLength(value);
+ return _this.readBytes(length);
+ };
+ })(this));
+ };
+
+ Parser.prototype.readUntil = function(code) {
+ var read, skipped;
+ skipped = new Buffer(0);
+ read = (function(_this) {
+ return function() {
+ return _this.readBytes(1).then(function(chunk) {
+ if (chunk[0] === code) {
+ return skipped;
+ } else {
+ skipped = Buffer.concat([skipped, chunk]);
+ return read();
+ }
+ });
+ };
+ })(this);
+ return read();
+ };
+
+ Parser.prototype.searchLine = function(re) {
+ return this.readLine().then((function(_this) {
+ return function(line) {
+ var match;
+ if (match = re.exec(line)) {
+ return match;
+ } else {
+ return _this.searchLine(re);
+ }
+ };
+ })(this));
+ };
+
+ Parser.prototype.readLine = function() {
+ return this.readUntil(0x0a).then(function(line) {
+ if (line[line.length - 1] === 0x0d) {
+ return line.slice(0, -1);
+ } else {
+ return line;
+ }
+ });
+ };
+
+ Parser.prototype.unexpected = function(data, expected) {
+ return Promise.reject(new Parser.UnexpectedDataError(data, expected));
+ };
+
+ return Parser;
+
+ })();
+
+ module.exports = Parser;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/proc/stat.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/proc/stat.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/proc/stat.js
new file mode 100644
index 0000000..76ac4e9
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/proc/stat.js
@@ -0,0 +1,140 @@
+(function() {
+ var EventEmitter, Parser, ProcStat, split,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ EventEmitter = require('events').EventEmitter;
+
+ split = require('split');
+
+ Parser = require('../parser');
+
+ ProcStat = (function(_super) {
+ var RE_COLSEP, RE_CPULINE;
+
+ __extends(ProcStat, _super);
+
+ RE_CPULINE = /^cpu[0-9]+ .*$/mg;
+
+ RE_COLSEP = /\ +/g;
+
+ function ProcStat(sync) {
+ this.sync = sync;
+ this.interval = 1000;
+ this.stats = this._emptyStats();
+ this._ignore = {};
+ this._timer = setInterval((function(_this) {
+ return function() {
+ return _this.update();
+ };
+ })(this), this.interval);
+ this.update();
+ }
+
+ ProcStat.prototype.end = function() {
+ clearInterval(this._timer);
+ this.sync.end();
+ return this.sync = null;
+ };
+
+ ProcStat.prototype.update = function() {
+ return new Parser(this.sync.pull('/proc/stat')).readAll().then((function(_this) {
+ return function(out) {
+ return _this._parse(out);
+ };
+ })(this))["catch"]((function(_this) {
+ return function(err) {
+ _this._error(err);
+ };
+ })(this));
+ };
+
+ ProcStat.prototype._parse = function(out) {
+ var cols, line, match, stats, total, type, val, _i, _len;
+ stats = this._emptyStats();
+ while (match = RE_CPULINE.exec(out)) {
+ line = match[0];
+ cols = line.split(RE_COLSEP);
+ type = cols.shift();
+ if (this._ignore[type] === line) {
+ continue;
+ }
+ total = 0;
+ for (_i = 0, _len = cols.length; _i < _len; _i++) {
+ val = cols[_i];
+ total += +val;
+ }
+ stats.cpus[type] = {
+ line: line,
+ user: +cols[0] || 0,
+ nice: +cols[1] || 0,
+ system: +cols[2] || 0,
+ idle: +cols[3] || 0,
+ iowait: +cols[4] || 0,
+ irq: +cols[5] || 0,
+ softirq: +cols[6] || 0,
+ steal: +cols[7] || 0,
+ guest: +cols[8] || 0,
+ guestnice: +cols[9] || 0,
+ total: total
+ };
+ }
+ return this._set(stats);
+ };
+
+ ProcStat.prototype._set = function(stats) {
+ var cur, found, id, loads, m, old, ticks, _ref;
+ loads = {};
+ found = false;
+ _ref = stats.cpus;
+ for (id in _ref) {
+ cur = _ref[id];
+ old = this.stats.cpus[id];
+ if (!old) {
+ continue;
+ }
+ ticks = cur.total - old.total;
+ if (ticks > 0) {
+ found = true;
+ m = 100 / ticks;
+ loads[id] = {
+ user: Math.floor(m * (cur.user - old.user)),
+ nice: Math.floor(m * (cur.nice - old.nice)),
+ system: Math.floor(m * (cur.system - old.system)),
+ idle: Math.floor(m * (cur.idle - old.idle)),
+ iowait: Math.floor(m * (cur.iowait - old.iowait)),
+ irq: Math.floor(m * (cur.irq - old.irq)),
+ softirq: Math.floor(m * (cur.softirq - old.softirq)),
+ steal: Math.floor(m * (cur.steal - old.steal)),
+ guest: Math.floor(m * (cur.guest - old.guest)),
+ guestnice: Math.floor(m * (cur.guestnice - old.guestnice)),
+ total: 100
+ };
+ } else {
+ this._ignore[id] = cur.line;
+ delete stats.cpus[id];
+ }
+ }
+ if (found) {
+ this.emit('load', loads);
+ }
+ return this.stats = stats;
+ };
+
+ ProcStat.prototype._error = function(err) {
+ return this.emit('error', err);
+ };
+
+ ProcStat.prototype._emptyStats = function() {
+ return {
+ cpus: {}
+ };
+ };
+
+ return ProcStat;
+
+ })(EventEmitter);
+
+ module.exports = ProcStat;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/protocol.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/protocol.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/protocol.js
new file mode 100644
index 0000000..72ac5f3
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/protocol.js
@@ -0,0 +1,48 @@
+(function() {
+ var Protocol;
+
+ Protocol = (function() {
+ function Protocol() {}
+
+ Protocol.OKAY = 'OKAY';
+
+ Protocol.FAIL = 'FAIL';
+
+ Protocol.STAT = 'STAT';
+
+ Protocol.LIST = 'LIST';
+
+ Protocol.DENT = 'DENT';
+
+ Protocol.RECV = 'RECV';
+
+ Protocol.DATA = 'DATA';
+
+ Protocol.DONE = 'DONE';
+
+ Protocol.SEND = 'SEND';
+
+ Protocol.QUIT = 'QUIT';
+
+ Protocol.decodeLength = function(length) {
+ return parseInt(length, 16);
+ };
+
+ Protocol.encodeLength = function(length) {
+ return ('0000' + length.toString(16)).slice(-4).toUpperCase();
+ };
+
+ Protocol.encodeData = function(data) {
+ if (!Buffer.isBuffer(data)) {
+ data = new Buffer(data);
+ }
+ return Buffer.concat([new Buffer(Protocol.encodeLength(data.length)), data]);
+ };
+
+ return Protocol;
+
+ })();
+
+ module.exports = Protocol;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync.js
new file mode 100644
index 0000000..8c157a9
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync.js
@@ -0,0 +1,337 @@
+(function() {
+ var Entry, EventEmitter, Fs, Path, Promise, Protocol, PullTransfer, PushTransfer, Stats, Sync, debug,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Fs = require('fs');
+
+ Path = require('path');
+
+ Promise = require('bluebird');
+
+ EventEmitter = require('events').EventEmitter;
+
+ debug = require('debug')('adb:sync');
+
+ Protocol = require('./protocol');
+
+ Stats = require('./sync/stats');
+
+ Entry = require('./sync/entry');
+
+ PushTransfer = require('./sync/pushtransfer');
+
+ PullTransfer = require('./sync/pulltransfer');
+
+ Sync = (function(_super) {
+ var DATA_MAX_LENGTH, DEFAULT_CHMOD, TEMP_PATH;
+
+ __extends(Sync, _super);
+
+ TEMP_PATH = '/data/local/tmp';
+
+ DEFAULT_CHMOD = 0x1a4;
+
+ DATA_MAX_LENGTH = 65536;
+
+ Sync.temp = function(path) {
+ return "" + TEMP_PATH + "/" + (Path.basename(path));
+ };
+
+ function Sync(connection) {
+ this.connection = connection;
+ this.parser = this.connection.parser;
+ }
+
+ Sync.prototype.stat = function(path, callback) {
+ this._sendCommandWithArg(Protocol.STAT, path);
+ return this.parser.readAscii(4).then((function(_this) {
+ return function(reply) {
+ switch (reply) {
+ case Protocol.STAT:
+ return _this.parser.readBytes(12).then(function(stat) {
+ var mode, mtime, size;
+ mode = stat.readUInt32LE(0);
+ size = stat.readUInt32LE(4);
+ mtime = stat.readUInt32LE(8);
+ if (mode === 0) {
+ return _this._enoent(path);
+ } else {
+ return new Stats(mode, size, mtime);
+ }
+ });
+ case Protocol.FAIL:
+ return _this._readError();
+ default:
+ return _this.parser.unexpected(reply, 'STAT or FAIL');
+ }
+ };
+ })(this)).nodeify(callback);
+ };
+
+ Sync.prototype.readdir = function(path, callback) {
+ var files, readNext;
+ files = [];
+ readNext = (function(_this) {
+ return function() {
+ return _this.parser.readAscii(4).then(function(reply) {
+ switch (reply) {
+ case Protocol.DENT:
+ return _this.parser.readBytes(16).then(function(stat) {
+ var mode, mtime, namelen, size;
+ mode = stat.readUInt32LE(0);
+ size = stat.readUInt32LE(4);
+ mtime = stat.readUInt32LE(8);
+ namelen = stat.readUInt32LE(12);
+ return _this.parser.readBytes(namelen).then(function(name) {
+ name = name.toString();
+ if (!(name === '.' || name === '..')) {
+ files.push(new Entry(name, mode, size, mtime));
+ }
+ return readNext();
+ });
+ });
+ case Protocol.DONE:
+ return _this.parser.readBytes(16).then(function(zero) {
+ return files;
+ });
+ case Protocol.FAIL:
+ return _this._readError();
+ default:
+ return _this.parser.unexpected(reply, 'DENT, DONE or FAIL');
+ }
+ });
+ };
+ })(this);
+ this._sendCommandWithArg(Protocol.LIST, path);
+ return readNext().nodeify(callback);
+ };
+
+ Sync.prototype.push = function(contents, path, mode) {
+ if (typeof contents === 'string') {
+ return this.pushFile(contents, path, mode);
+ } else {
+ return this.pushStream(contents, path, mode);
+ }
+ };
+
+ Sync.prototype.pushFile = function(file, path, mode) {
+ if (mode == null) {
+ mode = DEFAULT_CHMOD;
+ }
+ mode || (mode = DEFAULT_CHMOD);
+ return this.pushStream(Fs.createReadStream(file), path, mode);
+ };
+
+ Sync.prototype.pushStream = function(stream, path, mode) {
+ if (mode == null) {
+ mode = DEFAULT_CHMOD;
+ }
+ mode |= Stats.S_IFREG;
+ this._sendCommandWithArg(Protocol.SEND, "" + path + "," + mode);
+ return this._writeData(stream, Math.floor(Date.now() / 1000));
+ };
+
+ Sync.prototype.pull = function(path) {
+ this._sendCommandWithArg(Protocol.RECV, "" + path);
+ return this._readData();
+ };
+
+ Sync.prototype.end = function() {
+ this.connection.end();
+ return this;
+ };
+
+ Sync.prototype.tempFile = function(path) {
+ return Sync.temp(path);
+ };
+
+ Sync.prototype._writeData = function(stream, timeStamp) {
+ var readReply, reader, transfer, writeData, writer;
+ transfer = new PushTransfer;
+ writeData = (function(_this) {
+ return function() {
+ var endListener, errorListener, readableListener, resolver, track, waitForDrain, writeNext, writer;
+ resolver = Promise.defer();
+ writer = Promise.resolve().cancellable();
+ stream.on('end', endListener = function() {
+ return writer.then(function() {
+ _this._sendCommandWithLength(Protocol.DONE, timeStamp);
+ return resolver.resolve();
+ });
+ });
+ waitForDrain = function() {
+ var drainListener;
+ resolver = Promise.defer();
+ _this.connection.on('drain', drainListener = function() {
+ return resolver.resolve();
+ });
+ return resolver.promise["finally"](function() {
+ return _this.connection.removeListener('drain', drainListener);
+ });
+ };
+ track = function() {
+ return transfer.pop();
+ };
+ writeNext = function() {
+ var chunk;
+ if (chunk = stream.read(DATA_MAX_LENGTH) || stream.read()) {
+ _this._sendCommandWithLength(Protocol.DATA, chunk.length);
+ transfer.push(chunk.length);
+ if (_this.connection.write(chunk, track)) {
+ return writeNext();
+ } else {
+ return waitForDrain().then(writeNext);
+ }
+ } else {
+ return Promise.resolve();
+ }
+ };
+ stream.on('readable', readableListener = function() {
+ return writer.then(writeNext);
+ });
+ stream.on('error', errorListener = function(err) {
+ return resolver.reject(err);
+ });
+ return resolver.promise["finally"](function() {
+ stream.removeListener('end', endListener);
+ stream.removeListener('readable', readableListener);
+ stream.removeListener('error', errorListener);
+ return writer.cancel();
+ });
+ };
+ })(this);
+ readReply = (function(_this) {
+ return function() {
+ return _this.parser.readAscii(4).then(function(reply) {
+ switch (reply) {
+ case Protocol.OKAY:
+ return _this.parser.readBytes(4).then(function(zero) {
+ return true;
+ });
+ case Protocol.FAIL:
+ return _this._readError();
+ default:
+ return _this.parser.unexpected(reply, 'OKAY or FAIL');
+ }
+ });
+ };
+ })(this);
+ writer = writeData().cancellable()["catch"](Promise.CancellationError, (function(_this) {
+ return function(err) {
+ return _this.connection.end();
+ };
+ })(this))["catch"](function(err) {
+ transfer.emit('error', err);
+ return reader.cancel();
+ });
+ reader = readReply().cancellable()["catch"](Promise.CancellationError, function(err) {
+ return true;
+ })["catch"](function(err) {
+ transfer.emit('error', err);
+ return writer.cancel();
+ })["finally"](function() {
+ return transfer.end();
+ });
+ transfer.on('cancel', function() {
+ writer.cancel();
+ return reader.cancel();
+ });
+ return transfer;
+ };
+
+ Sync.prototype._readData = function() {
+ var cancelListener, readNext, reader, transfer;
+ transfer = new PullTransfer;
+ readNext = (function(_this) {
+ return function() {
+ return _this.parser.readAscii(4).cancellable().then(function(reply) {
+ switch (reply) {
+ case Protocol.DATA:
+ return _this.parser.readBytes(4).then(function(lengthData) {
+ var length;
+ length = lengthData.readUInt32LE(0);
+ return _this.parser.readByteFlow(length).progressed(function(chunk) {
+ return transfer.write(chunk);
+ }).then(function() {
+ return readNext();
+ });
+ });
+ case Protocol.DONE:
+ return _this.parser.readBytes(4).then(function(zero) {
+ return true;
+ });
+ case Protocol.FAIL:
+ return _this._readError();
+ default:
+ return _this.parser.unexpected(reply, 'DATA, DONE or FAIL');
+ }
+ });
+ };
+ })(this);
+ reader = readNext()["catch"](Promise.CancellationError, (function(_this) {
+ return function(err) {
+ return _this.connection.end();
+ };
+ })(this))["catch"](function(err) {
+ return transfer.emit('error', err);
+ })["finally"](function() {
+ transfer.removeListener('cancel', cancelListener);
+ return transfer.end();
+ });
+ transfer.on('cancel', cancelListener = function() {
+ return reader.cancel();
+ });
+ return transfer;
+ };
+
+ Sync.prototype._readError = function() {
+ return this.parser.readBytes(4).then((function(_this) {
+ return function(zero) {
+ return _this.parser.readAll().then(function(buf) {
+ return Promise.reject(new Parser.FailError(buf.toString()));
+ });
+ };
+ })(this));
+ };
+
+ Sync.prototype._sendCommandWithLength = function(cmd, length) {
+ var payload;
+ if (cmd !== Protocol.DATA) {
+ debug(cmd);
+ }
+ payload = new Buffer(cmd.length + 4);
+ payload.write(cmd, 0, cmd.length);
+ payload.writeUInt32LE(length, cmd.length);
+ return this.connection.write(payload);
+ };
+
+ Sync.prototype._sendCommandWithArg = function(cmd, arg) {
+ var payload, pos;
+ debug("" + cmd + " " + arg);
+ payload = new Buffer(cmd.length + 4 + arg.length);
+ pos = 0;
+ payload.write(cmd, pos, cmd.length);
+ pos += cmd.length;
+ payload.writeUInt32LE(arg.length, pos);
+ pos += 4;
+ payload.write(arg, pos);
+ return this.connection.write(payload);
+ };
+
+ Sync.prototype._enoent = function(path) {
+ var err;
+ err = new Error("ENOENT, no such file or directory '" + path + "'");
+ err.errno = 34;
+ err.code = 'ENOENT';
+ err.path = path;
+ return Promise.reject(err);
+ };
+
+ return Sync;
+
+ })(EventEmitter);
+
+ module.exports = Sync;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/entry.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/entry.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/entry.js
new file mode 100644
index 0000000..1025e82
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/entry.js
@@ -0,0 +1,26 @@
+(function() {
+ var Entry, Stats,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Stats = require('./stats');
+
+ Entry = (function(_super) {
+ __extends(Entry, _super);
+
+ function Entry(name, mode, size, mtime) {
+ this.name = name;
+ Entry.__super__.constructor.call(this, mode, size, mtime);
+ }
+
+ Entry.prototype.toString = function() {
+ return this.name;
+ };
+
+ return Entry;
+
+ })(Stats);
+
+ module.exports = Entry;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pulltransfer.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pulltransfer.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pulltransfer.js
new file mode 100644
index 0000000..1032956
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pulltransfer.js
@@ -0,0 +1,34 @@
+(function() {
+ var PullTransfer, Stream,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Stream = require('stream');
+
+ PullTransfer = (function(_super) {
+ __extends(PullTransfer, _super);
+
+ function PullTransfer() {
+ this.stats = {
+ bytesTransferred: 0
+ };
+ PullTransfer.__super__.constructor.call(this);
+ }
+
+ PullTransfer.prototype.cancel = function() {
+ return this.emit('cancel');
+ };
+
+ PullTransfer.prototype.write = function(chunk, encoding, callback) {
+ this.stats.bytesTransferred += chunk.length;
+ this.emit('progress', this.stats);
+ return PullTransfer.__super__.write.call(this, chunk, encoding, callback);
+ };
+
+ return PullTransfer;
+
+ })(Stream.PassThrough);
+
+ module.exports = PullTransfer;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pushtransfer.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pushtransfer.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pushtransfer.js
new file mode 100644
index 0000000..a966c3c
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/pushtransfer.js
@@ -0,0 +1,43 @@
+(function() {
+ var EventEmitter, PushTransfer,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ EventEmitter = require('events').EventEmitter;
+
+ PushTransfer = (function(_super) {
+ __extends(PushTransfer, _super);
+
+ function PushTransfer() {
+ this._stack = [];
+ this.stats = {
+ bytesTransferred: 0
+ };
+ }
+
+ PushTransfer.prototype.cancel = function() {
+ return this.emit('cancel');
+ };
+
+ PushTransfer.prototype.push = function(byteCount) {
+ return this._stack.push(byteCount);
+ };
+
+ PushTransfer.prototype.pop = function() {
+ var byteCount;
+ byteCount = this._stack.pop();
+ this.stats.bytesTransferred += byteCount;
+ return this.emit('progress', this.stats);
+ };
+
+ PushTransfer.prototype.end = function() {
+ return this.emit('end');
+ };
+
+ return PushTransfer;
+
+ })(EventEmitter);
+
+ module.exports = PushTransfer;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/stats.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/stats.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/stats.js
new file mode 100644
index 0000000..39d2c9b
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/sync/stats.js
@@ -0,0 +1,57 @@
+(function() {
+ var Fs, Stats,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Fs = require('fs');
+
+ Stats = (function(_super) {
+ __extends(Stats, _super);
+
+ Stats.S_IFMT = 0xf000;
+
+ Stats.S_IFSOCK = 0xc000;
+
+ Stats.S_IFLNK = 0xa000;
+
+ Stats.S_IFREG = 0x8000;
+
+ Stats.S_IFBLK = 0x6000;
+
+ Stats.S_IFDIR = 0x4000;
+
+ Stats.S_IFCHR = 0x2000;
+
+ Stats.S_IFIFO = 0x1000;
+
+ Stats.S_ISUID = 0x800;
+
+ Stats.S_ISGID = 0x400;
+
+ Stats.S_ISVTX = 0x200;
+
+ Stats.S_IRWXU = 0x1c0;
+
+ Stats.S_IRUSR = 0x100;
+
+ Stats.S_IWUSR = 0x80;
+
+ Stats.S_IXUSR = 0x40;
+
+ Stats.S_IRWXG = 0x38;
+
+ Stats.S_IRGRP = 0x20;
+
+ function Stats(mode, size, mtime) {
+ this.mode = mode;
+ this.size = size;
+ this.mtime = new Date(mtime * 1000);
+ }
+
+ return Stats;
+
+ })(Fs.Stats);
+
+ module.exports = Stats;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/rollingcounter.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/rollingcounter.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/rollingcounter.js
new file mode 100644
index 0000000..f339afa
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/rollingcounter.js
@@ -0,0 +1,24 @@
+(function() {
+ var RollingCounter;
+
+ RollingCounter = (function() {
+ function RollingCounter(max, min) {
+ this.max = max;
+ this.min = min != null ? min : 1;
+ this.now = this.min;
+ }
+
+ RollingCounter.prototype.next = function() {
+ if (!(this.now < this.max)) {
+ this.now = this.min;
+ }
+ return ++this.now;
+ };
+
+ return RollingCounter;
+
+ })();
+
+ module.exports = RollingCounter;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/server.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/server.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/server.js
new file mode 100644
index 0000000..0d13739
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/server.js
@@ -0,0 +1,72 @@
+(function() {
+ var EventEmitter, Net, Server, Socket,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ Net = require('net');
+
+ EventEmitter = require('events').EventEmitter;
+
+ Socket = require('./socket');
+
+ Server = (function(_super) {
+ __extends(Server, _super);
+
+ function Server(client, serial, options) {
+ this.client = client;
+ this.serial = serial;
+ this.options = options;
+ this.connections = [];
+ this.server = Net.createServer();
+ this.server.on('error', (function(_this) {
+ return function(err) {
+ return _this.emit('error', err);
+ };
+ })(this));
+ this.server.on('listening', (function(_this) {
+ return function() {
+ return _this.emit('listening');
+ };
+ })(this));
+ this.server.on('close', (function(_this) {
+ return function() {
+ return _this.emit('close');
+ };
+ })(this));
+ this.server.on('connection', (function(_this) {
+ return function(conn) {
+ var socket;
+ socket = new Socket(_this.client, _this.serial, conn, _this.options);
+ _this.connections.push(socket);
+ return _this.emit('connection', socket);
+ };
+ })(this));
+ }
+
+ Server.prototype.listen = function() {
+ this.server.listen.apply(this.server, arguments);
+ return this;
+ };
+
+ Server.prototype.close = function() {
+ this.server.close();
+ return this;
+ };
+
+ Server.prototype.end = function() {
+ var conn, _i, _len, _ref;
+ _ref = this.connections;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ conn = _ref[_i];
+ conn.end();
+ }
+ return this;
+ };
+
+ return Server;
+
+ })(EventEmitter);
+
+ module.exports = Server;
+
+}).call(this);
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/servicemap.js
----------------------------------------------------------------------
diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/servicemap.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/servicemap.js
new file mode 100644
index 0000000..d4b3ccc
--- /dev/null
+++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/tcpusb/servicemap.js
@@ -0,0 +1,43 @@
+(function() {
+ var ServiceMap;
+
+ ServiceMap = (function() {
+ function ServiceMap() {
+ this.remotes = Object.create(null);
+ }
+
+ ServiceMap.prototype.end = function() {
+ var remote, remoteId, _ref;
+ _ref = this.remotes;
+ for (remoteId in _ref) {
+ remote = _ref[remoteId];
+ remote.end();
+ }
+ this.remotes = Object.create(null);
+ };
+
+ ServiceMap.prototype.put = function(remoteId, socket) {
+ return this.remotes[remoteId] = socket;
+ };
+
+ ServiceMap.prototype.get = function(remoteId) {
+ return this.remotes[remoteId] || null;
+ };
+
+ ServiceMap.prototype.remove = function(remoteId) {
+ var remote;
+ if (remote = this.remotes[remoteId]) {
+ delete this.remotes[remoteId];
+ return remote;
+ } else {
+ return null;
+ }
+ };
+
+ return ServiceMap;
+
+ })();
+
+ module.exports = ServiceMap;
+
+}).call(this);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org