Skip to content

Commit

Permalink
Merge branch 'fix/ledger-invalid-channel' into tmp/20241213
Browse files Browse the repository at this point in the history
  • Loading branch information
heisenberg-2077 committed Dec 10, 2024
2 parents 7be2fe4 + 1de2427 commit c192ad9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions patches/@ledgerhq+hw-transport-webhid+6.29.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/@ledgerhq/hw-transport-webhid/lib-es/TransportWebHID.js b/node_modules/@ledgerhq/hw-transport-webhid/lib-es/TransportWebHID.js
index 8246e08..b79c4c0 100644
--- a/node_modules/@ledgerhq/hw-transport-webhid/lib-es/TransportWebHID.js
+++ b/node_modules/@ledgerhq/hw-transport-webhid/lib-es/TransportWebHID.js
@@ -107,8 +107,19 @@ class TransportWebHID extends Transport {
let result;
let acc;
while (!(result = framing.getReducedResult(acc))) {
- const buffer = yield this.read();
- acc = framing.reduceResponse(acc, buffer);
+ try {
+ const buffer = yield this.read();
+ acc = framing.reduceResponse(acc, buffer);
+ } catch (e) {
+ if (e instanceof TransportError && e.id === "InvalidChannel") {
+ // this can happen if the device is connected
+ // on a different channel (like another app)
+ // in this case we just filter out the event
+ console.log(e);
+ continue;
+ }
+ throw e;
+ }
}
log("apdu", "<= " + result.toString("hex"));
return result;

0 comments on commit c192ad9

Please sign in to comment.