Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Firefox OS simulator doesn't detect devices on Windows XP Home #892

Closed
Loirooriol opened this issue May 4, 2014 · 6 comments
Closed

Firefox OS simulator doesn't detect devices on Windows XP Home #892

Loirooriol opened this issue May 4, 2014 · 6 comments

Comments

@Loirooriol
Copy link

Firefox OS simulator doesn't detect devices on Windows XP Home, because it doesn't have doesn't have tasklist.exe

The problem is solved downloading it from http://www.computerhope.com/download/winxp.htm and putting it in Windows\System32 folder.

Maybe the add-on could include it, it's only 70KB.

@jryans
Copy link
Contributor

jryans commented May 6, 2014

I think it's unlikely that we'd bundle random EXEs with the addon. As I user, I certainly would not want a Simulator installing strange EXEs in my Windows folder.

If that's what is needed for Windows XP Home to work, I think we just won't be able to support it at this time.

Out of curiosity, does the same issue happen with the newest simulators, like 1.5?

@Loirooriol
Copy link
Author

Oh, I didn't meant Simulator should install it in Windows folder, but that it could include it (in Simulator folder) and run this one if necessary.

If not, I think that Simulator should handle this case properly.

In r2d2b2g@mozilla.org\resources\r2d2b2g\lib\adb.js (line 240):

if (platform === "WINNT") {
  ps = "C:\\windows\\system32\\tasklist.exe";
  args = [];
} else {
  args = ["aux"];
  let psCommand = "ps";

  let paths = env.PATH.split(':');
  let len = paths.length;
  for (let i = 0; i < len; i++) {
    let fullyQualified = file.join(paths[i], psCommand);
    if (file.exists(fullyQualified)) {
      ps = fullyQualified;
      break;
    }
  }
  if (!ps) {
    debug("Error: a task list executable not found on filesystem");
    deferred.resolve(false); // default to restart adb
    return deferred.promise;
  }
}

In case of Windows XP Home, I think the following code should run:

    debug("Error: a task list executable not found on filesystem");
    deferred.resolve(false); // default to restart adb
    return deferred.promise;

But instead, since it's windows, it assumes that C:\windows\system32\tasklist.exe does exist.

@jryans
Copy link
Contributor

jryans commented May 6, 2014

Ah, okay. This is part of the older Firefox OS 1.1 Simulator that is no longer maintained.

The 1.2+ simulators do not contain the above file because all ADB stuff is handled separately. The newer addons are used via the App Manager.

With the App Manager, you can run ADB manually or use the ADB helper addon to do this for you. It looks like the ADB helper has the same flaw you've found here though.

We also have a more experimental ADB addon which does not appear to use tasklist which might work for you, but again this is only meant for use with the App Manager and FxOS 1.2+.

I have filed a bug about the ADB helper on this issue.

@jryans jryans closed this as completed May 6, 2014
@AprilMorone
Copy link

Not sure as I have temporarily had to step away from testing the Firefox
OS. But, I soon will check on that later this week, if possible.
On May 6, 2014 2:48 PM, "J. Ryan Stinnett" notifications@github.com wrote:

I think it's unlikely that we'd bundle random EXEs with the addon. As I
user, I certainly would not want a Simulator installing strange EXEs in my
Windows folder.

If that's what is needed for Windows XP Home to work, I think we just
won't be able to support it at this time.

Out of curiosity, does the same issue happen with the newest simulatorshttps://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/,
like 1.5?


Reply to this email directly or view it on GitHubhttps://github.com//issues/892#issuecomment-42342871
.

@AprilMorone
Copy link

Thank you for having filed a bug on this issue.
On May 6, 2014 6:28 PM, "J. Ryan Stinnett" notifications@github.com wrote:

Ah, okay. This is part of the older Firefox OS 1.1 Simulator that is no
longer maintained.

The 1.2+ simulators do not contain the above file because all ADB stuff is
handled separately. The newer addons are used via the App Managerhttps://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Using_the_App_Manager
.

With the App Manager, you can run ADB manually or use the ADB helper addonhttps://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager#Adb_Helper_Add-onto do this for you. It looks like the ADB helper has the same flaw you've
found here though.

We also have a more experimental ADB addonhttps://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/adb-helper/adbhelper-windows.xpiwhich does not appear to use
tasklist which might work for you, but again this is only meant for use
with the App Manager and FxOS 1.2+.

I have filed a bug about the ADB helperhttps://bugzilla.mozilla.org/show_bug.cgi?id=1006844on this issue.


Reply to this email directly or view it on GitHubhttps://github.com//issues/892#issuecomment-42367984
.

@Loirooriol
Copy link
Author

Replacing _isAdbRunning with the following code fixes the problem:

_isAdbRunning: function() {
  let deferred = Promise.defer();

  let ps, args;
  let platform = Services.appinfo.OS;
  if (platform === "WINNT") {
    ps = "C:\\windows\\system32\\tasklist.exe";
    args = [];
  } else {
    args = ["aux"];
    let psCommand = "ps";

    let paths = env.PATH.split(':');
    let len = paths.length;
    for (let i = 0; i < len; i++) {
      let fullyQualified = file.join(paths[i], psCommand);
      if (file.exists(fullyQualified)) {
        ps = fullyQualified;
        break;
      }
    }
  }

  if (ps) try {

    let buffer = [];

    subprocess.call({
      command: ps,
      arguments: args,
      stdout: function(data) {
        buffer.push(data);
      },
      done: function() {
        let lines = buffer.join('').split('\n');
        let regex = (platform === "WINNT") ? psRegexWin : psRegexNix;
        let isAdbRunning = lines.some(function(line) {
          return regex.test(line);
        });
        deferred.resolve(isAdbRunning);
      }
    });

    return deferred.promise;

  }catch(err){
    if(err.name !== "NS_ERROR_FILE_NOT_FOUND") throw err;
  }

  debug("Error: a task list executable not found on filesystem");
  deferred.resolve(false); // default to restart adb
  return deferred.promise;

},

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants