From 0e85d0b14ef118c247105b5b03e280e988cc91c2 Mon Sep 17 00:00:00 2001 From: 18506711722 Date: Sun, 1 Sep 2024 22:55:57 +0800 Subject: [PATCH 1/2] parseDeviceList add offline --- libraries/adb/src/server/client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/adb/src/server/client.ts b/libraries/adb/src/server/client.ts index d2519bd51..57cc95167 100644 --- a/libraries/adb/src/server/client.ts +++ b/libraries/adb/src/server/client.ts @@ -144,7 +144,7 @@ export class AdbServerClient { const parts = line.split(" ").filter(Boolean); const serial = parts[0]!; const status = parts[1]!; - if (status !== "device" && status !== "unauthorized") { + if (status !== "device" && status !== "unauthorized" && status !== "offline") { continue; } @@ -174,6 +174,7 @@ export class AdbServerClient { } devices.push({ serial, + offline: status === "offline", authenticating: status === "unauthorized", product, model, @@ -610,6 +611,7 @@ export namespace AdbServerClient { model?: string | undefined; device?: string | undefined; transportId: bigint; + offline?:boolean } export class NetworkError extends Error { From 9f8eb2766946bb6ab584b98927abcb531ec582f4 Mon Sep 17 00:00:00 2001 From: 18506711722 Date: Mon, 2 Sep 2024 00:18:40 +0800 Subject: [PATCH 2/2] parseDeviceList add offline --- libraries/adb/src/server/client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/adb/src/server/client.ts b/libraries/adb/src/server/client.ts index 57cc95167..1ea8751a4 100644 --- a/libraries/adb/src/server/client.ts +++ b/libraries/adb/src/server/client.ts @@ -169,6 +169,11 @@ export class AdbServerClient { break; } } + + if(status === 'offline' && !product && !model && !device){ + continue; + } + if (!transportId) { throw new Error(`No transport id for device ${serial}`); }