@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.js CHANGED
@@ -1875,7 +1875,18 @@ var KeystoneAdapter = class _KeystoneAdapter {
1875
1875
  signal.addEventListener("abort", onAbort, { once: true });
1876
1876
  const pending = this._usbConnectTail.then(async () => {
1877
1877
  _KeystoneAdapter._throwIfAborted(signal);
1878
- return this._connectUsbExclusive(connector, expected, searchTargetId, signal);
1878
+ if (this._unsettledUsbOperations.size > 0) {
1879
+ return (0, import_hwk_adapter_core3.failure)(
1880
+ import_hwk_adapter_core3.HardwareErrorCode.DeviceBusyInternal,
1881
+ "Keystone USB is still finishing an earlier request"
1882
+ );
1883
+ }
1884
+ const releaseConnect = this._retainUsbOperation("connect");
1885
+ try {
1886
+ return await this._connectUsbExclusive(connector, expected, searchTargetId, signal);
1887
+ } finally {
1888
+ releaseConnect();
1889
+ }
1879
1890
  });
1880
1891
  const settled = pending.finally(() => {
1881
1892
  signal.removeEventListener("abort", onAbort);