@onekeyfe/hwk-keystone-adapter 1.2.8-alpha.50 → 1.2.8-alpha.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1883,7 +1883,18 @@ var KeystoneAdapter = class _KeystoneAdapter {
1883
1883
  signal.addEventListener("abort", onAbort, { once: true });
1884
1884
  const pending = this._usbConnectTail.then(async () => {
1885
1885
  _KeystoneAdapter._throwIfAborted(signal);
1886
- return this._connectUsbExclusive(connector, expected, searchTargetId, signal);
1886
+ if (this._unsettledUsbOperations.size > 0) {
1887
+ return failure(
1888
+ HardwareErrorCode2.DeviceBusyInternal,
1889
+ "Keystone USB is still finishing an earlier request"
1890
+ );
1891
+ }
1892
+ const releaseConnect = this._retainUsbOperation("connect");
1893
+ try {
1894
+ return await this._connectUsbExclusive(connector, expected, searchTargetId, signal);
1895
+ } finally {
1896
+ releaseConnect();
1897
+ }
1887
1898
  });
1888
1899
  const settled = pending.finally(() => {
1889
1900
  signal.removeEventListener("abort", onAbort);