From 421bc1b0671d1bb9e9d7b83b17c13e8db768eda6 Mon Sep 17 00:00:00 2001 From: keeramis Date: Fri, 9 Aug 2024 09:25:52 -0700 Subject: [PATCH] Uniquely identify a device is of type UsbDevice --- src/cmd/keys.js | 1 - src/cmd/usb-util.js | 5 ++++- src/cmd/usb.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd/keys.js b/src/cmd/keys.js index 661078a1a..3266a485e 100644 --- a/src/cmd/keys.js +++ b/src/cmd/keys.js @@ -370,7 +370,6 @@ module.exports = class KeysCommand { console.log(); console.log(url.format(result)); - return result; } _getServerKeySegment({ protocol }){ diff --git a/src/cmd/usb-util.js b/src/cmd/usb-util.js index c9504a983..b9e02cec1 100644 --- a/src/cmd/usb-util.js +++ b/src/cmd/usb-util.js @@ -137,7 +137,10 @@ async function executeWithUsbDevice({ args, func, enterDfuMode = false, allowPro } newDeviceHandle = await func(device); // Overwrite device handle if it is provided by the executed function - device = newDeviceHandle || device; + // FIXME: Perhaps a poor way to uniquely identify a device is of UsbDevice type + if (newDeviceHandle?._dev) { + device = newDeviceHandle; + } } finally { if (deviceIsProtected) { try { diff --git a/src/cmd/usb.js b/src/cmd/usb.js index 567d0d6e7..f1d8f6bf6 100644 --- a/src/cmd/usb.js +++ b/src/cmd/usb.js @@ -207,7 +207,7 @@ module.exports = class UsbCommand extends CLICommandBase { async _cloudStatus(device, until, timeout) { let status = null; - + this.newSpin('Querying device...').start(); if (!until) { status = await device.getCloudConnectionStatus();