listDevices() Does Not Return
flakjacket95 opened this issue · comments
I have a section of code that does 2 things, in order.
First, I have a function that turns ADB on on my device.
This consists of a simple serial communication to the device that is designed to enable ADB. Basically, my device has a server on it that listens for a specific communication over serial and turns on ADB when it gets it.
Second, I have a function to perform a few ADB operations on that device.
Basically runs this,
var Promise = require('bluebird');
var adb = require('adbkit');
var client = adb.createClient();
client.listDevices().then(function(adbdevices) {
//Other stuff here but, this is sufficient for a test
console.log(adbdevices);
}).catch(console.log.bind(console));
As such, after the first section is completed, the listDevices()
function is what I call to find out the ADB ID of the connected device and, if the first step succeeded in turning ADB on. However, this command does not resolve or reject after running my first command.
I've run a few tests and these are my results so far.
Opening App And Running Step 2:
When I open the app and setup and run step 2 right off of the bat, I get the value []
returned. As expected, considering I have not asked my device to enable ADB yet.
Running Step 1 And Then Step 2
This is the scenario that I am looking for but, once I run step 1 above - I get no response from the listDevices()
command. The Promise does not appear to resolve or reject at all in this case.
Step 1 then Step 2, Leave ADB on and restart App
In this test, I run my first step and then run the second, the same as the above test. Then, I reload the application on my computer and leave ADB on the device on. Once the app is reloaded, I run step 2 again, and this time, it is successful returning a list of available devices with my device listed as expected.
I'm trying to figure out why I have to reboot in the middle of the step1/step2 process, to me this should be a simple transition.
And how does adb devices
behave?
As expected, it returns properly with the device listed.
And nc 127.0.0.1 5037 <<<'000chost:devices'
?
Before running step 1: OKAY0000
After: OKAY0013Device device
Also, as an important note, I've only seen this issue on MacOS High Sierra. The process works fine as is on Windows. Not tested on Linux yet
adb version
? So far it doesn't sound the issue is with adbkit. I'd get the latest adb.
Android Debug Bridge version 1.0.39
Version 0.0.1-4500957
What's weird to me is that the only case that this fails in when using adbkit in the app. If I do any step outside of the main application, everything is fine. As shown above, adb devices
lists the device all of the time once turned on, it's just that the Promise is never resolved or rejected in the application. However, there is some other odd promise related behavior sometimes (I've seen all promises stop resolving/rejecting after running step 1 in some instances)- perhaps the issue lies there.