-
-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disconnecting and re-connecting #419
Comments
I remember I tested this part not long ago on Windows and it was working. On macOS, a quick check shows the It seems that the device, or the OS, is in a strange state, because I can't re-connect even after a browser restart, and sometimes the whole browser just crashes. I need to investigate more on this weekend. |
Can not disconnect device in Edge on MacOS. Both Edge and Demo are latest. |
I tested Chrome's native Web Streams implementation. It works, uses 17% more CPU but has 15% more throughputs than the polyfill. The memory usage is also slightly higher and results in more GC, but still acceptable. It doesn't support The main issue is still portability. Firefox 100 just added support for |
Why does Firefox matter? I mean they still don't support Webusb, or did I miss something? |
There is a WebSocket backend, when paired with WebSockify software, can be used to connect ADB over WiFi devices. I remember seeing someone make a Docker image with the demo and websockify. I don't know if anyone is using Firefox for that, since there is no tracking in the demo. Technically it's possible and I want to keep this possibility. Node.js support is also essential because the official demo uses Next.js, which does SSR. It will be a huge refactor to remove all ADB related code from SSR. |
Ah yeah - that makes sense then, I was not aware about the connection via WiFi. I would not break working functionality either. |
Note: if you really want to re-connect immediately, const device = await AdbWebUsbBackend.requestDevice();
let streams = await device.connect();
let adb = await Adb.authenticate(streams, credentialStore, undefined);
console.log(await adb.subprocess.spawnAndWaitLegacy('echo 1'));
await adb.close();
+ await adb.disconnected;
adb = await Adb.authenticate(streams, credentialStore, undefined);
console.log(await adb.subprocess.spawnAndWaitLegacy('echo 1')); Or if you want to create a new connection, you need to manually release the previous one. const device = await AdbWebUsbBackend.requestDevice();
let streams = await device.connect();
let adb = await Adb.authenticate(streams, credentialStore, undefined);
console.log(await adb.subprocess.spawnAndWaitLegacy('echo 1'));
await adb.close();
await adb.disconnected;
+ await streams.readable.cancel();
+ streams = await device.connect();
adb = await Adb.authenticate(streams, credentialStore, undefined);
console.log(await adb.subprocess.spawnAndWaitLegacy('echo 1')); |
Issue Checklist
Library version
0.0.15
Runtime
Linux, Chrome Version 100.0.4896.127 (Official Build) (64-bit)
Device
DJI FPV goggles V2
Describe the bug
I have an issue with properly disconnecting from ADB (without physically unplugging the device) and later re-connecting. This also seems to be an issue in the Demo where I can't disconnect in the first place - pressing the "Disconnect" button does nothing.
the second
authenticate
call never resolves.Not sure if I am missing something or if this is a general problem (since the demo does not allow me to disconnect either).
Steps to reproduce
EDIT: As a work-around I am saving the
device
returned byrequestDevice
orgetDevices
and simply close that - which does what I need it to do - I am just not sure if this is the intended way?The text was updated successfully, but these errors were encountered: